Skip to content

Wrong results using proxies and HTTPS #1359

@astratto

Description

@astratto

Hi!

I've found that requests behaves quite weirdly when using a proxy with HTTPS endpoints.
It doesn't change if the proxy is specified using environment variables or using the proxies attribute.

Without proxy

import requests
rs = requests.session()
res = rs.request("get", 
   "https://api.bitbucket.org/1.0/repositories/tutorials/tutorials.bitbucket.org")

print res.text
>> u'{\n    "scm": "hg",
...
"/1.0/repositories/tutorials/tutorials.bitbucket.org"\n}'

Using a proxy

import requests
rs = requests.session()

proxies = { 'https': "http://localhost:3128" }
res = rs.request("get", 
   "https://api.bitbucket.org/1.0/repositories/tutorials/tutorials.bitbucket.org",
    proxies=proxies)

print res.text
>> u'<HTML></HTML>\r\n'

Note 1: that proxy uses a CNTML authentication
Note 2: it works with HTTP endpoints

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions