Created
July 7, 2017 15:10
-
-
Save josejailton/1aee01d76ac38a23aeb05a6954f2ef94 to your computer and use it in GitHub Desktop.
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 | |
from random import choice | |
#from requests import session | |
user_agents = [ | |
'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11', | |
'Opera/9.25 (Windows NT 5.1; U; en)', | |
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)', | |
'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Kubuntu)', | |
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19', | |
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0', | |
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1', | |
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19' | |
] | |
payload = { | |
'estabelecimento':'1', | |
'nCadastro':'---', | |
'username':'---', | |
'senha':'---', | |
'indSenhaCript':'S' | |
} | |
s = requests.Session() | |
s.post('https://www.userede.com.br/_layouts/DadosCadastrais/Login.aspx',data=payload, headers={'Referer':'https://www.userede.com.br/_layouts/DadosCadastrais/LoginSelecionaEstabelecimento.aspx','User-Agent':choice(user_agents)}) | |
r = s.get('https://www.userede.com.br/sites/fechado/extrato/Paginas/pn_relatorios.aspx') | |
a = r.headers | |
b = r.text | |
soup = BeautifulSoup.BeautifulSoup | |
soup = soup(b) | |
print(soup) | |
fichier = open("/resposta.html", "w") | |
fichier.write(str(a)) | |
fichier.write(str(b)) | |
fichier.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment