From 07ef957df19d4a4264c814bce9ef0f38df9821f0 Mon Sep 17 00:00:00 2001 From: Dimitri Vorona Date: Wed, 13 Dec 2017 11:18:01 +0100 Subject: [PATCH] Suggestion for a more clear use case in the README Hi, I think the suggested edit would highlight the more common use case. Cheers. --- README.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 59aa759..f8cf016 100644 --- a/README.rst +++ b/README.rst @@ -22,13 +22,17 @@ Usage is very simple and best illustrated with an example:: >>> from loginform import fill_login_form >>> import requests >>> url = "https://github.com/login" - >>> r = requests.get(url) - >>> fill_login_form(url, r.text, "john", "secret") + >>> session = requests.Session() + >>> r = session.get(url) + >>> login_info = fill_login_form(url, r.text, "john", "secret") + >>> login_info ([('authenticity_token', 'FQgPiKd1waDL+pycPH8IGutirTnP69SiZgm0zXwn+VQ='), ('login', 'john'), ('password', 'secret')], u'https://github.com/session', 'POST') + >>> # now can login using the login_info object + >>> session.request(login_info[2], login_info[1], data=login_info[0]) And it is possible to use it as a tool to quickly debug a login form::