by
285 9
0
3
3,007
0
Top 1% !
Famous
Specified
Popularity: 4026th place
Created
Modified Sep 30, 2016
This snippet is Public
No tags for this snippet yet.
Languagepython
LicenseMIT_X11

Fazendo login com BeautifulSoup

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1463556/Fazendo-login-com-BeautifulSoup?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
import mechanize from BeautifulSoup import BeautifulSoup ##from bs4 import BeautifulSoup import urllib2 import cookielib cj = cookielib.CookieJar() br = mechanize.Browser() br.set_cookiejar(cj) br.open("http://www.xxx.com.br/") br.select_form(nr=0) br.form['usuarioLogin'] = "xxxxxxxxxxxxxxx" br.form['usuarioSenha'] = "yyyyyyyyyyyyyyyyy" br.submit() pagina = br.response().read() soup = BeautifulSoup(pagina) imagens = soup.findAll("img") for registros in imagens: for registro in registros: print registro
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus