-
Notifications
You must be signed in to change notification settings - Fork 12
/
test_.py
23 lines (16 loc) · 742 Bytes
/
test_.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""This is a test script to check the landing page for broken urls
which is returning a 200 OK response.
"""
import requests
from bs4 import BeautifulSoup
url = "https://www.reddit.com/user/rahulrajpl1111"
headers = {'user-agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Mobile Safari/537.36'}
response = requests.(url , headers=headers )
soup = BeautifulSoup(response.content, 'html.parser')
print(soup.prettify())
# print(response.status_code)
# print ('----------------------')
# print(soup.find_all('div',{'class':'_3VTI5BOpJO70xoBKSqz3O9'}))
# print(soup.find_all('h3'))
# if 'The person may have been banned' in soup.text:
# print("Page Not Found")