skip to navigation
skip to content

loginform 1.1.1

Fill HTML login forms automatically

loginform is a library for filling HTML login forms given the login url, username & password. Which form and fields to fill are inferred automatically.

It’s implemented on top of lxml form filling, and thus depends on lxml.


Usage is very simple and best illustrated with an example:

>>> from loginform import fill_login_form
>>> import requests
>>> url = ""
>>> r = requests.get(url)
>>> fill_login_form(url, r.text, "john", "secret")
([('authenticity_token', 'FQgPiKd1waDL+pycPH8IGutirTnP69SiZgm0zXwn+VQ='),
  ('login', 'john'),
  ('password', 'secret')],

And it is possible to use it as a tool to quickly debug a login form:

$ python -m loginform -u john -p secret
method: POST
- authenticity_token: FQgPiKd1waDL+pycPH8IGutirTnP69SiZgm0zXwn+VQ=
- login: john
- password: secret


A collection of real-world samples is used to keep this library tested. Those samples are managed as follows:

First, you select a site to try, find out its login url, and run the following command to try loginform on it:

$ python

From the output you can judge if it worked or not. If it worked, great. If it didn’t, you would hack to make it work and then add the sample with:

$ python -w github

Note that we gave the sample a name (github in this case).

To list all availabe samples use:

$ python -l

To run all tests, install tox and run:

$ tox
File Type Py Version Uploaded on Size
loginform-1.1.1-py2-none-any.whl (md5) Python Wheel py2 2015-08-14 3KB
loginform-1.1.1.tar.gz (md5) Source 2015-08-14 2KB
  • Downloads (All Versions):
  • 53 downloads in the last day
  • 313 downloads in the last week
  • 987 downloads in the last month