Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Requests not behaving...
#1
Hey guys,

I've been trying to establish an http connection with requests. The problem is that I'm getting an ssl exceptions error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='www.thesite.org', port=443): Max retries exceeded with url: /?msg=login_err (Caused by SSLError(CertificateError("hostname 'www.thesite.org' doesn't match either of '*.webfaction.com', 'webfaction.com'",),))

So the ssl is improperly setup, so I'm not touching it. I've been trying to connect with http.

import requests

s = requests.session()

url = 'http://www.thesite.org/login.py'
data = {'username':'myusername', 'passwd':'mypassword'}
s.post(url, data)
s.get(url)
Is there any way to force the http connection?

So far I've tried verify=False... and I get a similar error about exceeding redirects.

Any ideas?

NVM

So if people come across this issue in the future, the answer is to specify the port in the URL.

so the above code will work with the line:

url = 'http://www.thesite.org/login.py:80'
Happy coding
Reply
#2
Does that actually fix it, though?  Not all servers accept https connections on port 80, and your protocol is also http...
I'd sniff the network if I were you (on windows, that's easy with Fiddler) and verify that the connection is actually encrypted.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ConfigParser(dict_type=) not behaving as expected malonn 5 3,227 Sep-08-2022, 08:42 AM
Last Post: malonn
  Two loops behaving differently DavidTheGrockle 5 2,456 Dec-27-2020, 03:56 AM
Last Post: deanhystad
  if condition not behaving as expected EricBHK 10 3,688 May-16-2020, 03:41 PM
Last Post: EricBHK

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020