requests icon indicating copy to clipboard operation
requests copied to clipboard

Weird behaviour with https and proxy authentication

Open sigscanner opened this issue 2 years ago • 4 comments
trafficstars

requests.get is getting weird with some combinations of dictionary keys and proxy authentication.

Expected Result

print(requests.get('https://google.com', proxies={"https" : 'https://user:pass@ip:port'}))

Output: <Response [200]>

Actual Result

Doesn't run? (Maybe timeout) But it somehow fixes itself with these changes

print(requests.get('https://google.com', proxies={"http" : 'http://user:pass@ip:port'}))

Output: <Response [200]>

Reproduction Steps

import requests

print(requests.get('https://google.com', proxies={"https" : 'https://user:pass@ip:port'}))

print(requests.get('https://google.com', proxies={"http" : 'http://user:pass@ip:port'}))

System Information

$ python -m requests.help
{
  "chardet": {
    "version": null
  },
  "charset_normalizer": {
    "version": "2.0.12"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "3.4"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.10.11"
  },
  "platform": {
    "release": "10",
    "system": "Windows"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.27.1"
  },
  "system_ssl": {
    "version": "1010114f"
  },
  "urllib3": {
    "version": "1.26.9"
  },
  "using_charset_normalizer": true,
  "using_pyopenssl": false
}
$ python --version
Python 3.10.11

sigscanner avatar Nov 19 '23 00:11 sigscanner

proxies im using are https capable

sigscanner avatar Nov 20 '23 08:11 sigscanner

misclick

sigscanner avatar Nov 20 '23 08:11 sigscanner

its most likely that your proxies only support http protocol, it should work the way you have it, so its probably proxy issues.

visions4k avatar Nov 23 '23 01:11 visions4k

proxies im using are https capable

its most likely that your proxies only support http protocol, it should work the way you have it, so its probably proxy issues.

sigscanner avatar Nov 24 '23 08:11 sigscanner