Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Read and re-read your post and the other folks answers a few times. My thoughts:</p> <p>When you implemented in mechanize and urllib2, it looks like the cookies were hard coded into the header response. This would most likely cause the form to kick you out.</p> <p>When you switched to using the web broswer and using the python 'requests' library, the cookies and sessions handling was being taken care of behind the scenes.</p> <p>I believe that if you change your code to take into account the cookie and session states, ie. presume an automated session at start, has an empty cookie for the site and no session data, but properly tracks and manages it during the session, it should work.</p> <p>Simple copying and substituting the header data will not work, and a properly coded site should bounce you back to the beginning.</p> <p>Without seeing the backend code for the website, the above is my observation. Cookies and Session data are the culprit.</p> <p>Edit:</p> <p>Found this link: <a href="http://docs.python-requests.org/en/latest/" rel="nofollow">http://docs.python-requests.org/en/latest/</a></p> <p>Which describes accessing a site with authentication/etc. The format of the authentication is similar to the Requests implementation you are using. They link to a git source for a urllib2 implementation that does the same thing and I noticed that the authentication bits are different from how you are doing the auth bits:</p> <p><a href="https://gist.github.com/kennethreitz/973705" rel="nofollow">https://gist.github.com/kennethreitz/973705</a></p> <p>from the page:</p> <pre><code>password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() password_manager.add_password(None, gh_url, 'user', 'pass') auth_manager = urllib2.HTTPBasicAuthHandler(password_manager) opener = urllib2.build_opener(auth_manager) </code></pre> <p>I wonder if you change the way you are implementing the authentication bits for the urllib2 implementation, that it would work. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload