python - HTTPS log in with urllib2 -


I currently have a small script that downloads a webpage and removes some data, which I am interested in . Nothing fancy

I am currently downloading this page:

  import command command = 'wget --output-document = - --quiet --http-user = USER --http -password = PASSWORD https://www.example.ca/page.aspx 'status, text = commands .getstatusoutput (command)  

though it works perfectly That is, I thought it means removing dependence on Wget. I thought it should be trivial to change the urllib2 above, but thus far I have zero success. Internet is a full urllib2 example, but I have not found anything that matches the requirement of simple authentication with a simple username and password with an HTTPS server.

The module provides a modern API for HTTP / HTTPS capabilities.

  import request url = 'https: //Www.someserver.com/toplevelur/somepage.htm' res = requests.get (url, auth) = ('USER', 'password')) = res.status_code text = res.text  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -