Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- def login(url, username, password):
- try:
- headers = requests.utils.default_headers()
- headers.update({
- 'User-Agent': 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)',
- })
- response = requests.get(url, auth=(username, password),headers=headers, verify=False)
- print(response)
- if response.status_code == 200:
- with open(os.getcwd() + "\\html.txt", 'wb') as f:
- f.write(response.content)
- html = response.text
- content = html.encode('utf-8')
- print(content)
- except:
- print('Algo Deu Errado...')
- if __name__ == '__main__':
- url = 'URL DO SITE'
- username = 'SEU USUÁRIO'
- password = 'SUA SENHA'
- login(url, username, password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement