Skip to content

Instantly share code, notes, and snippets.

@JohnStuartRutledge
Last active June 14, 2017 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnStuartRutledge/44be8d4b5f60cdc48c15387022bd8c98 to your computer and use it in GitHub Desktop.
Save JohnStuartRutledge/44be8d4b5f60cdc48c15387022bd8c98 to your computer and use it in GitHub Desktop.
quick example
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