Last active
June 14, 2017 22:26
-
-
Save JohnStuartRutledge/44be8d4b5f60cdc48c15387022bd8c98 to your computer and use it in GitHub Desktop.
quick example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
headers = { | |
'host': '...etc', | |
'user-agent': 'Mozilla... etc', | |
} | |
url = 'https://global.sitesafety.trendmicro.com/result.php' | |
cookies = {'some_cookie_name': 'example cookie value'} | |
payload = {'urlname': domain, 'getinfo': 'Check+Now'} | |
result = requests.get(url, params=payload, headers=headers, cookies=cookies) | |
if result.status_code == 200: | |
soup = BeautifulSoup(result.content) | |
matching_divs = soup.find_all('div', class_='labeltitleresult') | |
for div in matching_divs: | |
print(div) | |
else: | |
print('failed to get the page somehow, see: {}'.format(results.status_code)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment