Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I will attempt a shot at this. Firstly, as per the HTML form code snippet posted, the form performs POST action to a GET URL <code>https://www.myebill.com/index.asp?nam</code>. You may want to confirm once again that this is the URL you indeed want to POST to.</p> <p>Having said that, urllib2 already supports an HTTPSHandler. There is a related Stack Overflow discussion on how to access web services over using Python <a href="https://stackoverflow.com/questions/5082128/how-do-i-authenticate-a-urllib2-script-in-order-to-access-https-web-services-fro">here</a>. While, this is not directly related to the query - the answer to this question contains good pointers about what care should be taken when we are attempting to logon using HTTPS via a program. Most specifically, it is the setting of the <strong>Referer</strong> tag within the header. This is necessary, since secure websites use this mechanism to protect themselves from a CSRF attack.</p> <p>The below code snipet shows the <strong>most important</strong> settings that you would need to put in place prior to making a request. I got this from the <a href="http://nullege.com/codes/show/src@s@i@simpledropbox-0.2.2@simpledropbox@__init__.py/105/urllib2.HTTPSHandler/python" rel="nofollow noreferrer">Nullege Python for Simple Dropbox Login</a></p> <pre><code>handlers = [ urllib2.HTTPHandler(debuglevel=debug), urllib2.HTTPSHandler(debuglevel=debug), urllib2.HTTPCookieProcessor(cookiejar), ] opener = urllib2.build_opener(*handlers) urllib2.install_opener(opener) #the opener will be used for all urlopen requests from now on. </code></pre> <p>Note the use of the HTTPSHandler.</p> <p>You then fill in the authentication information:</p> <pre><code>payload = urllib.urlencode({'username' : username, 'j_password' : password}) </code></pre> <p>and then perform a login:</p> <pre><code>headers['Referer'] = self.urlbase #note the presence of the "Referer' header req = urllib2.Request(url=self.urlbase+'login', data=data, headers=headers) cookiejar.add_cookie_header(req) page = urllib2.urlopen(req) pdata = page.read() </code></pre> <p>I hope this gives you an idea on how to go about..</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. This table or related slice is empty.
    1. 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