Login to website with Python requests
<p>I am having some trouble logging into this website: <a href="https://illinoisjoblink.illinois.gov/ada/r/home" rel="nofollow">https://illinoisjoblink.illinois.gov/ada/r/home</a></p>

<p>I am able to submit the payload, but I get redirected to a page claiming a bookmark error. Here is the code and relevant error messages. I'm not sure how to proceed. I appreciate any and all help. Thanks!</p>

<pre class="lang-python prettyprint-override"><code>    session = requests.Session()
    soup = BeautifulSoup(session.get(SEARCH_URL).content, "html.parser")
    inputs = soup.find_all('input')
    token = ''
    for t in inputs:
        try:
            if t['name'] == 'authenticity_token':
                token = t['value']
                break
        except KeyError as e:
            pass
    login_data = dict(v_username=USER_NAME,
                      v_password=PASSWORD,
                      authenticity_token=token,
                      commit='Log In')
    login_data['utf-8'] = '&amp;#x2713;'

    r = session.post(LOGIN_URL, data=login_data)

    print(r.content)
</code></pre>

<p>
<code>Bookmark Error &lt;b&gt;You may be seeing this error as a result of bookmarking this page. Unfortunately, our site design will not allow the bookmarking of most internal pages.&lt;/b&gt; If you wish to contact the system administra
tor concerning this error, you may send an email to &lt;a href="mailto:DES.IJLSysAdmSpprt@illinois.gov"&gt;DES.IJLSysAdmSpprt@illinois.gov&lt;/a&gt;. Please reference error number &lt;b&gt;646389&lt;/b&gt;.&lt;p&gt;Thank you for your patience.&lt;br&gt;&lt;br&gt; Hit your browser back button to return to the previous page.
</code></p>

<p>Perhaps your <code>login_data</code> parameters are wrong? When I inspect the POST for logging in, the necessary parameters appear to be: <code>v_username</code>, <code>v_password</code>, <code>FormName</code>, <code>fromlogin</code>, and maybe most importantly, <code>button</code>. I would suggest you add all these parameters to your <code>login_data</code> dictionary. Your dictionary would look something like:</p>

<pre><code>login_data = {'v_username': USER_NAME,
              'v_password': PASSWORD,
              'authenticity_token': token,
              'FormName': 0,
              'fromlogin': 1,
              'button': 'Log+in'}
</code></pre>

python login website python-requests screen-scraping