Questions tagged [mechanize-python]

Stateful programmatic web browsing in Python, after Andy Lester’s Perl module WWW::Mechanize.

Stateful programmatic web browsing in Python, after Andy Lester’s Perl module WWW::Mechanize.

Some of the key features:

  • The browser class mechanize.Browser implements the interface of urllib2.OpenerDirector, so any URL can be opened not just http.
  • Easy HTML form filling.
  • Convenient link parsing and following.
  • Browser history (.back() and .reload() methods).
  • The Referer HTTP header is added properly (optional).
  • Automatic observance of robots.txt (can be disabled if desired).
  • Automatic handling of HTTP-Equiv and Refresh.

python-mechanize was created by John J. Lee. Maintenance was taken over by Kovid Goyal.


HomePage | Documentation | Github | FAQ


235 questions
-1
votes
1 answer

How to get cookie after login using mechanize

import mechanize import json import re from bs4 import BeautifulSoup import requests browser = mechanize.Browser() class login: def __init__(self): email = "aaaa" password = "bbb" url =…
Ajay
  • 89
  • 6
-1
votes
1 answer

This Python program isnt working and their is no apparent reason

I found this code online and I tried my best to patch it. I don't understand whats wrong with this program. This code takes in Netflix accounts and outputs the working accounts. import mechanize import sys import time from colorama import init,…
-1
votes
1 answer

Mechanize not logging in?

I'm very new to python, and I'm trying to scrape a webpage using BeautifulSoup, which requires a log in. So far I have import mechanize import cookielib import requests from bs4 import BeautifulSoup # Browser br = mechanize.Browser() # Cookie…
-1
votes
1 answer

Trying to get Facebook account password too often locks me out

I was locked out of my Facebook account for a few hours after I tried to make a script get my password (I already know my account's password). Do I have a problem in my python script, or is the way I tried to use it wrong? Script: passwordsfile =…
alan
  • 3
  • 1
-1
votes
1 answer

Python - How do I submit a form with Mechanize

I am trying to submit a form by using Mechanize in Python. The form is shown as Form name: None
XxX
  • 36
  • 3
-1
votes
1 answer

Login with mechanize python. String returned

Im trying to make a script to access a webpage. It loads the first page, finds the login form, fill it and submit. The website works just like facebook, if you have the cookie already you are redirected to your feed list, otherwise to the login…
-1
votes
2 answers

unable to import browser from mechanize

I am using mechanize for the first time. If I type the line from mechanize import Browserin python shell (interpreter) it doesn't give any error but when run the same code as a part of a .py file it gives the following error: Traceback (most recent…
Namit Juneja
  • 498
  • 5
  • 13
-1
votes
1 answer

get facebook page full public photostream

there's only one similar question and it's not been answered. not for me at least. There are public pages on Facebook, suppose i want to get their photostream ? their album pictures ? I don't see how the Graph API allows me access since i can't get…
-3
votes
2 answers

python mechanize forms()

For this code: import mechanize br = mechanize.Browser() br.set_handle_robots(False) br.open("https://www.facebook.com/login/identify?ctx=recover") for i in bt.forms(): print i the result is:
-13
votes
1 answer

brute force script python and mechanize

I'm trying to brute force the Facebook login page with a python script, however whenever I run the code I get the errors below. My code is: br =…
1 2 3
15
16