url
stringlengths
50
53
repository_url
stringclasses
1 value
labels_url
stringlengths
64
67
comments_url
stringlengths
59
62
events_url
stringlengths
57
60
html_url
stringlengths
38
43
id
int64
597k
2.65B
node_id
stringlengths
18
32
number
int64
1
6.83k
title
stringlengths
1
296
user
dict
labels
listlengths
0
5
state
stringclasses
2 values
locked
bool
2 classes
assignee
dict
assignees
listlengths
0
4
milestone
dict
comments
int64
0
211
created_at
stringlengths
20
20
updated_at
stringlengths
20
20
closed_at
stringlengths
20
20
author_association
stringclasses
3 values
active_lock_reason
stringclasses
4 values
body
stringlengths
0
65.6k
closed_by
dict
reactions
dict
timeline_url
stringlengths
59
62
performed_via_github_app
null
state_reason
stringclasses
3 values
draft
bool
2 classes
pull_request
dict
is_pull_request
bool
2 classes
issue_comments
listlengths
0
30
https://api.github.com/repos/psf/requests/issues/5900
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5900/labels{/name}
https://api.github.com/repos/psf/requests/issues/5900/comments
https://api.github.com/repos/psf/requests/issues/5900/events
https://github.com/psf/requests/issues/5900
963,211,190
MDU6SXNzdWU5NjMyMTExOTA=
5,900
Basic authentication with a proxy not using Proxy-Authorization header
{ "avatar_url": "https://avatars.githubusercontent.com/u/12960990?v=4", "events_url": "https://api.github.com/users/janemba/events{/privacy}", "followers_url": "https://api.github.com/users/janemba/followers", "following_url": "https://api.github.com/users/janemba/following{/other_user}", "gists_url": "https://api.github.com/users/janemba/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/janemba", "id": 12960990, "login": "janemba", "node_id": "MDQ6VXNlcjEyOTYwOTkw", "organizations_url": "https://api.github.com/users/janemba/orgs", "received_events_url": "https://api.github.com/users/janemba/received_events", "repos_url": "https://api.github.com/users/janemba/repos", "site_admin": false, "starred_url": "https://api.github.com/users/janemba/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/janemba/subscriptions", "type": "User", "url": "https://api.github.com/users/janemba", "user_view_type": "public" }
[]
closed
true
null
[]
null
9
2021-08-07T11:21:25Z
2021-08-19T00:45:30Z
2021-08-17T16:45:32Z
NONE
off-topic
Hello, I am trying to perform an HTTPS request with a proxy with proxy authentication. I tried to do it using two different ways but I had the same issue for both which result on the following error: ``` [...] File "/usr/lib64/python3.9/http/client.py", line 285, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected:` Remote end closed connection without response [...] File "/home/janemba/.local/lib/python3.9/site-packages/urllib3/util/retry.py", line 446, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='wtfismyip.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response'))) ``` Monitoring the request using `Wireshark` I've noticed the `Proxy-Authorization` header hasn't been set. I performed the request that way: ``` class HTTPProxyAuth(requests.auth.HTTPBasicAuth): def __call__(self, r): auth_s = base64.b64encode('{}:{}'.format(self.username, self.password).encode('utf-8')) r.headers['Proxy-Authorization'] = ('Basic %s' % auth_s) return r s = requests.Session() s.proxies = {"https": "https://{}:{}".format(ip, port)} s.auth = HTTPProxyAuth(login, password) r = s.get("https://wtfismyip.com") print(r.headers) print(r.text) ``` And: ``` r = requests.get('https://wtfismyip.com', proxies={'https':'https://1.2.3.4:443'}, auth=requests.auth.HTTPProxyAuth('login','password')) print(r.headers) print(r.text) ``` For both requests I got the exact same issue, the `Proxy-Authorization` header is not set.
{ "avatar_url": "https://avatars.githubusercontent.com/u/12960990?v=4", "events_url": "https://api.github.com/users/janemba/events{/privacy}", "followers_url": "https://api.github.com/users/janemba/followers", "following_url": "https://api.github.com/users/janemba/following{/other_user}", "gists_url": "https://api.github.com/users/janemba/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/janemba", "id": 12960990, "login": "janemba", "node_id": "MDQ6VXNlcjEyOTYwOTkw", "organizations_url": "https://api.github.com/users/janemba/orgs", "received_events_url": "https://api.github.com/users/janemba/received_events", "repos_url": "https://api.github.com/users/janemba/repos", "site_admin": false, "starred_url": "https://api.github.com/users/janemba/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/janemba/subscriptions", "type": "User", "url": "https://api.github.com/users/janemba", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5900/reactions" }
https://api.github.com/repos/psf/requests/issues/5900/timeline
null
completed
null
null
false
[ "```python\r\ns.proxies = {\r\n 'https': f'https://{username}:{password}@{ip}:{port}'\r\n} \r\nr = s.get(\"https://wtfismyip.com\")\r\n```", "Hmm...the password itself is 790 characters.\r\n\r\nIs there a way to add the `Proxy-Authorization` header for the HTTP `CONNECT` request ?", "https://datatracker.ietf.org/doc/html/rfc2617#section-2\r\n\r\n```\r\n To receive authorization, the client sends the userid and password,\r\n separated by a single colon (\":\") character, within a base64 [7]\r\n encoded string in the credentials.\r\n\r\n basic-credentials = base64-user-pass\r\n base64-user-pass = <base64 [4] encoding of user-pass, except not limited to 76 char/line>\r\n user-pass = userid \":\" password\r\n userid = *<TEXT excluding \":\">\r\n password = *TEXT\r\n```\r\n", "That's not what I did in my custom class `HTTPProxyAuth` ? (first post)", "I'm trying to use a proxy as a remote but it keep on saying 407 authentication how can I get the proxy credentials? ", "This is an authenticated proxy so if you don't have the credentials it won't work.\r\n\r\nNow, you can forget about `requests` for this and especially if your proxy is waiting for a `Proxy-Authorization` header as usually `HTTP/1.1` is expected but `HTTP/1.0` will always been used if you try with `requests`. Also, `requests` library does not implement `HTTPS` connection with a proxy. The only way I found to perform all of this was using `pycurl`.", "Please see the attached file. My proxy is 13.244.165.24 it respond with\n407. I need to know the part that is highlighted with pink which I believe\nits the credentials of the proxy.\n\nOn Tue, Aug 17, 2021, 6:45 PM janemba ***@***.***> wrote:\n\n> This is an authenticated proxy so if you don't have the credentials it\n> won't work.\n>\n> Now, you can forget about requests for this and especially if your proxy\n> is waiting for a Proxy-Authorization header as usually HTTP/1.1 is\n> expected but HTTP/1.0 will always been used if you try with requests.\n> Also, requests library is not implemented HTTPS connection with a proxy.\n> The only way I found to perform all of this was using pycurl.\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/psf/requests/issues/5900#issuecomment-900458681>, or\n> unsubscribe\n> <https://github.com/notifications/unsubscribe-auth/AHDVRRLJIEHWSBJ6V66DO7LT5KG3PANCNFSM5BXKDRYQ>\n> .\n>\n", "Hmm..I can't see your attached file.", "Please check my proxy 13.244.165.24:80\n\nOn Wed, Aug 18, 2021, 10:49 AM janemba ***@***.***> wrote:\n\n> Hmm..I can't see your attached file.\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/psf/requests/issues/5900#issuecomment-900937454>, or\n> unsubscribe\n> <https://github.com/notifications/unsubscribe-auth/AHDVRRJOLS7LENHZYYIWMEDT5NXY7ANCNFSM5BXKDRYQ>\n> .\n>\n" ]
https://api.github.com/repos/psf/requests/issues/5899
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5899/labels{/name}
https://api.github.com/repos/psf/requests/issues/5899/comments
https://api.github.com/repos/psf/requests/issues/5899/events
https://github.com/psf/requests/pull/5899
959,918,806
MDExOlB1bGxSZXF1ZXN0NzAyOTkyNzE0
5,899
Fix broken link to adapters essay
{ "avatar_url": "https://avatars.githubusercontent.com/u/142512?v=4", "events_url": "https://api.github.com/users/itsadok/events{/privacy}", "followers_url": "https://api.github.com/users/itsadok/followers", "following_url": "https://api.github.com/users/itsadok/following{/other_user}", "gists_url": "https://api.github.com/users/itsadok/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/itsadok", "id": 142512, "login": "itsadok", "node_id": "MDQ6VXNlcjE0MjUxMg==", "organizations_url": "https://api.github.com/users/itsadok/orgs", "received_events_url": "https://api.github.com/users/itsadok/received_events", "repos_url": "https://api.github.com/users/itsadok/repos", "site_admin": false, "starred_url": "https://api.github.com/users/itsadok/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/itsadok/subscriptions", "type": "User", "url": "https://api.github.com/users/itsadok", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-08-04T05:39:12Z
2021-11-02T06:00:24Z
2021-08-04T05:58:51Z
CONTRIBUTOR
resolved
null
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5899/reactions" }
https://api.github.com/repos/psf/requests/issues/5899/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5899.diff", "html_url": "https://github.com/psf/requests/pull/5899", "merged_at": "2021-08-04T05:58:51Z", "patch_url": "https://github.com/psf/requests/pull/5899.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5899" }
true
[]
https://api.github.com/repos/psf/requests/issues/5898
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5898/labels{/name}
https://api.github.com/repos/psf/requests/issues/5898/comments
https://api.github.com/repos/psf/requests/issues/5898/events
https://github.com/psf/requests/issues/5898
958,028,322
MDU6SXNzdWU5NTgwMjgzMjI=
5,898
connection with retry=0 is retried
{ "avatar_url": "https://avatars.githubusercontent.com/u/2773622?v=4", "events_url": "https://api.github.com/users/lucas03/events{/privacy}", "followers_url": "https://api.github.com/users/lucas03/followers", "following_url": "https://api.github.com/users/lucas03/following{/other_user}", "gists_url": "https://api.github.com/users/lucas03/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/lucas03", "id": 2773622, "login": "lucas03", "node_id": "MDQ6VXNlcjI3NzM2MjI=", "organizations_url": "https://api.github.com/users/lucas03/orgs", "received_events_url": "https://api.github.com/users/lucas03/received_events", "repos_url": "https://api.github.com/users/lucas03/repos", "site_admin": false, "starred_url": "https://api.github.com/users/lucas03/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/lucas03/subscriptions", "type": "User", "url": "https://api.github.com/users/lucas03", "user_view_type": "public" }
[]
closed
true
null
[]
null
5
2021-08-02T11:06:07Z
2021-11-01T13:10:33Z
2021-08-02T21:32:49Z
NONE
resolved
We have a celery task, where we just ping emailing service to send an email. We use requests for that with following params: ``` CONNECTION_TIMEOUT = 3 READ_TIMEOUT = 26 DEFAULT_TIMEOUT = (CONNECTION_TIMEOUT, READ_TIMEOUT) ... DEFAULT_MAX_REQUEST_RETRIES = 0 ``` we then initialize session with `timeout=DEFAULT_TIMEOUT` and when firing GET request, we pass `max_retries=0`. On celery side, we set `soft_time_limit=(emailing.CONNECTION_TIMEOUT + emailing.READ_TIMEOUT + 2) * (1 + DEFAULT_MAX_REQUEST_RETRIES)`, which amounts to 31 seconds (29 for possible timeouts and 2 seconds for extra room/processing). But yesterday we saw `SoftTimeLimitExceeded` being raised from this task. Looking into logs, I can see the request was retried: ``` Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='our_host.example.com', port=30303): Read timed out. (read timeout=26)",)': /data/{path} ``` I found log warning in the code of urllib3: ``` if not conn: # Try again log.warning( "Retrying (%r) after connection broken by '%r': %s", retries, err, url ) return self.urlopen( ``` So after a timeout of 26 seconds, we should finish the celery task, but urllib3 is retrying after a broken connection and we hit the limit in async worker. ## Expected Result I expect requests retry only number of times specified in `max_retries` ## Actual Result Broken connections are retried ## Reproduction Steps ## System Information $ python -m requests.help ``` { "chardet": { "version": "3.0.4" }, "cryptography": { "version": "3.4.7" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.6.9" }, "platform": { "release": "20.3.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "101010bf", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010af" }, "urllib3": { "version": "1.26.4" }, "using_pyopenssl": true } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5898/reactions" }
https://api.github.com/repos/psf/requests/issues/5898/timeline
null
completed
null
null
false
[ "> we then initialize session with `timeout=DEFAULT_TIMEOUT` and when firing GET request, we pass `max_retries=0`.\r\n\r\nBased on what you describe here either you're not using Requests and are using something that wraps requests - in which case, I'm certain this is their bug - or you're attempting something this library does not in reality support.\r\n\r\nhttps://github.com/psf/requests/blob/b227e3cb82c8d42ea27790d615ecafe12528d3bc/requests/sessions.py#L362-L422 shows that there is no session level timeout setting (as searching closed issues will also show you) and there's no Session-level retries configuration. Without any semblance of code to reproduce this, I'm going to close this since I cannot fathom what you're trying to convey above", "oh right, sorry about that. Yes we use [wrapped requests](https://github.com/kiwicom/request-session), where [max_retries is just while cycle](https://github.com/kiwicom/request-session/blob/master/request_session/request_session.py#L314) and timeout is passed as param to [session.request()](https://github.com/kiwicom/request-session/blob/master/request_session/request_session.py#L446). \r\n\r\nSo I should have asked, how come the `send()` method on the session object can take longer than the specified timeout? Twice as long.", "> So I should have asked, how come the `send()` method on the session object can take longer than the specified timeout? Twice as long.\r\n\r\nIf you search open and closed issues, this would become apparent. The short answer is the following: the `read` timeout isn't a wall clock timeout. In all likelihood, we're issuing a `read` and the server is sending back some data at a trickle. So maybe there's N seconds where the data sends back a few bytes at a time - that resets the read timeout. So you might even have a server that trickles data back for 26 seconds or 30s or even several minutes and then stops sending data. The last byte it sends starts the 26s timeout. It's not \"26s for the whole read\". It's \"26s of no data being sent\".", "Oh, ok. Thanks for the explanation and sorry if it was explained before. I was searching issues for that log message + our custom retries confused me, I naively thought this was a simple use case that is supported in requests. Thanks again.", "It's not easy to support a wall clock timeout in python across all supported operating systems. Heck our tests still get people reporting they don't run on extremely esoteric bit sets and architectures. We're in a rough spot to be able to support this use case beyond what the standard operating system behavior is" ]
https://api.github.com/repos/psf/requests/issues/5897
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5897/labels{/name}
https://api.github.com/repos/psf/requests/issues/5897/comments
https://api.github.com/repos/psf/requests/issues/5897/events
https://github.com/psf/requests/issues/5897
957,915,248
MDU6SXNzdWU5NTc5MTUyNDg=
5,897
get invalid url in InvalidSchema
{ "avatar_url": "https://avatars.githubusercontent.com/u/44614849?v=4", "events_url": "https://api.github.com/users/aliraad79/events{/privacy}", "followers_url": "https://api.github.com/users/aliraad79/followers", "following_url": "https://api.github.com/users/aliraad79/following{/other_user}", "gists_url": "https://api.github.com/users/aliraad79/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/aliraad79", "id": 44614849, "login": "aliraad79", "node_id": "MDQ6VXNlcjQ0NjE0ODQ5", "organizations_url": "https://api.github.com/users/aliraad79/orgs", "received_events_url": "https://api.github.com/users/aliraad79/received_events", "repos_url": "https://api.github.com/users/aliraad79/repos", "site_admin": false, "starred_url": "https://api.github.com/users/aliraad79/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/aliraad79/subscriptions", "type": "User", "url": "https://api.github.com/users/aliraad79", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-08-02T08:51:36Z
2021-10-31T22:00:29Z
2021-08-02T21:33:46Z
NONE
resolved
Requests is not accepting feature requests at this time. Hi, I do a get request on a url that redirects to a intent:// or market:// url which are the meaningful url in android. After raising requests.exceptions.InvalidSchema i want to get this invalid url and do something else with it but there isn't a perfect way to do it so i do something like ``` e.args[0].split("'")[1] ``` that is a very bad and weird way to do it. python=3.9 and requests = "2.23.0"
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5897/reactions" }
https://api.github.com/repos/psf/requests/issues/5897/timeline
null
completed
null
null
false
[ "> Requests is not accepting feature requests at this time.\r\n\r\nAlso this isn't cogent so it's not as if we could assist you with suggesting what to do instead. For questions, please use StackOverflow." ]
https://api.github.com/repos/psf/requests/issues/5896
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5896/labels{/name}
https://api.github.com/repos/psf/requests/issues/5896/comments
https://api.github.com/repos/psf/requests/issues/5896/events
https://github.com/psf/requests/issues/5896
957,559,759
MDU6SXNzdWU5NTc1NTk3NTk=
5,896
ProxySchemeUnknown on Python 3.9
{ "avatar_url": "https://avatars.githubusercontent.com/u/3654783?v=4", "events_url": "https://api.github.com/users/iwalucas/events{/privacy}", "followers_url": "https://api.github.com/users/iwalucas/followers", "following_url": "https://api.github.com/users/iwalucas/following{/other_user}", "gists_url": "https://api.github.com/users/iwalucas/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/iwalucas", "id": 3654783, "login": "iwalucas", "node_id": "MDQ6VXNlcjM2NTQ3ODM=", "organizations_url": "https://api.github.com/users/iwalucas/orgs", "received_events_url": "https://api.github.com/users/iwalucas/received_events", "repos_url": "https://api.github.com/users/iwalucas/repos", "site_admin": false, "starred_url": "https://api.github.com/users/iwalucas/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/iwalucas/subscriptions", "type": "User", "url": "https://api.github.com/users/iwalucas", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-08-01T18:49:05Z
2021-11-25T20:00:36Z
2021-08-27T19:12:23Z
NONE
resolved
During an upgrade from python 3.7 to 3.9 I face an error similar to the one reported on #5297. The proxies are defined on the system level (export http_proxy and export https_proxy). It works fine on 3.7. ## Expected Result Requests respect the proxy ## Actual Result Proxy causes the request fo fail ## Reproduction Steps ```python import requests headers={} payload={} url='https://www.someurl.com' response = requests.request("POST", url, headers=headers, data = payload) ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "3.0.4" }, "cryptography": { "version": "" }, "idna": { "version": "2.8" }, "implementation": { "name": "CPython", "version": "3.9.6" }, "platform": { "release": "20.6.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.22.0" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.25.11" }, "using_pyopenssl": false } ``` Traceback ``` response = requests.request("POST", url, headers=headers, data = payload) File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 412, in send conn = self.get_connection(request.url, proxies) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 309, in get_connection proxy_manager = self.proxy_manager_for(proxy) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 193, in proxy_manager_for manager = self.proxy_manager[proxy] = proxy_from_url( File "/usr/local/lib/python3.9/site-packages/urllib3/poolmanager.py", line 492, in proxy_from_url return ProxyManager(proxy_url=url, **kw) File "/usr/local/lib/python3.9/site-packages/urllib3/poolmanager.py", line 429, in __init__ raise ProxySchemeUnknown(proxy.scheme) ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5896/reactions" }
https://api.github.com/repos/psf/requests/issues/5896/timeline
null
completed
null
null
false
[ "Hi @iwalucas, can you please provide the proxies you’re using, or at least an identical format with sensitive info substituted? There isn’t enough information to determine if this is the same issue as #5297 or #5855.\r\n\r\nIn either case, this is almost certainly a duplicate.", "@nateprewitt I think its a duplicate of #5855... \r\nhere are the proxies:\r\n```\r\nHTTP_PROXY=proxy.mydomain.com:3128\r\nHTTPS_PROXY=proxy.mydomain.com:3128\r\n```", "I've added an update in #5855, we'll track further conversations around this there. I'll resolve this as a duplicate for now. Thanks!" ]
https://api.github.com/repos/psf/requests/issues/5895
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5895/labels{/name}
https://api.github.com/repos/psf/requests/issues/5895/comments
https://api.github.com/repos/psf/requests/issues/5895/events
https://github.com/psf/requests/pull/5895
956,368,128
MDExOlB1bGxSZXF1ZXN0Njk5OTc1ODMy
5,895
Clean up HTTP status code definitions
{ "avatar_url": "https://avatars.githubusercontent.com/u/12053937?v=4", "events_url": "https://api.github.com/users/jenstroeger/events{/privacy}", "followers_url": "https://api.github.com/users/jenstroeger/followers", "following_url": "https://api.github.com/users/jenstroeger/following{/other_user}", "gists_url": "https://api.github.com/users/jenstroeger/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jenstroeger", "id": 12053937, "login": "jenstroeger", "node_id": "MDQ6VXNlcjEyMDUzOTM3", "organizations_url": "https://api.github.com/users/jenstroeger/orgs", "received_events_url": "https://api.github.com/users/jenstroeger/received_events", "repos_url": "https://api.github.com/users/jenstroeger/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jenstroeger/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jenstroeger/subscriptions", "type": "User", "url": "https://api.github.com/users/jenstroeger", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-30T03:29:40Z
2021-11-26T05:00:34Z
2021-08-28T04:37:00Z
NONE
resolved
Follow-up to the conversation in issue https://github.com/psf/requests/issues/5892. As is, this change is not a breaking change and produces the exact same `_codes` dictionary. However, I’ve separated out the official HTTP status codes from third-party status codes and added references to relevant documentation. It would probably make sense to at least complete the list of [nginx codes](https://www.nginx.com/resources/wiki/extending/api/http/); [IIS codes](https://docs.microsoft.com/en-us/troubleshoot/iis/http-status-code) have non-integer sub-codes which may be problematic to represent here.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5895/reactions" }
https://api.github.com/repos/psf/requests/issues/5895/timeline
null
null
true
{ "diff_url": "https://github.com/psf/requests/pull/5895.diff", "html_url": "https://github.com/psf/requests/pull/5895", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5895.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5895" }
true
[ "I think the feedback here is the same as in the issue. We don't have an interest in expanding on what we already feel was a poor decision. It encourages users to continue (or start) building on a non-core feature, which will create more user pain if it is removed/consolidated in the future." ]
https://api.github.com/repos/psf/requests/issues/5894
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5894/labels{/name}
https://api.github.com/repos/psf/requests/issues/5894/comments
https://api.github.com/repos/psf/requests/issues/5894/events
https://github.com/psf/requests/pull/5894
955,407,969
MDExOlB1bGxSZXF1ZXN0Njk5MTYzNDc2
5,894
Prevent unnecessary should_bypass_proxies checks in rebuild_proxies
{ "avatar_url": "https://avatars.githubusercontent.com/u/1684354?v=4", "events_url": "https://api.github.com/users/dbaxa/events{/privacy}", "followers_url": "https://api.github.com/users/dbaxa/followers", "following_url": "https://api.github.com/users/dbaxa/following{/other_user}", "gists_url": "https://api.github.com/users/dbaxa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dbaxa", "id": 1684354, "login": "dbaxa", "node_id": "MDQ6VXNlcjE2ODQzNTQ=", "organizations_url": "https://api.github.com/users/dbaxa/orgs", "received_events_url": "https://api.github.com/users/dbaxa/received_events", "repos_url": "https://api.github.com/users/dbaxa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dbaxa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dbaxa/subscriptions", "type": "User", "url": "https://api.github.com/users/dbaxa", "user_view_type": "public" }
[]
closed
true
null
[]
{ "closed_at": "2021-12-30T21:48:07Z", "closed_issues": 11, "created_at": "2021-09-02T07:23:33Z", "creator": { "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }, "description": "", "due_on": null, "html_url": "https://github.com/psf/requests/milestone/29", "id": 7115399, "labels_url": "https://api.github.com/repos/psf/requests/milestones/29/labels", "node_id": "MI_kwDOABTKOs4AbJKH", "number": 29, "open_issues": 0, "state": "closed", "title": "2.27.0", "updated_at": "2021-12-30T21:48:07Z", "url": "https://api.github.com/repos/psf/requests/milestones/29" }
10
2021-07-29T02:56:36Z
2022-03-29T17:07:48Z
2021-12-29T17:06:05Z
CONTRIBUTOR
resolved
Signed-off-by: David Black <[email protected]>
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5894/reactions" }
https://api.github.com/repos/psf/requests/issues/5894/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5894.diff", "html_url": "https://github.com/psf/requests/pull/5894", "merged_at": "2021-12-29T17:06:05Z", "patch_url": "https://github.com/psf/requests/pull/5894.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5894" }
true
[ "I noticed https://github.com/psf/requests/pull/5893 prior to pushing the exact same fix for the performance regression noticed that I had made locally. This PR extracts the re-building proxies performance regression fix from https://github.com/psf/requests/pull/5893 to have it be in its own pr/change . cc \r\n@omermizr ", "@dbaxa The only thing that looks kinda wonky here to me is that `rebuild_proxies` has a side effect of removing the `Proxy-Authorization` header (see https://github.com/psf/requests/issues/5888). It's probably not the intended behavior (as stated in the issue), but I'm not familiar with the considerations.\r\nAnyway, if it shouldn't do that - then it shouldn't do that even when `proxies` is not set, and if it should do that - after this PR we no longer do. So this introduces inconsistent behavior...", "@omermizr I am not sure I entirely follow what you have said. \r\n\r\nI'll re-phase what I think you are suggesting here & add some of my own understanding - which might help -\r\n\r\n1. If proxies have been set we don't need to call `rebuild_proxies`\r\n2. If proxies have been set we do call `rebuild_proxies`\r\n3. Calling `rebuild_proxies` removes the `Proxy-Authorization` header\r\n4. So if we explicitly set `proxy` information and `Proxy-Authorization` has been explicitly set - we won't remove the `Proxy-Authorization` header <- this sounds like it would work as expected to me, unless the header should be removed if we are to bypass proxying later. \r\n5. `rebuild_auth` Does not interact with the `Proxy-Authorization` header but it does interact with a `Authorization` header\r\n6. `rebuild_proxies` does remove any explicitly set `Proxy-Authorization` header - as it will try to fill it in from/via `get_auth_from_url` (if a defined proxy has username & password information as part of the url - it will attempted to be used). \r\n7. `should_bypass_proxies` seems to be the main `slow path` that we should be avoiding if proxies have explicitly been set.\r\n\r\nTherefore imho the better fix is to do one of the following:\r\n* Provide a fast(er) path inside of `rebuild_proxies` such that we do not call `should_bypass_proxies` - at least not when `proxies` have been explicitly provided and/or possibly not when `trust_env` is set to false (as we don't trust the env and so there is no need to examine the environment) \r\n* cache and or make obtaining proxies from `env` faster (the maintainers seem not to want to do this)\r\n* Do as you did for https://github.com/psf/requests/pull/5893/files and have `rebuild_auth` interact with proxy auth header - but this modifies public api code \r\n\r\n\r\nNot removing `Proxy-Authorization` when proxy information has been explicitly set is an issue as we might not end up selecting the proxy for the given scheme iirc.", "Before the revised changed ->\r\n``` 20382240 function calls (20362186 primitive calls) in 10.494 seconds\r\n\r\n Ordered by: internal time\r\n List reduced from 543 to 30 due to restriction <30>\r\n\r\n ncalls tottime percall cumtime percall filename:lineno(function)\r\n 950001 0.583 0.000 1.435 0.000 /usr/lib/python3.9/os.py:674(__getitem__)\r\n 1050005 0.519 0.000 2.563 0.000 /usr/lib/python3.9/_collections_abc.py:848(__iter__)\r\n 1840000 0.372 0.000 0.632 0.000 /usr/lib/python3.9/os.py:758(decode)\r\n 10000 0.341 0.000 2.815 0.000 /usr/lib/python3.9/urllib/request.py:2486(getproxies_environment)\r\n 950001 0.330 0.000 0.525 0.000 /usr/lib/python3.9/os.py:754(encode)\r\n 1 0.310 0.310 0.310 0.310 {method 'do_handshake' of '_ssl._SSLSocket' objects}\r\n 2090069 0.289 0.000 0.289 0.000 {method 'decode' of 'bytes' objects}\r\n 1900120 0.269 0.000 0.424 0.000 {built-in method builtins.isinstance}\r\n 940000 0.264 0.000 0.569 0.000 /usr/lib/python3.9/os.py:697(__iter__)\r\n 70004 0.210 0.000 0.634 0.000 /usr/lib/python3.9/_collections_abc.py:932(update)\r\n 1 0.178 0.178 0.178 0.178 {method 'read' of '_ssl._SSLSocket' objects}\r\n 1530141 0.175 0.000 0.175 0.000 {method 'lower' of 'str' objects}\r\n ...\r\n```\r\n\r\nAfter the revised change ->\r\n```\r\n 10082240 function calls (10062186 primitive calls) in 6.860 seconds\r\n\r\n Ordered by: internal time\r\n List reduced from 536 to 30 due to restriction <30>\r\n\r\n ncalls tottime percall cumtime percall filename:lineno(function)\r\n 1 0.294 0.294 0.294 0.294 {method 'do_handshake' of '_ssl._SSLSocket' objects}\r\n 70004 0.201 0.000 0.606 0.000 /usr/lib/python3.9/_collections_abc.py:932(update)\r\n 910120 0.192 0.000 0.336 0.000 {built-in method builtins.isinstance}\r\n 1 0.189 0.189 0.189 0.189 {method 'read' of '_ssl._SSLSocket' objects}\r\n 1 0.145 0.145 0.145 0.145 {method 'connect' of '_socket.socket' objects}\r\n ...\r\n```", "*bump* cc @sigmavirus24 / @nateprewitt", "@nateprewitt can we merge this ?", "I think this is alright as a minor optimization, but doesn't address either of the original issues. I'd like to get those refactored and resolved before we merge anymore changes into the method.", "@nateprewitt imho it is slightly more than a minor optimisation (for certain use cases) & I have a concern that fixing/re-factoring the related code is likely to be complex and take a fairly long time. I am not sure how much https://github.com/psf/requests/pull/5894#issuecomment-889508604 applies to what you feel we should have as the result though. Mainly this part ->\r\n> have rebuild_auth interact with proxy auth header - but this modifies public api code\r\n", "> @nateprewitt imho it is slightly more than a minor optimisation (for certain use cases) \r\n\r\nSure, I was conveying it doesn't affect the hot path for the average user. There may be larger improvements for more niche uses.\r\n\r\n> I have a concern that fixing/re-factoring the related code is likely to be complex and take a fairly long time. I am not sure how much #5894 (comment) applies to what you feel we should have as the result though.\r\n\r\nThat may be true, I've left [my thoughts](https://github.com/psf/requests/pull/5893#discussion_r692463139) on moving forward in the issue, but I don't know if we've arrived at a consensus. Either way, #5893 is a blocker for the next release of Requests, so merging this now or later has no effect on when it's available publicly.", "Hey @dbaxa, now that #5924 is merged would you mind rebasing this change onto the new `resolve_proxies` function in `utils.py`?" ]
https://api.github.com/repos/psf/requests/issues/5893
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5893/labels{/name}
https://api.github.com/repos/psf/requests/issues/5893/comments
https://api.github.com/repos/psf/requests/issues/5893/events
https://github.com/psf/requests/pull/5893
955,334,463
MDExOlB1bGxSZXF1ZXN0Njk5MDk5NTc2
5,893
fix: improve proxy handling
{ "avatar_url": "https://avatars.githubusercontent.com/u/36623475?v=4", "events_url": "https://api.github.com/users/omermizr/events{/privacy}", "followers_url": "https://api.github.com/users/omermizr/followers", "following_url": "https://api.github.com/users/omermizr/following{/other_user}", "gists_url": "https://api.github.com/users/omermizr/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/omermizr", "id": 36623475, "login": "omermizr", "node_id": "MDQ6VXNlcjM2NjIzNDc1", "organizations_url": "https://api.github.com/users/omermizr/orgs", "received_events_url": "https://api.github.com/users/omermizr/received_events", "repos_url": "https://api.github.com/users/omermizr/repos", "site_admin": false, "starred_url": "https://api.github.com/users/omermizr/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/omermizr/subscriptions", "type": "User", "url": "https://api.github.com/users/omermizr", "user_view_type": "public" }
[]
closed
true
null
[]
null
7
2021-07-29T00:36:58Z
2022-02-26T21:00:46Z
2021-11-24T20:57:08Z
NONE
resolved
* do not rebuild proxies if they are configured * do not remove Proxy-Authorization on initial request * internal refactoring This is my attempt to resolve https://github.com/psf/requests/issues/5891 as well as https://github.com/psf/requests/issues/5888.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5893/reactions" }
https://api.github.com/repos/psf/requests/issues/5893/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5893.diff", "html_url": "https://github.com/psf/requests/pull/5893", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5893.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5893" }
true
[ "Note: there is even more worthwhile performance tuning to be done here, most notably - `getproxies_environment` is called multiple times in this flow. Caching it might also be a good idea, but I don't know this repo too well, so please let me know if that's something we want or not.\r\nIn any case, I didn't want to expand the scope of this PR too much so I did minimal changes :)", "I don't believe this refactoring is what nate or I had in mind and it breaks a public API without adding additional testing", "> Note: there is even more worthwhile performance tuning to be done here, most notably - `getproxies_environment` is called multiple times in this flow. Caching it might also be a good idea, but I don't know this repo too well, so please let me know if that's something we want or not.\r\n> In any case, I didn't want to expand the scope of this PR too much so I did minimal changes :)\r\n\r\nAs a user of the library, I found similar & also noticed that setting `trust_env` to false can also help improve the situation (caching other `trust_env` related things would also likely be of use). (https://github.com/psf/requests/pull/5496)", "> I don't believe this refactoring is what nate or I had in mind and it breaks a public API without adding additional testing\r\n\r\nLike I said, I'll try to avoid breaking the public API (I obviously don't want to introduce breaking changes). \r\nIf we decide to proceed with this, I'll add tests (although I didn't add any functionality, so tests not breaking is the best indication that it's working as intended). \r\nIs there any other approach you'd recommend before I start changing the PR? Or do you want me to abandon it so you guys can take it up internally?\r\nI thought this could be released quickly because it's a major regression for a lot of use-cases, but I completely understand if you think otherwise.", "I would like to point out a solution for the proxy problem. I have been applying this solution every time I need to build an venv behind proxy.\r\n\r\nI propose the following change at line:\r\nhttps://github.com/psf/requests/blob/913880c45a3a8c3bf6b298e9c38709cd95a9c97c/requests/sessions.py#L530\r\n\r\nReplace it by:\r\n\r\n```python\r\nproxies = proxies or self.proxies\r\n```\r\n\r\nThis change will make this hierarchy `kwargs` -> `Session args` -> `environment` to be respected with no need to change anywhere else. Solving problems also with pip as discussed [here](https://github.com/pypa/pip/issues/9691#issuecomment-791608247) \r\n\r\nAlso discussed here: https://github.com/psf/requests/pull/5735#issuecomment-792559731", "Resolving this in favor of the merged #5924. Thanks again for working through this with us @omermizr!", "@nateprewitt Sure thing! Thanks for addressing this 😃 " ]
https://api.github.com/repos/psf/requests/issues/5892
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5892/labels{/name}
https://api.github.com/repos/psf/requests/issues/5892/comments
https://api.github.com/repos/psf/requests/issues/5892/events
https://github.com/psf/requests/issues/5892
955,205,801
MDU6SXNzdWU5NTUyMDU4MDE=
5,892
Non-standard HTTP status codes?
{ "avatar_url": "https://avatars.githubusercontent.com/u/12053937?v=4", "events_url": "https://api.github.com/users/jenstroeger/events{/privacy}", "followers_url": "https://api.github.com/users/jenstroeger/followers", "following_url": "https://api.github.com/users/jenstroeger/following{/other_user}", "gists_url": "https://api.github.com/users/jenstroeger/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jenstroeger", "id": 12053937, "login": "jenstroeger", "node_id": "MDQ6VXNlcjEyMDUzOTM3", "organizations_url": "https://api.github.com/users/jenstroeger/orgs", "received_events_url": "https://api.github.com/users/jenstroeger/received_events", "repos_url": "https://api.github.com/users/jenstroeger/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jenstroeger/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jenstroeger/subscriptions", "type": "User", "url": "https://api.github.com/users/jenstroeger", "user_view_type": "public" }
[]
closed
true
null
[]
null
10
2021-07-28T20:22:33Z
2021-11-26T05:00:31Z
2021-08-28T04:40:08Z
NONE
resolved
According to [Wikipedia](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) and [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status), the following status codes are not defined yet available through `requests` https://github.com/psf/requests/blob/b227e3cb82c8d42ea27790d615ecafe12528d3bc/requests/status_codes.py#L32 https://github.com/psf/requests/blob/b227e3cb82c8d42ea27790d615ecafe12528d3bc/requests/status_codes.py#L84-L87 https://github.com/psf/requests/blob/b227e3cb82c8d42ea27790d615ecafe12528d3bc/requests/status_codes.py#L89 https://github.com/psf/requests/blob/b227e3cb82c8d42ea27790d615ecafe12528d3bc/requests/status_codes.py#L100 The above `444` and `499` seem to be from the [unofficial nginx errors](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#nginx)? In addition, [`508` Loop Detected](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/508) is missing from that list. I think it would help to document this in some more detail.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5892/reactions" }
https://api.github.com/repos/psf/requests/issues/5892/timeline
null
completed
null
null
false
[ "> I think it would help to document this in some more detail.\r\n\r\nWhat detail do you feel is required? Would it be simpler to ignore non-official but fairly widely used status codes here and remove them if this is so confusing?", "In addition to some documentation explaining the source of the extra codes, perhaps we can have other dictionaries of codes, such as an `_nginx_codes` dictionary that can be, by default, added to the `_codes` dictionary at [init](https://github.com/psf/requests/blob/b227e3cb82c8d42ea27790d615ecafe12528d3bc/requests/status_codes.py#L107). If users don't want nginx codes, they can set an environment variable or use some method to set a preference at runtime.\r\nWould this make sense?\r\nIt would make the error codes available more modular, and wouldn't break backwards compatibility, as the full list of codes will be used by default.", "Makes a lot of sense 👍🏼 \r\n\r\nWant a PR for that?", "I think we're probably moving in the wrong direction. These definitions have been around for a decade and remained relatively untouched. Many of them were added for fun long before Requests had its current adoption level. You'll find common codes have non-standard values added as well. e.g. `'okay', 'all_ok', 'all_okay', 'all_good', '\\\\o/', '✓'` will never be emitted from a common server for HTTP 200. We already have some of these marked for removal/updates with a new major version.\r\n\r\nFor the time being, these are here primarily for reference and have minimal impact on usage of the library. Adding more documentation/code will likely be noise that isn't be helpful for the average user. I'd be more inclined to leave things alone unless there's a concrete proposal on why they're inhibiting use of Requests.", "@nateprewitt actually I found them very helpful for testing, so having an accurate list of HTTP codes and a few uncommon, sorted lists too, would help to write better tests — and use the `requests` package to provide tests.\r\n\r\nBringing this particular module forward would be a useful value-add, methinks.\r\n\r\nMaybe adding a PR to see proposed changes helps the conversation? Shall I just go ahead with at and we can take it from there?", "> and use the `requests` package to provide tests.\r\n\r\nI don't understand this. This package doesn't provide a testing framework and isn't intended as that purpose. Why would we accept a PR that is aimed towards that goal?\r\n", "> This package doesn't provide a testing framework and isn't intended as that purpose.\r\n\r\nIt doesn’t, but it provides useful — somewhat incomplete, muddled up — information we use for testing: a collection of HTTP status codes. Hence the initial question…", "Earlier, I was trying to make sense of you request by clarifying and adding on to it. Right now, it wouldn't make sense to edit code because there are some non-standard HTTP status codes. The most that may be reasonable to do is to add a line [here](https://github.com/psf/requests/blob/master/requests/status_codes.py#L20) stating that some status codes are non-standard and may be Nginx specific, and including a reference to MDN for status code information. However, that wouldn't really be necessary, since Requests is used as an HTTP utility, not a platform to teach users about HTTP. Does that help any?\r\nAlso, as a side-note, I believe adding features is [not allowed](https://github.com/psf/requests/issues/5814#issuecomment-838288432), so adding code for a completely new feature would likely not be accepted.", "For the sake of illustration and to have something more concrete to discuss, I opened draft PR https://github.com/psf/requests/pull/5895.", "I left feedback in #5895. I would encourage anyone interested in establishing a separate package to manage these status code lists which may prove to be useful in other testing tools. The `codes` module in Requests is ultimately a fun after thought and not intended to be a core part of the library. If we make any future changes to it, they should be to correct inaccurate information, and remove non-standard content. Those would need to wait until a major release though as stated above." ]
https://api.github.com/repos/psf/requests/issues/5891
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5891/labels{/name}
https://api.github.com/repos/psf/requests/issues/5891/comments
https://api.github.com/repos/psf/requests/issues/5891/events
https://github.com/psf/requests/issues/5891
955,043,574
MDU6SXNzdWU5NTUwNDM1NzQ=
5,891
Session requests are ~70% slower in version 2.26.0
{ "avatar_url": "https://avatars.githubusercontent.com/u/36623475?v=4", "events_url": "https://api.github.com/users/omermizr/events{/privacy}", "followers_url": "https://api.github.com/users/omermizr/followers", "following_url": "https://api.github.com/users/omermizr/following{/other_user}", "gists_url": "https://api.github.com/users/omermizr/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/omermizr", "id": 36623475, "login": "omermizr", "node_id": "MDQ6VXNlcjM2NjIzNDc1", "organizations_url": "https://api.github.com/users/omermizr/orgs", "received_events_url": "https://api.github.com/users/omermizr/received_events", "repos_url": "https://api.github.com/users/omermizr/repos", "site_admin": false, "starred_url": "https://api.github.com/users/omermizr/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/omermizr/subscriptions", "type": "User", "url": "https://api.github.com/users/omermizr", "user_view_type": "public" }
[ { "color": "e10c02", "default": false, "description": null, "id": 117744, "name": "Bug", "node_id": "MDU6TGFiZWwxMTc3NDQ=", "url": "https://api.github.com/repos/psf/requests/labels/Bug" } ]
closed
true
null
[]
null
5
2021-07-28T16:43:39Z
2022-03-30T22:00:46Z
2021-12-30T21:40:46Z
NONE
resolved
When using a session, requests are slower than in previous versions. My metrics indicate a performance degradation, and after some testing I suspect this is the root cause. ## Expected Result Same performance as in version 2.25 ## Actual Result When I use a session, requests are about 70% slower than in previous versions. This seems to be the PR that caused the regression: https://github.com/psf/requests/pull/5681 I removed the `rebuild_proxies` call locally and performance shot back up. I ran a benchmark on 1000 requests making a real-world request with the same session. In version 2.25.1 it took ~13s, in version 2.26.0 it takes ~23s. ## System Information $ python -m requests.help ``` { "chardet": { "version": "3.0.4" }, "charset_normalizer": { "version": "2.0.3" }, "cryptography": { "version": "3.4.7" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.7.10" }, "platform": { "release": "5.4.0-1055-azure", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "101010bf", "version": "19.1.0" }, "requests": { "version": "2.26.0" }, "system_ssl": { "version": "101000cf" }, "urllib3": { "version": "1.26.6" }, "using_charset_normalizer": false, "using_pyopenssl": true } ``` This command is only available on Requests v2.16.4 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, &c).
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 6, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 6, "url": "https://api.github.com/repos/psf/requests/issues/5891/reactions" }
https://api.github.com/repos/psf/requests/issues/5891/timeline
null
completed
null
null
false
[ "I dug a little deeper and it looks like **all the time is spent inside `getproxies_environment`**, here: `requests.utils.proxy_bypass:781`.\r\nWe are deployed in a k8s cluster and have a lot of environment variables (around ~530 ATM), so it makes sense that iterating these would take time.\r\nI cached `getproxies_environment`'s result and performance is back up.\r\n\r\nNote: My OS is Ubuntu 18.04.", "Thanks @omermizr for finding this issue.\r\n\r\nIn this [gist](https://gist.github.com/bityob/02b1a823b478ad74a8440b86f95e13a6/) I have a full repro for this latency issue, comparing requests 2.26 vs 2.25.1 packages.\r\n\r\nWe can see that when we have 500 environment variables, there is a **huge** difference between the versions.\r\n\r\n![requests-2.26-env-count-500-result.png](https://gist.github.com/bityob/02b1a823b478ad74a8440b86f95e13a6/raw/requests-2.26-env-count-500-result.png)\r\n\r\n![requests-2.25.1-env-count-500-result.png](https://gist.github.com/bityob/02b1a823b478ad74a8440b86f95e13a6/raw/requests-2.25.1-env-count-500-result.png)\r\n\r\nBut without any variables, there is no difference at all.\r\n\r\n![requests-2.26-env-count-0-result.png](https://gist.github.com/bityob/02b1a823b478ad74a8440b86f95e13a6/raw/requests-2.26-env-count-0-result.png)\r\n\r\n![requests-2.25.1-env-count-0-result.png](https://gist.github.com/bityob/02b1a823b478ad74a8440b86f95e13a6/raw/requests-2.25.1-env-count-0-result.png)\r\n\r\nSee here the full details and how to run it by yourself - \r\nhttps://gist.github.com/bityob/02b1a823b478ad74a8440b86f95e13a6/", "Any updates on this one? \r\nSome hints how to workaround it?\r\nOur application spends 80% of time in decoding huge JSON payloads and rebuilding list of proxies 😅\r\n<img width=\"348\" alt=\"Screenshot 2021-10-31 at 1 22 35\" src=\"https://user-images.githubusercontent.com/722112/139560006-57da0660-c91c-4407-a174-819f369c1c0f.png\">\r\n\r\n", "Hi guys. Do you know when in theory this issues might be solved and when new version of the library might be released?\r\nDo you have any plans for that or smth like that?", "We expect the current fix to go out with the 2.27.0 release which is currently scheduled for this coming Monday. There is still an edge case where we may see a slow down in environments with a large number of proxies available. The long term recommendation for this is passing the `proxies` parameter directly with the call to circumvent this look up. We unfortunately don't have a better way to handle this since it's a fundamental problem of the search functionality in the standard library.\r\n\r\nResolving now that the fixes have been merged for release." ]
https://api.github.com/repos/psf/requests/issues/5890
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5890/labels{/name}
https://api.github.com/repos/psf/requests/issues/5890/comments
https://api.github.com/repos/psf/requests/issues/5890/events
https://github.com/psf/requests/pull/5890
954,626,136
MDExOlB1bGxSZXF1ZXN0Njk4NDkwNTk0
5,890
Fix creating non-listening sockets in tests on some platforms
{ "avatar_url": "https://avatars.githubusercontent.com/u/110765?v=4", "events_url": "https://api.github.com/users/mgorny/events{/privacy}", "followers_url": "https://api.github.com/users/mgorny/followers", "following_url": "https://api.github.com/users/mgorny/following{/other_user}", "gists_url": "https://api.github.com/users/mgorny/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/mgorny", "id": 110765, "login": "mgorny", "node_id": "MDQ6VXNlcjExMDc2NQ==", "organizations_url": "https://api.github.com/users/mgorny/orgs", "received_events_url": "https://api.github.com/users/mgorny/received_events", "repos_url": "https://api.github.com/users/mgorny/repos", "site_admin": false, "starred_url": "https://api.github.com/users/mgorny/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mgorny/subscriptions", "type": "User", "url": "https://api.github.com/users/mgorny", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-28T08:48:27Z
2021-10-26T17:04:33Z
2021-07-28T16:23:08Z
CONTRIBUTOR
resolved
Fix the listen() invocation for the test server not to pass a backlog value of zero. The value of zero means no backlog which effectively means that the socket can not accept any connections. This does not matter for the majority of platforms since the value is only advisory and the platform tends to go with a bigger backlog anyway. However, a few platforms (e.g. alpha or riscv Linux) do take the value literally, and therefore the tests fail since they are unable to connect to the server. Let Python use a 'default reasonable value' instead.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5890/reactions" }
https://api.github.com/repos/psf/requests/issues/5890/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5890.diff", "html_url": "https://github.com/psf/requests/pull/5890", "merged_at": "2021-07-28T16:23:08Z", "patch_url": "https://github.com/psf/requests/pull/5890.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5890" }
true
[ "I'm sorry about the failure, it didn't occur to me to test on Python 2." ]
https://api.github.com/repos/psf/requests/issues/5889
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5889/labels{/name}
https://api.github.com/repos/psf/requests/issues/5889/comments
https://api.github.com/repos/psf/requests/issues/5889/events
https://github.com/psf/requests/issues/5889
954,449,932
MDU6SXNzdWU5NTQ0NDk5MzI=
5,889
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
{ "avatar_url": "https://avatars.githubusercontent.com/u/34674841?v=4", "events_url": "https://api.github.com/users/Pacychen/events{/privacy}", "followers_url": "https://api.github.com/users/Pacychen/followers", "following_url": "https://api.github.com/users/Pacychen/following{/other_user}", "gists_url": "https://api.github.com/users/Pacychen/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Pacychen", "id": 34674841, "login": "Pacychen", "node_id": "MDQ6VXNlcjM0Njc0ODQx", "organizations_url": "https://api.github.com/users/Pacychen/orgs", "received_events_url": "https://api.github.com/users/Pacychen/received_events", "repos_url": "https://api.github.com/users/Pacychen/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Pacychen/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Pacychen/subscriptions", "type": "User", "url": "https://api.github.com/users/Pacychen", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-07-28T04:02:00Z
2021-10-26T05:00:21Z
2021-07-28T04:49:25Z
NONE
resolved
Please refer to our [Stack Overflow tag](https://stackoverflow.com/questions/tagged/python-requests) for guidance.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5889/reactions" }
https://api.github.com/repos/psf/requests/issues/5889/timeline
null
completed
null
null
false
[]
https://api.github.com/repos/psf/requests/issues/5888
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5888/labels{/name}
https://api.github.com/repos/psf/requests/issues/5888/comments
https://api.github.com/repos/psf/requests/issues/5888/events
https://github.com/psf/requests/issues/5888
953,939,981
MDU6SXNzdWU5NTM5Mzk5ODE=
5,888
Manually set Proxy-Authorization header is always removed in 2.26
{ "avatar_url": "https://avatars.githubusercontent.com/u/88030912?v=4", "events_url": "https://api.github.com/users/chris-sawarzynski/events{/privacy}", "followers_url": "https://api.github.com/users/chris-sawarzynski/followers", "following_url": "https://api.github.com/users/chris-sawarzynski/following{/other_user}", "gists_url": "https://api.github.com/users/chris-sawarzynski/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/chris-sawarzynski", "id": 88030912, "login": "chris-sawarzynski", "node_id": "MDQ6VXNlcjg4MDMwOTEy", "organizations_url": "https://api.github.com/users/chris-sawarzynski/orgs", "received_events_url": "https://api.github.com/users/chris-sawarzynski/received_events", "repos_url": "https://api.github.com/users/chris-sawarzynski/repos", "site_admin": false, "starred_url": "https://api.github.com/users/chris-sawarzynski/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/chris-sawarzynski/subscriptions", "type": "User", "url": "https://api.github.com/users/chris-sawarzynski", "user_view_type": "public" }
[ { "color": "e10c02", "default": false, "description": null, "id": 117744, "name": "Bug", "node_id": "MDU6TGFiZWwxMTc3NDQ=", "url": "https://api.github.com/repos/psf/requests/labels/Bug" } ]
closed
true
null
[]
{ "closed_at": "2021-12-30T21:48:07Z", "closed_issues": 11, "created_at": "2021-09-02T07:23:33Z", "creator": { "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }, "description": "", "due_on": null, "html_url": "https://github.com/psf/requests/milestone/29", "id": 7115399, "labels_url": "https://api.github.com/repos/psf/requests/milestones/29/labels", "node_id": "MI_kwDOABTKOs4AbJKH", "number": 29, "open_issues": 0, "state": "closed", "title": "2.27.0", "updated_at": "2021-12-30T21:48:07Z", "url": "https://api.github.com/repos/psf/requests/milestones/29" }
5
2021-07-27T14:24:46Z
2022-02-22T20:00:23Z
2021-11-24T19:28:59Z
NONE
resolved
In versions 2.25 it was possible to add Proxy-Authorization header manually. Starting from requests 2.26 this header is removed from request if set manually. When this could be a problem (real life example): If you use requests library to programatically access service hidden behind Google Identity Aware Proxy that is protected with Basic Auth you have to provide token in Proxy-Authorization header: https://cloud.google.com/iap/docs/authentication-howto#authenticating_from_proxy-authorization_header ## Expected Result Manually provided Proxy-Authorization header should be kept intact, or there should be an obvious way to make this work without hackng library internals ## Actual Result Proxy-Authorization header is removed from request ## Reproduction Steps ```python import requests s = requests.Session() s.headers.update({"Accept": "application/json", "Proxy-Authorization":"Bearer XXX"}) s.auth = ("login", "password") resp = s.get('http://localhost:3000/answer') print(resp.request.headers) ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": null }, "charset_normalizer": { "version": "2.0.3" }, "cryptography": { "version": "" }, "idna": { "version": "3.2" }, "implementation": { "name": "CPython", "version": "3.6.8" }, "platform": { "release": "3.10.0-957.1.3.el7.x86_64", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.26.0" }, "system_ssl": { "version": "100020bf" }, "urllib3": { "version": "1.26.6" }, "using_charset_normalizer": true, "using_pyopenssl": false } ``` This command is only available on Requests v2.16.4 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, &c).
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 3, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 3, "url": "https://api.github.com/repos/psf/requests/issues/5888/reactions" }
https://api.github.com/repos/psf/requests/issues/5888/timeline
null
completed
null
null
false
[ "Hey @chris-sawarzynski, thanks for the report. I believe this is a byproduct of #5681. This change is now forcing a rebuild on the proxies to resolve parameters from both the Session and Request. Part of the rebuild involves [stripping existing Proxy-Authorization headers](https://github.com/psf/requests/blob/master/requests/sessions.py#L301-L302) and attempting to [rebuild them from the url](https://github.com/psf/requests/blob/master/requests/sessions.py#L304-L310).\r\n\r\nI think this was potentially an oversight in the recent change. ~I'm still trying to work out why we're stripping this off in the first place instead of only updating it pending contradictory information in the URL. I couldn't find an answer in the original PR (#1951) but we're going pretty far back in time.~ We've co-opted what was originally a method intended for redirects into the default flow. We're stripping general auth info to avoid potentially leaking sensitive information to a new domain, but that's not relevant in the first call. We may need to break up `rebuild_proxies` into some smaller components to allow us this to work correctly, or consider a different approach for merging.\r\n\r\n@sigmavirus24 I don't know if you have any thoughts about this. I'm thinking we consider this a regression, though, and it may need some follow up work to untangle the auth sanitizing from the configuration resolution.", "Yeah this part of the code is a bit of a mess frankly. We'll definitely need some careful refactoring here", "When will it be settled?", "The self-test of `mod_auth_gssapi` is also affected by this issue:\r\nhttps://github.com/gssapi/mod_auth_gssapi/blob/master/tests/t_spnego_proxy.py", "We've merged #5924 which should address this in the next minor release of Requests. I'm currently tracking for a date before EoY for the 2.27.x milestone. Resolving this for now, thanks everyone." ]
https://api.github.com/repos/psf/requests/issues/5887
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5887/labels{/name}
https://api.github.com/repos/psf/requests/issues/5887/comments
https://api.github.com/repos/psf/requests/issues/5887/events
https://github.com/psf/requests/issues/5887
953,607,000
MDU6SXNzdWU5NTM2MDcwMDA=
5,887
Truncated http request
{ "avatar_url": "https://avatars.githubusercontent.com/u/57199?v=4", "events_url": "https://api.github.com/users/dwt/events{/privacy}", "followers_url": "https://api.github.com/users/dwt/followers", "following_url": "https://api.github.com/users/dwt/following{/other_user}", "gists_url": "https://api.github.com/users/dwt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dwt", "id": 57199, "login": "dwt", "node_id": "MDQ6VXNlcjU3MTk5", "organizations_url": "https://api.github.com/users/dwt/orgs", "received_events_url": "https://api.github.com/users/dwt/received_events", "repos_url": "https://api.github.com/users/dwt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dwt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dwt/subscriptions", "type": "User", "url": "https://api.github.com/users/dwt", "user_view_type": "public" }
[]
closed
true
null
[]
null
7
2021-07-27T07:53:14Z
2021-11-17T01:21:19Z
2021-08-19T01:01:33Z
NONE
resolved
When requesting a development website locally, I get different results when using cURL vs httpie/requests. Namely requests gives me a shorter result. Further debugging seems to indicate that the gzip encoded response may be to blame. ## Expected Result I'd like the full server response - just as with curl ## Actual Result The output is shortened. ## Reproduction Steps ```python import requests r = requests.get('http://localhost:8000/Forschung/Forschungsprofil.html?c=14') >>> pprint(dict(r.headers)) {'Cache-Control': 'public', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Content-Generator': 'EGOTEC ECM', 'Content-Security-Policy': "default-src 'self' " 'https://www.uniklinikum-jena.de ' 'https://www.youtube.com https://dr-flex.de ' 'https://www.yumpu.com https://www.google.com ' 'https://vimeo.com https://player.vimeo.com; ' "img-src 'self' https://www.uniklinikum-jena.de " "www.krz.uni-jena.de; script-src 'self' " "'unsafe-inline' 'unsafe-eval' " 'https://www.uniklinikum-jena.de ' "www.krz.uni-jena.de; style-src 'self' " "'unsafe-inline'; font-src 'self'; object-src " "'none'", 'Content-Type': 'text/html; charset=utf-8', 'Date': 'Tue, 27 Jul 2021 07:35:23 GMT', 'ETag': 'W/"medweb2016/de/folder.c1e7bb70509f15aa29d5402206a12138.0e9304b1aef96489c56d827c1451d3db.9bb97a957c625ae7dabe79aa95c06302.1627369626"', 'Expect-CT': 'enforce, max-age=36000', 'Expires': 'Tue, 27 Jul 2021 08:35:23 GMT', 'Last-Modified': 'Mon, 18 May 2020 08:44:34 GMT', 'Pragma': 'no-cache', 'Server': 'nginx/1.19.7', 'Set-Cookie': 'EGOTEC=be0s8uitorpvhgvcchidiosp62; path=/; ' 'domain=uniklinikum-jena.de; HttpOnly', 'Transfer-Encoding': 'chunked', 'X-Cache-Status': 'MISS', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'sameorigin', 'X-XSS-Protection': '1; mode=block'} >>> r.text[-200:] "449');\r\n\r\n\t}\r\n\t, mouseleave : function() {\r\n\t\tanode.css('background', initcolor);\r\n\t\tinode.css('background', initarrowcolor);\r\n\t}\r\n\t}\r\n\t, '.subnavigation a, .subnavigation i');\r\n\r\n</script>\n\t\n</html>\n" ``` It seems to work correctly, when I give an empty / remove the 'Accept-Encoding' header from the request. ```python >>> r = requests.get('http://localhost:8000/Forschung/Forschungsprofil.html?c=14', headers={'Accept-Encoding':''}) >>> pprint(dict(r.headers)) {'Cache-Control': 'public', 'Connection': 'keep-alive', 'Content-Generator': 'EGOTEC ECM', 'Content-Security-Policy': "default-src 'self' " 'https://www.uniklinikum-jena.de ' 'https://www.youtube.com https://dr-flex.de ' 'https://www.yumpu.com https://www.google.com ' 'https://vimeo.com https://player.vimeo.com; ' "img-src 'self' https://www.uniklinikum-jena.de " "www.krz.uni-jena.de; script-src 'self' " "'unsafe-inline' 'unsafe-eval' " 'https://www.uniklinikum-jena.de ' "www.krz.uni-jena.de; style-src 'self' " "'unsafe-inline'; font-src 'self'; object-src " "'none'", 'Content-Type': 'text/html; charset=utf-8', 'Date': 'Tue, 27 Jul 2021 07:47:15 GMT', 'ETag': 'W/"medweb2016/de/folder.c1e7bb70509f15aa29d5402206a12138.0e9304b1aef96489c56d827c1451d3db.9bb97a957c625ae7dabe79aa95c06302.1627369626"', 'Expect-CT': 'enforce, max-age=36000', 'Expires': 'Tue, 27 Jul 2021 08:35:23 GMT', 'Last-Modified': 'Mon, 18 May 2020 08:44:34 GMT', 'Pragma': 'no-cache', 'Server': 'nginx/1.19.7', 'Set-Cookie': 'EGOTEC=pevpss1qf4de0uvd064gippn43; path=/; ' 'domain=uniklinikum-jena.de; HttpOnly', 'Transfer-Encoding': 'chunked', 'X-Cache-Status': 'MISS', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'sameorigin', 'X-XSS-Protection': '1; mode=block', 'X-cached': '1'} >>> r.text[-200:] 'or it\'s own uses in client pages.\n window._proxy_jquery = window.$.noConflict()\n</script>\n<script src="/proxy_static/added.js"></script>\n\n<style>\n @import url(/proxy_static/added.css);\n</style>\n' ``` What I'm doing server-side, is that I'm adding stuff to requests using Nginx's `add_after_body` directive. I'm not entirely sure what the problem is and how to further debug this, here's the Nginx config I've used to track this down so far: ```nginx # daemon off; include conf.d/error_logging.include; include conf.d/workers.include; http { include conf.d/access_logging.include; include conf.d/mime_types.include; upstream auth { server auth:8003; } upstream zms { server zms:8080; } server { listen 8000; server_name localhost; # include conf.d/proxy.include; # error_page 401 = @error401; location @error401 { # Let zms handle all authentication errors # TODO consider to redirect to a pre-determined url? proxy_pass http://zms; } # error_page 404 = @fallback; # location @fallback { # proxy_pass http://zms; # } # include conf.d/auth_locations.include; location /proxy_static { alias /srv/www/static; add_after_body ""; # disable add after body to these locations } add_after_body /proxy_static/custom_css_and_js.html; location / { # include conf.d/proxy.include; # include conf.d/auth_authenticate.include; proxy_pass http://zms; } # If needed additional namespaces can be be added here, that also get authenticated via auth_request # zms is special in that it handles authentication failures for all services, so no unauthenticated request # ever gets through to any third party service added here. resolver 8.8.8.8 ipv6=off; location /Forschung { # check with something like this # while true; do http http://localhost:8000/Forschung/Forschungsprofil.html\?cache_breaker=$(date +%s) | tail; sleep 1; done # while true; do http http://localhost:8000/Forschung/Forschungsprofil_missing.html\?cache_breaker=$(date +%s) | tail; sleep 1; done # Not sure why, but this doesn't seem to work with external proxy # add_after_body /proxy_static/custom_css_and_js.html; # serve static files to ease debugging # alias /srv/www/static/Forschung; # mitmproxy - to help debug what is happening in proxied requests # proxy_pass http://host.docker.internal:8001; # proxy_pass https://www.uniklinikum-jena.de; proxy_pass http://localhost:8010; # Fixes the problem that the upstream server doesn't resolve the url/host correctly # proxy_ssl_server_name on; # this also fixed the resolution issue - but I think proxy_ssl_server_name is the far better solution # proxy_set_header Host www.uniklinikum-jena.de; # proxy_redirect https://www.uniklinikum-jena.de/Forschung /Forschung/; add_after_body /debugging/custom_css_and_js2.html; } location /debugging/ { proxy_pass http://host.docker.internal:8100; } # sub_filter '</html>' 'fnord</html>'; # sub_filter_once off; } server { listen 8010; server_name localhost; # include conf.d/proxy.include; location / { proxy_pass https://www.uniklinikum-jena.de; proxy_ssl_server_name on; add_after_body /proxy_static/custom_css_and_js.html; } add_after_body /proxy_static/custom_css_and_js.html; } } ``` Sorry, not really minimised… ## System Information $ python -m requests.help ``` { "chardet": { "version": null }, "charset_normalizer": { "version": "2.0.3" }, "cryptography": { "version": "" }, "idna": { "version": "3.2" }, "implementation": { "name": "CPython", "version": "3.9.6" }, "platform": { "release": "20.6.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.26.0" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.6" }, "using_charset_normalizer": true, "using_pyopenssl": false } ``` MacOS 11.5 (20G71) Python 2.7 and 3.9 (same result) ``` % curl --version curl 7.64.1 (x86_64-apple-darwin20.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0 Release-Date: 2019-03-27 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets % nginx -v nginx version: nginx/1.19.7 ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5887/reactions" }
https://api.github.com/repos/psf/requests/issues/5887/timeline
null
completed
null
null
false
[ "Looking into this more it starts to make sense what is going on:\r\n\r\n```shell\r\n% curl -vH \"Accept-Encoding: gzip\" http://localhost:8000/Forschung/Forschungsprofil.html\\?cache_breaker=$(date +%s) --output /dev/stdout| tail\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying ::1...\r\n* TCP_NODELAY set\r\n* Connected to localhost (::1) port 8000 (#0)\r\n> GET /Forschung/Forschungsprofil.html?cache_breaker=1627372645 HTTP/1.1\r\n> Host: localhost:8000\r\n> User-Agent: curl/7.64.1\r\n> Accept: */*\r\n> Accept-Encoding: gzip\r\n> \r\n 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0< HTTP/1.1 200 OK\r\n< Server: nginx/1.19.7\r\n< Date: Tue, 27 Jul 2021 07:57:26 GMT\r\n< Content-Type: text/html; charset=utf-8\r\n< Transfer-Encoding: chunked\r\n< Connection: keep-alive\r\n< Set-Cookie: EGOTEC=7dpipsc9o7hfimool3friup4q1; path=/; domain=uniklinikum-jena.de; HttpOnly\r\n< Pragma: no-cache\r\n< Content-Generator: EGOTEC ECM\r\n< ETag: W/\"medweb2016/de/folder.c1e7bb70509f15aa29d5402206a12138.0e9304b1aef96489c56d827c1451d3db.693071056e9af8f2e740022f26561fb9.1627369626\"\r\n< Expires: Tue, 27 Jul 2021 08:57:27 GMT\r\n< Cache-Control: public\r\n< Last-Modified: Mon, 18 May 2020 08:44:34 GMT\r\n< Content-Encoding: gzip\r\n< X-Frame-Options: sameorigin\r\n< X-XSS-Protection: 1; mode=block\r\n< X-Content-Type-Options: nosniff\r\n< Expect-CT: enforce, max-age=36000\r\n< Content-Security-Policy: default-src 'self' https://www.uniklinikum-jena.de https://www.youtube.com https://dr-flex.de https://www.yumpu.com https://www.google.com https://vimeo.com https://player.vimeo.com; img-src 'self' https://www.uniklinikum-jena.de www.krz.uni-jena.de; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.uniklinikum-jena.de www.krz.uni-jena.de; style-src 'self' 'unsafe-inline'; font-src 'self'; object-src 'none'\r\n< X-Cache-Status: MISS\r\n< \r\n{ [7047 bytes data]\r\n100 18807 0 18807 0 0 4750 0 --:--:-- 0:00:03 --:--:-- 4749\r\n* Connection #0 to host localhost left intact\r\n* Closing connection 0\r\nM?`/i??5Vݓ\\???\t?U%sT;????%?????$+??x??????b6ZU?Z?h|??d',B??J?B?$9S?R$*22?ђ???5F?QI?r?FR??\"މ[?Gt??Pݥ??D AP?ˣ?#?HC[y?-''jx???\r\n $*\r\n ?I7'I???3B ???14$%?=9rA\"<ET?x?z1-?IFC9XR???A???E?S?%=v?????ewb$?˸??y Rpk6{?5?T??CAQ?f???.B??\\U)? ?—V??c?O?M??>\\??<Î??!?PL??\"?{?r?c????m?¢??9d?FO????IW?[??Gq??NmoL??X)5>???\t<?'??x?x%c\r\n 4(????\"?|?]x????:??<script src=\"/proxy_static/jquery-3.6.0.slim.min.js\"></script>\r\n<script>\r\n // this ensures there is no colision with anything that uses the $ variable for it's own uses in client pages.\r\n window._proxy_jquery = window.$.noConflict()\r\n</script>\r\n<script src=\"/proxy_static/added.js\"></script>\r\n\r\n<style>\r\n @import url(/proxy_static/added.css);\r\n</style>\r\n```\r\n\r\nAs far as I can tell, my nginx configuration is appending a decoded response verbatim to a gziped one - and when decoding requests discards the un-gzipped part.\r\n\r\nDoes that make sense? Is that what is expected of a request handler?", "Found a workaround for me, adding \r\n\r\n```nginx\r\nhttp {\r\n gzip off;\r\n gunzip on;\r\n …\r\n}\r\n```\r\n\r\nto my nginx config forced it to (correctly?) decompress upstream proxied content before concatenating it with uncompressed local content in `add_after_body`.\r\n\r\nThough I'm still not sure that there is some kind of bug in requests?\r\n\r\nAt least, I'd like to suggest that I would have been _really_ helpful to get some kind of warning that there was discarded content after the gziped response - that would have saved me (and I'm sure countless other persons) days of debugging.", "See also: https://trac.nginx.org/nginx/ticket/2222#ticket", "@dwt Great find! That looks like it was hard and frustrating to find.\r\n\r\nYes what you've discovered is exactly how we deal with junk. This is not a bug in requests. There's no way for us to know what to do with data that can not be decompressed. It could be absolute junk so what we do with it is fine. We could also throw an exception flat out but that wouldn't be as user-friendly as they now need to figure out how to extract potentially useful data from the response. \r\n\r\nWe already get harassed on social media when we add warnings that users ask for. Adding one here I think might be far noisier, and not remotely as useful to the user as you think. Most people aren't using requests against their own server but instead against someone else's over which they have no control or influence. Further, the raw bytes can be downloaded and this escape hatch is documented so if someone did see odd behaviour the docs call out being able to use \r\n\r\n```python\r\nr = requests.get(url, stream=True)\r\nraw_bytes = r.raw.read()\r\n```\r\n\r\n(Or something along those lines)\r\n\r\nTo be clear, I think the configuration options you have in Nginx are a footgun that Nginx needs to fix. It's too easy to send invalid response bodies that way. I've never seen anyone else encounter this on StackOverflow or our issue tracker in the 8? years I've worked on this project. If there are countless other persons that have had to debug this, they've been incredibly quiet.", "Regarding a warning: I was using requests through httpie, and of course tried the verbose switch to understand better what was a happening. What would have really helped me would have been a warning that was visible in the verbose mode.\r\n\r\nSame using requests directly. It would have been imensely helpful, if there was a way to get a warning / log event or just any indication that this has happened when asking for it.\r\n\r\nSome things I could imagine:\r\n- A `logging.debug()` or `loging.info()` level warning / log event so there is a chance to find this, but also nothing that a needs to show by default. Ideally, this was enabled by default when using `http -v` (httpie).\r\n- An attribute on the response that lists 'anomalies' (and is perhaps printed with `repr()` that allows to find out stuff like this - not essential in the usual use cases, but something that one has a chance to discover, especially interactively.\r\n\r\nI can understand that people don't like their apps to throw lots of warnings when trying to get junk from junk servers on the junk internet - but a way to look for problems and then find out what is happening is something I would think should be really usefull?\r\n\r\nWhat do you think?", "Just for reference, turns out that\r\n\r\n```\r\ngzip off;\r\ngunzip on;\r\n```\r\n\r\ndidn't actually work around the issue. I must've been star struck not to notice. :-(\r\n\r\nWhat actually did it was disabling requesting compressed pages from upstream with \r\n\r\n```\r\nproxy_set_header Accept-Encoding \"\";\r\n```", "> An attribute on the response that lists 'anomalies' (and is perhaps printed with `repr()` that allows to find out stuff like this - not essential in the usual use cases, but something that one has a chance to discover, especially interactively.\r\n\r\nWe don't actually control the decompression ourselves, so there's no way for us to present that to you.\r\n\r\n> * A `logging.debug()` or `loging.info()` level warning / log event\r\n\r\nSomeone tore out all of our logging when they released 2.0 and it hasn't been added back. Plus \"useful logging\" is hard for a library as widely used as ours to get right for everyone that uses it. When we had more log messages we got tonnes of issues that we were too noisy (and I think we had approximately 10 calls to a logger) because we end up in the critical, repeatedly called, path of a lot of things.\r\n\r\n> way to look for problems and then find out what is happening is something I would think should be really usefull?\r\n\r\nThat would be useful. Unfortunately we sit on a lot of other stacks (also known as the shoulders of giants): urllib3, which uses python's httplib (whose state machine just drops entire responses sometimes - see also 100 Continue), on top of python's socket libraries (which bind to the OS) which ignores all of the openssl layers when using HTTPs. We just don't have the access to the things that would be most useful in a situation like this one sadly. There are some ways to reconstruct some of this smartly - https://toolbelt.readthedocs.io/en/latest/dumputils.html but they're only so good and don't help in this case." ]
https://api.github.com/repos/psf/requests/issues/5886
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5886/labels{/name}
https://api.github.com/repos/psf/requests/issues/5886/comments
https://api.github.com/repos/psf/requests/issues/5886/events
https://github.com/psf/requests/issues/5886
952,072,810
MDU6SXNzdWU5NTIwNzI4MTA=
5,886
Prepare URL coerces to lower-case
{ "avatar_url": "https://avatars.githubusercontent.com/u/20093793?v=4", "events_url": "https://api.github.com/users/dmitrypolo/events{/privacy}", "followers_url": "https://api.github.com/users/dmitrypolo/followers", "following_url": "https://api.github.com/users/dmitrypolo/following{/other_user}", "gists_url": "https://api.github.com/users/dmitrypolo/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dmitrypolo", "id": 20093793, "login": "dmitrypolo", "node_id": "MDQ6VXNlcjIwMDkzNzkz", "organizations_url": "https://api.github.com/users/dmitrypolo/orgs", "received_events_url": "https://api.github.com/users/dmitrypolo/received_events", "repos_url": "https://api.github.com/users/dmitrypolo/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dmitrypolo/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dmitrypolo/subscriptions", "type": "User", "url": "https://api.github.com/users/dmitrypolo", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-07-24T13:09:43Z
2021-07-27T22:05:18Z
2021-07-24T13:26:23Z
NONE
resolved
https://github.com/psf/requests/blob/916d171f2bf01155f2c115159ec475e8d76a690b/requests/models.py#L369 When passing in a URL with an upper-case letter after a `-` character the host is coerced to lower case. Python Version: 3.9.1 Requests Version: 2.26.0 OS: MacOS Steps to reproduce -------------------- ``` from requests.models import PreparedRequest p = PreparedRequest() url = "http://service-A/abc" p.prepare_url(url, None) print(p.url) "http://service-a/abc" ``` Notice how the `A` has been changed to `a`. This behavior is not expected. I have also submitted [this bug report](https://github.com/urllib3/urllib3/issues/2337) as the behavior arises from the use of `urllib3`.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5886/reactions" }
https://api.github.com/repos/psf/requests/issues/5886/timeline
null
completed
null
null
false
[ "This is 100% correct. RFC 3986 describes the part of any URI as such:\r\n\r\n- scheme (part of the URL preceding the first `:`)\r\n- authority (part of the URL starting with `//` before the path; this includes username/password, hostname, and port)\r\n- path (part of the URL starting with `/`)\r\n- query (part of the URL starting with `?`)\r\n- fragment (part of the URL starting with `#`)\r\n\r\n`\"http://service-A/abc\"` thusly gets parsed as `scheme=http, authority=service-A, path=/abc`. The host portion of the authority is to be treated case-insensitively. In other words, `service-A` is actually functionally equivalent to `service-a`.\r\n\r\nFinally, spamming multiple projects is not appropriate, especially when you've done 0 research into how the standards define the behaviour here.", "Imagine not realizing that we're getting to a point with Web where there are vastly more companies handling stuff like authorizations, header orders, and even case sensitivity per request, even in a production environment and dismissing a very real issue that is now becoming more common.", "@TaquitoSlayer Your sarcastic comment isn't appreciated. I suggest you read up on existing standards for the web before claiming you know how the web works:\r\n\r\n- [WHATWG URL](https://url.spec.whatwg.org) which is the most modern standard for URLs [calls for lowercasing the host section of URLs](https://url.spec.whatwg.org/#idna).\r\n\r\n- [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986) which is the standard that Requests and urllib3 primarily use as a reference for their URL parsers also calls for normalization of the host component via lowercasing (quote from [Section 3.2.2](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2)):\r\n\r\n > Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.\r\n\r\nAnyone depending on any different behavior should expect their services to break completely as they're throwing 20+ years of standards out the window." ]
https://api.github.com/repos/psf/requests/issues/5885
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5885/labels{/name}
https://api.github.com/repos/psf/requests/issues/5885/comments
https://api.github.com/repos/psf/requests/issues/5885/events
https://github.com/psf/requests/issues/5885
951,681,556
MDU6SXNzdWU5NTE2ODE1NTY=
5,885
Issue with Backslash
{ "avatar_url": "https://avatars.githubusercontent.com/u/16897883?v=4", "events_url": "https://api.github.com/users/phospi/events{/privacy}", "followers_url": "https://api.github.com/users/phospi/followers", "following_url": "https://api.github.com/users/phospi/following{/other_user}", "gists_url": "https://api.github.com/users/phospi/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/phospi", "id": 16897883, "login": "phospi", "node_id": "MDQ6VXNlcjE2ODk3ODgz", "organizations_url": "https://api.github.com/users/phospi/orgs", "received_events_url": "https://api.github.com/users/phospi/received_events", "repos_url": "https://api.github.com/users/phospi/repos", "site_admin": false, "starred_url": "https://api.github.com/users/phospi/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/phospi/subscriptions", "type": "User", "url": "https://api.github.com/users/phospi", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-07-23T15:30:22Z
2021-10-31T09:00:16Z
2021-07-23T21:20:47Z
NONE
resolved
Hi all, I am at wits end. My scenario is that I am using python requests to interact with Icinga2 API and I am trying to schedule a downtime. So I know how that is supposed to works and it works most of time. But unfortunately I am totally out of luck when the Icinga2 service I try to set a downtime to has name with a backslash in it. My test environment: - Icinga2 2.9.0 - Python 3.6.8 / Python 3.8.11 - requests 2.27.0 Prerequisite: Create a host in Icinga. Create a service in Icinga with a "\\"-character. Python Code for Reproduction: ```` import requests session = requests.Session() session.hooks = { "response": lambda r, *args, **kwargs: r.raise_for_status() } session.headers.update( { "Accept": "application/json", "Content-Type": "application/json", "cache-control": "no-cache", } ) session.auth = requests.auth.HTTPBasicAuth("user","password") url = "https://icinga2-server.com:5665/v1/actions/schedule-downtime" body = { 'comment': 'Downtime', 'author': ('icingaadmin',), 'start_time': 1605196800.0, 'filter': 'host.name==\"HOSTNAME\" && service.name==\"SERVICE\\NAME\"', 'end_time': 1605286800.0, 'fixed': True, 'type': 'Service'} session.post(url, json=body, verify=False) ```` Result: ```` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/root/.pyenv/versions/3.8.11/lib/python3.8/site-packages/requests/sessions.py", line 590, in post return self.request('POST', url, data=data, json=json, **kwargs) File "/root/.pyenv/versions/3.8.11/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/root/.pyenv/versions/3.8.11/lib/python3.8/site-packages/requests/sessions.py", line 662, in send r = dispatch_hook('response', hooks, r, **kwargs) File "/root/.pyenv/versions/3.8.11/lib/python3.8/site-packages/requests/hooks.py", line 31, in dispatch_hook _hook_data = hook(hook_data, **kwargs) File "<stdin>", line 2, in <lambda> File "/root/.pyenv/versions/3.8.11/lib/python3.8/site-packages/requests/models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://icinga2-server.com:5665/v1/actions/schedule-downtime ```` I know very well that this error message indicates that Icinga2 could not find/match a service. But executing the command via curl is clearly working for me and I get a proper scheduled downtime! CURL Request: ```` curl -k -s -u user:password -H 'Accept: application/json' -X POST 'https://icinga2-server.com:5665/v1/actions/schedule-downtime' -d '{"comment": "Downtime", "author": ["icingaadmin"], "start_time": 1605196800.0, "filter": "host.name==\"MSSQLSERVER\" && service.name==\"MSSQLSERVER\\\\INSTANCE2\"", "end_time": 1605286800.0, "fixed": true, "type": "Service"}' ```` CURL ANSWER (SUCCESS): ```` {"results":[{"code":200.0,"legacy_id":8.0,"name":"MSSQLSERVER!MSSQLSERVER\\INSTANCE2!137c9ef9-3150-4e57-ba0b-a22ddc6611d4","status":"Successfully scheduled downtime 'MSSQLSERVER!MSSQLSERVER\\INSTANCE2!137c9ef9-3150-4e57-ba0b-a22ddc6611d4' for object 'MSSQLSERVER!MSSQLSERVER\\INSTANCE2'."}]} ```` Alternate approaches that did not help: ```` session.post(url, data=json.dumps(body), verify=False) string_body = json.dumps(body) session.post(url, data=string_body, verify=False) ````
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5885/reactions" }
https://api.github.com/repos/psf/requests/issues/5885/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here.\r\n\r\nI believe your issue is in \r\n\r\n```python\r\nbody = {\r\n 'comment': 'Downtime',\r\n 'author': ('icingaadmin',),\r\n 'start_time': 1605196800.0,\r\n 'filter': 'host.name==\\\"HOSTNAME\\\" && service.name==\\\"SERVICE\\\\NAME\\\"'),\r\n 'end_time': 1605286800.0,\r\n 'fixed': True,\r\n 'type': 'Service'}\r\n```\r\n\r\nI think what you _want_ is\r\n\r\n\r\n```python\r\nbody = {\r\n 'comment': 'Downtime',\r\n 'author': ['icingaadmin'],\r\n 'start_time': 1605196800.0,\r\n 'filter': r'host.name==\"HOSTNAME\" && service.name==\"SERVICE\\NAME\"',\r\n 'end_time': 1605286800.0,\r\n 'fixed': True,\r\n 'type': 'Service'}\r\n```", "@sigmavirus24 I took a lot of time to tackle and troubleshoot the issue. At the time being it may be a bug or it may be a lack of knowledge. However, at the moment I am pretty sure that the observed behaviour is a bug and I like to get helpful questions and hints that guide me on how to tackle the issue or how to make sure that it is not a bug. If it's not a bug then why does it work in curl? How can I rule out that the observed behaviour is not a bug?\r\n\r\nThe error persists with your tip. I mean anyways, it's just another format of the same content which can be easily shown by printing and comparing the dictionaries.\r\n\r\n\r\n**raw input string**\r\n````\r\n>>> body1 = {\r\n... 'comment': u'Downtime',\r\n... 'author': ('icingaadmin',),\r\n... 'start_time': 1627198957.0,\r\n... 'filter': r'host.name==\"MSSQLSERVER\" && service.name==\"MSSQLSERVER\\INSTANCE2\"',\r\n... 'end_time': 1627199999.0,\r\n... 'fixed': True,\r\n... 'type': u'Service'}\r\n>>> body1\r\n{'comment': 'Downtime', 'author': ('icingaadmin',), 'start_time': 1627198957.0, 'filter': 'host.name==\"MSSQLSERVER\" && service.name==\"MSSQLSERVER\\\\INSTANCE2\"', 'end_time': 1627199999.0, 'fixed': True, 'type': 'Service'}\r\n>>>\r\n````\r\n\r\n\r\n**Escaped input string**\r\n````\r\n>>> body2 = {\r\n... 'comment': 'Downtime',\r\n... 'author': ('icingaadmin',),\r\n... 'start_time': 1605196800.0,\r\n... 'filter': 'host.name==\\\"HOSTNAME\\\" && service.name==\\\"SERVICE\\\\NAME\\\"',\r\n... 'end_time': 1605286800.0,\r\n... 'fixed': True,\r\n... 'type': 'Service'}\r\n>>>\r\n>>> body2\r\n{'comment': 'Downtime', 'author': ('icingaadmin',), 'start_time': 1605196800.0, 'filter': 'host.name==\"HOSTNAME\" && service.name==\"SERVICE\\\\NAME\"', 'end_time': 1605286800.0, 'fixed': True, 'type': 'Service'}\r\n>>>\r\n````\r\n\r\n**Comparison**\r\n````\r\n>>> body1 == body2\r\nTrue\r\n````", "For anyone stumbling across this post. In the end, it was a configuration issue. Sorry." ]
https://api.github.com/repos/psf/requests/issues/5884
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5884/labels{/name}
https://api.github.com/repos/psf/requests/issues/5884/comments
https://api.github.com/repos/psf/requests/issues/5884/events
https://github.com/psf/requests/issues/5884
951,651,658
MDU6SXNzdWU5NTE2NTE2NTg=
5,884
DNS round robin not working
{ "avatar_url": "https://avatars.githubusercontent.com/u/10252511?v=4", "events_url": "https://api.github.com/users/oschlueter/events{/privacy}", "followers_url": "https://api.github.com/users/oschlueter/followers", "following_url": "https://api.github.com/users/oschlueter/following{/other_user}", "gists_url": "https://api.github.com/users/oschlueter/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/oschlueter", "id": 10252511, "login": "oschlueter", "node_id": "MDQ6VXNlcjEwMjUyNTEx", "organizations_url": "https://api.github.com/users/oschlueter/orgs", "received_events_url": "https://api.github.com/users/oschlueter/received_events", "repos_url": "https://api.github.com/users/oschlueter/repos", "site_admin": false, "starred_url": "https://api.github.com/users/oschlueter/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/oschlueter/subscriptions", "type": "User", "url": "https://api.github.com/users/oschlueter", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-23T14:53:42Z
2021-10-21T22:00:19Z
2021-07-23T21:25:44Z
NONE
resolved
I want to setup a PyPI Cloud service with two servers in different data centers and leverage DNS round robin as failover mechanic (see [here](https://github.com/pypa/pip/issues/10185)). To do that, I have configured a multi-value DNS record: ``` $ dig +short pypi-dev.company.de 172.31.33.222 172.31.19.77 ``` In the ticket linked above, @uranusjr points out that the requests library should take care of DNS round robin (see [here](https://github.com/psf/requests/issues/2537)) and that I might have configured my setup incorrectly. To reproduce that, I shut down the application server on 172.31.33.222 and kept the reverse proxy alive. On 172.31.19.77 both application server and reverse proxy are operational. Furthermore, I created this script to retrieve the list of available python packages on my PyPI Cloud service: ``` import requests import logging from urllib3.util.retry import Retry from requests.adapters import HTTPAdapter def get_session(retries=3): s = requests.Session() retry = Retry( total=retries, read=retries, connect=retries, status_forcelist=[502], ) adapter = HTTPAdapter(max_retries=retry) s.mount('http://', adapter) s.mount('https://', adapter) return s if __name__ == '__main__': logging.basicConfig(level=logging.INFO) s = get_session() r = s.get('https://pypi-dev.company.de/simple/', stream=True, timeout=3) ip = r.raw._connection.sock.getpeername() logging.info(f'status code is {r.status_code}') logging.info(f'ip is {ip}') ``` ## Expected Result ``` $ python req.py INFO:root:status code is 200 INFO:root:ip is ('172.31.19.77', 443) ``` ## Actual Result ``` $ python req.py WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=1, read=0, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi-dev.company.de', port=443): Read timed out. (read timeout=3)")': /simple/ Traceback (most recent call last): File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request httplib_response = conn.getresponse() File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1349, in getresponse response.begin() File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 316, in begin version, status, reason = self._read_status() File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 277, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 704, in readinto return self._sock.recv_into(b) File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1099, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 447, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi-dev.company.de', port=443): Read timed out. (read timeout=3) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 783, in urlopen return self.urlopen( File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi-dev.company.de', port=443): Max retries exceeded with url: /simple/ (Caused by ReadTimeoutError("HTTPSConnectionPool(host='pypi-dev.company.de', port=443): Read timed out. (read timeout=3)")) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/oschlueter/git/requests-dns-round-robin/req.py", line 25, in <module> r = s.get('https://pypi-dev.company.de/simple/', stream=True, timeout=3) File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, **kwargs) File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/Users/oschlueter/git/requests-dns-round-robin/venv/lib/python3.9/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pypi-dev.company.de', port=443): Max retries exceeded with url: /simple/ (Caused by ReadTimeoutError("HTTPSConnectionPool(host='pypi-dev.company.de', port=443): Read timed out. (read timeout=3)")) ``` Please note that everything is fine if I restart the application server on 172.31.33.222 and that requests only seems to use that one IP address to connect to my PyPI Cloud server: ``` for ((n=0;n<5;n++)); do python req.py; done INFO:root:status code is 200 INFO:root:ip is ('172.31.33.222', 443) INFO:root:status code is 200 INFO:root:ip is ('172.31.33.222', 443) INFO:root:status code is 200 INFO:root:ip is ('172.31.33.222', 443) INFO:root:status code is 200 INFO:root:ip is ('172.31.33.222', 443) INFO:root:status code is 200 INFO:root:ip is ('172.31.33.222', 443) ``` ## Reproduction Steps * Setup a multi-value DNS record and two servers with reverse proxies and upstream services. * Invoke the script above with your domain name instead of `pypi-dev.company.de` to identify which server requests connects to. * Shut down the upstream service of that server but keep the reverse proxy up and running. * Invoke the script again. ## System Information ``` $ python -m requests.help { "chardet": { "version": null }, "charset_normalizer": { "version": "2.0.3" }, "cryptography": { "version": "" }, "idna": { "version": "3.2" }, "implementation": { "name": "CPython", "version": "3.9.6" }, "platform": { "release": "20.6.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.26.0" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.6" }, "using_charset_normalizer": true, "using_pyopenssl": false } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5884/reactions" }
https://api.github.com/repos/psf/requests/issues/5884/timeline
null
completed
null
null
false
[ "I have neither the infrastructure nor the time to try to reproduce this but based solely on your description, I don't think you're quite testing this the way you think you are. Correct me if I'm wrong, but you said above that you have intermediaries between the actual application servers and requests. Without knowing how your proxies are configured, you're not taking the proxy down, you're taking the backend service down. Round-robin only works on attempting to connect to a resolved IP address (and is done not by Requests but by urllib3). We are able to open the socket because your proxy appears to be working and not immediately failing (hence the read timeout by the client). At that point, we never move on to the next IP address.\r\n\r\nAgain, round-robin for DNS resolution relies on the IP address that's resolved not responding or allowing connections and that logic lives in urllib3." ]
https://api.github.com/repos/psf/requests/issues/5883
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5883/labels{/name}
https://api.github.com/repos/psf/requests/issues/5883/comments
https://api.github.com/repos/psf/requests/issues/5883/events
https://github.com/psf/requests/pull/5883
948,632,656
MDExOlB1bGxSZXF1ZXN0NjkzNDQ4MzA2
5,883
Replace for loops with dictionary comprehensions
{ "avatar_url": "https://avatars.githubusercontent.com/u/76561516?v=4", "events_url": "https://api.github.com/users/monosans/events{/privacy}", "followers_url": "https://api.github.com/users/monosans/followers", "following_url": "https://api.github.com/users/monosans/following{/other_user}", "gists_url": "https://api.github.com/users/monosans/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/monosans", "id": 76561516, "login": "monosans", "node_id": "MDQ6VXNlcjc2NTYxNTE2", "organizations_url": "https://api.github.com/users/monosans/orgs", "received_events_url": "https://api.github.com/users/monosans/received_events", "repos_url": "https://api.github.com/users/monosans/repos", "site_admin": false, "starred_url": "https://api.github.com/users/monosans/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monosans/subscriptions", "type": "User", "url": "https://api.github.com/users/monosans", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-07-20T13:03:24Z
2021-10-18T23:00:40Z
2021-07-20T17:22:27Z
NONE
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5883/reactions" }
https://api.github.com/repos/psf/requests/issues/5883/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5883.diff", "html_url": "https://github.com/psf/requests/pull/5883", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5883.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5883" }
true
[ "Hi @monosans, thanks for the contribution. Unfortunately, we generally don't accept PRs for cosmetic changes to Requests, so we won't be able to merge this.", "@monosans please stop spamming projects with changes like this. You did so on several other projects. It's unhelpful" ]
https://api.github.com/repos/psf/requests/issues/5882
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5882/labels{/name}
https://api.github.com/repos/psf/requests/issues/5882/comments
https://api.github.com/repos/psf/requests/issues/5882/events
https://github.com/psf/requests/issues/5882
948,580,999
MDU6SXNzdWU5NDg1ODA5OTk=
5,882
verify=False doesn't ignore certificate errors with proxy
{ "avatar_url": "https://avatars.githubusercontent.com/u/5131271?v=4", "events_url": "https://api.github.com/users/achapkowski/events{/privacy}", "followers_url": "https://api.github.com/users/achapkowski/followers", "following_url": "https://api.github.com/users/achapkowski/following{/other_user}", "gists_url": "https://api.github.com/users/achapkowski/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/achapkowski", "id": 5131271, "login": "achapkowski", "node_id": "MDQ6VXNlcjUxMzEyNzE=", "organizations_url": "https://api.github.com/users/achapkowski/orgs", "received_events_url": "https://api.github.com/users/achapkowski/received_events", "repos_url": "https://api.github.com/users/achapkowski/repos", "site_admin": false, "starred_url": "https://api.github.com/users/achapkowski/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/achapkowski/subscriptions", "type": "User", "url": "https://api.github.com/users/achapkowski", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-07-20T11:56:23Z
2021-12-23T15:00:25Z
2021-09-24T14:08:42Z
NONE
resolved
Summary. When creating a session and setting `verify=False` with a proxy defined value error is raised. The easiest way to setup this issue is to open Fiddler4 and run the following on Windows: ``` import requests import urllib url = "https://www.arcgis.com/sharing/rest?f=json" proxies = urllib.request.getproxies() session = requests.Session() session.proxies = proxies session.trust_env = True session.verify = False resp = session.get(url=url) print(resp.json()) ``` ## Expected Result ``` {'currentVersion': '9.2'} ``` ## Actual Result ``` Traceback (most recent call last): Python Shell, prompt 2, line 10 File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\requests\sessions.py", line 555, in get return self.request('GET', url, **kwargs) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\requests\adapters.py", line 449, in send timeout=timeout File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen self._prepare_proxy(conn) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy conn.connect() File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\urllib3\connection.py", line 359, in connect conn = self._connect_tls_proxy(hostname, conn) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\urllib3\connection.py", line 506, in _connect_tls_proxy ssl_context=ssl_context, File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\ssl.py", line 423, in wrap_socket session=session File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-dev\Lib\ssl.py", line 827, in _create raise ValueError("check_hostname requires server_hostname") builtins.ValueError: check_hostname requires server_hostname ``` What happened instead. ## Reproduction Steps ```python import requests ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "3.3.1" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.7.10" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "1010109f", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "1010109f" }, "urllib3": { "version": "1.25.11" }, "using_pyopenssl": true } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 2, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 2, "url": "https://api.github.com/repos/psf/requests/issues/5882/reactions" }
https://api.github.com/repos/psf/requests/issues/5882/timeline
null
completed
null
null
false
[ "I can reproduce the issue with the latest requests 2.26.x and urllib3 1.26.6\r\n\r\nPR: https://github.com/urllib3/urllib3/pull/2407 breaks the `requests.Session` object it appears when any proxy is given now.", "Duplicate of #5943" ]
https://api.github.com/repos/psf/requests/issues/5881
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5881/labels{/name}
https://api.github.com/repos/psf/requests/issues/5881/comments
https://api.github.com/repos/psf/requests/issues/5881/events
https://github.com/psf/requests/pull/5881
947,632,816
MDExOlB1bGxSZXF1ZXN0NjkyNTg4ODgy
5,881
docs: Update the Red Hat vulnerabilities contact
{ "avatar_url": "https://avatars.githubusercontent.com/u/1977525?v=4", "events_url": "https://api.github.com/users/jeremycline/events{/privacy}", "followers_url": "https://api.github.com/users/jeremycline/followers", "following_url": "https://api.github.com/users/jeremycline/following{/other_user}", "gists_url": "https://api.github.com/users/jeremycline/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jeremycline", "id": 1977525, "login": "jeremycline", "node_id": "MDQ6VXNlcjE5Nzc1MjU=", "organizations_url": "https://api.github.com/users/jeremycline/orgs", "received_events_url": "https://api.github.com/users/jeremycline/received_events", "repos_url": "https://api.github.com/users/jeremycline/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jeremycline/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jeremycline/subscriptions", "type": "User", "url": "https://api.github.com/users/jeremycline", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-07-19T13:05:36Z
2021-10-17T17:03:39Z
2021-07-19T16:44:02Z
CONTRIBUTOR
resolved
I am departing Red Hat so it would be best to contact the Python maintenance team there instead of me if a vulnerability is discovered. Cc: @hroncok
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 1, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 1, "url": "https://api.github.com/repos/psf/requests/issues/5881/reactions" }
https://api.github.com/repos/psf/requests/issues/5881/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5881.diff", "html_url": "https://github.com/psf/requests/pull/5881", "merged_at": "2021-07-19T16:44:02Z", "patch_url": "https://github.com/psf/requests/pull/5881.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5881" }
true
[]
https://api.github.com/repos/psf/requests/issues/5880
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5880/labels{/name}
https://api.github.com/repos/psf/requests/issues/5880/comments
https://api.github.com/repos/psf/requests/issues/5880/events
https://github.com/psf/requests/pull/5880
946,577,588
MDExOlB1bGxSZXF1ZXN0NjkxNzI3MjUy
5,880
Set encoding for +json media type suffix responses like application/json
{ "avatar_url": "https://avatars.githubusercontent.com/u/109152?v=4", "events_url": "https://api.github.com/users/scop/events{/privacy}", "followers_url": "https://api.github.com/users/scop/followers", "following_url": "https://api.github.com/users/scop/following{/other_user}", "gists_url": "https://api.github.com/users/scop/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/scop", "id": 109152, "login": "scop", "node_id": "MDQ6VXNlcjEwOTE1Mg==", "organizations_url": "https://api.github.com/users/scop/orgs", "received_events_url": "https://api.github.com/users/scop/received_events", "repos_url": "https://api.github.com/users/scop/repos", "site_admin": false, "starred_url": "https://api.github.com/users/scop/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/scop/subscriptions", "type": "User", "url": "https://api.github.com/users/scop", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-07-16T20:28:21Z
2022-05-04T18:00:31Z
2022-02-02T18:39:16Z
CONTRIBUTOR
resolved
https://tools.ietf.org/html/rfc6839#section-3.1
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5880/reactions" }
https://api.github.com/repos/psf/requests/issues/5880/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5880.diff", "html_url": "https://github.com/psf/requests/pull/5880", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5880.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5880" }
true
[ "While this may be correct to spec, I'm pretty hesitant with making this change. We're using this function in the hot-path for all responses and how they interact with `.text`. Currently, these all rely on chardet/charset_normalizer for encoding, anything that isn't encodable with utf-8 will break with this change. That's likely a small subset, but blast radius is hard to gauge.", "I'm fine with declining this one too, detecting UTF-8 is pretty straightforward and existing path works fine.", "Thanks for the PR, @scop. While you're correct this is how we _should_ function, it deviates far enough from our previous behavior that I don't think we can accept the change. Please feel free to open an issue with the request and we can add it as part of a tracking story for if we ever decide to make breaking changes." ]
https://api.github.com/repos/psf/requests/issues/5879
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5879/labels{/name}
https://api.github.com/repos/psf/requests/issues/5879/comments
https://api.github.com/repos/psf/requests/issues/5879/events
https://github.com/psf/requests/issues/5879
946,389,064
MDU6SXNzdWU5NDYzODkwNjQ=
5,879
proxy with custom hostname on proxy (possible bug ?)
{ "avatar_url": "https://avatars.githubusercontent.com/u/29481952?v=4", "events_url": "https://api.github.com/users/flapili/events{/privacy}", "followers_url": "https://api.github.com/users/flapili/followers", "following_url": "https://api.github.com/users/flapili/following{/other_user}", "gists_url": "https://api.github.com/users/flapili/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/flapili", "id": 29481952, "login": "flapili", "node_id": "MDQ6VXNlcjI5NDgxOTUy", "organizations_url": "https://api.github.com/users/flapili/orgs", "received_events_url": "https://api.github.com/users/flapili/received_events", "repos_url": "https://api.github.com/users/flapili/repos", "site_admin": false, "starred_url": "https://api.github.com/users/flapili/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/flapili/subscriptions", "type": "User", "url": "https://api.github.com/users/flapili", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-16T15:21:52Z
2021-10-15T19:00:28Z
2021-07-17T18:05:16Z
NONE
resolved
Hi, I'm running zaproxy behind an nginx to perform some audit on our customer website, infortunally I have few issues with requests proxying. ``` curl -x https://xxx.xxx.xxx -L http://zap ``` ``` <head> <title>ZAP API UI</title> </head> <body> ... </body> ``` but with requests (not exactly the same request): ``` req = requests.post( "http://zap/JSON/spider/view/scans", proxies={"https": settings.owasp_proxy_url}, data={"apikey": settings.owasp_api_key.get_secret_value()}, ) ``` ``` requests.exceptions.ConnectionError: HTTPConnectionPool(host='zap', port=80): Max retries exceeded with url: /JSON/spider/view/scans (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb1f84c2730>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known')) ``` Python: 3.9 requests: 2.25.1 Best regards
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5879/reactions" }
https://api.github.com/repos/psf/requests/issues/5879/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here.\r\n\r\n`nodename nor servname provided, or not known` means we could not resolve the name via DNS for `zap`. Requests delegates to the standard library (which delegates to the operating system) to resolve DNS. We do not use the proxy to find DNS servers so you need to ensure that your system is configured appropriately." ]
https://api.github.com/repos/psf/requests/issues/5878
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5878/labels{/name}
https://api.github.com/repos/psf/requests/issues/5878/comments
https://api.github.com/repos/psf/requests/issues/5878/events
https://github.com/psf/requests/pull/5878
946,360,778
MDExOlB1bGxSZXF1ZXN0NjkxNTQ2NjYz
5,878
Unify interface definition
{ "avatar_url": "https://avatars.githubusercontent.com/u/1119426?v=4", "events_url": "https://api.github.com/users/weddige/events{/privacy}", "followers_url": "https://api.github.com/users/weddige/followers", "following_url": "https://api.github.com/users/weddige/following{/other_user}", "gists_url": "https://api.github.com/users/weddige/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/weddige", "id": 1119426, "login": "weddige", "node_id": "MDQ6VXNlcjExMTk0MjY=", "organizations_url": "https://api.github.com/users/weddige/orgs", "received_events_url": "https://api.github.com/users/weddige/received_events", "repos_url": "https://api.github.com/users/weddige/repos", "site_admin": false, "starred_url": "https://api.github.com/users/weddige/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/weddige/subscriptions", "type": "User", "url": "https://api.github.com/users/weddige", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-16T14:47:01Z
2021-10-15T19:00:29Z
2021-07-17T18:02:53Z
NONE
resolved
With this pull request I am trying to get rid of some differences in the interface definition and doc strings of `requests.api` and `requests.sessions.Session`. In not all cases there was an obvious right choice and some discussion might be necessary.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5878/reactions" }
https://api.github.com/repos/psf/requests/issues/5878/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5878.diff", "html_url": "https://github.com/psf/requests/pull/5878", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5878.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5878" }
true
[ "Changing function argument definitions to attempt to match things is not something we're going to accept anytime soon, especially not before the next major version. Further, attempting to try to synchronize these docstrings is going to be a futile effort unfortunately as they're going to drift by nature of them being separate strings." ]
https://api.github.com/repos/psf/requests/issues/5877
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5877/labels{/name}
https://api.github.com/repos/psf/requests/issues/5877/comments
https://api.github.com/repos/psf/requests/issues/5877/events
https://github.com/psf/requests/pull/5877
945,526,525
MDExOlB1bGxSZXF1ZXN0NjkwODQ0NDYx
5,877
Update api.rst
{ "avatar_url": "https://avatars.githubusercontent.com/u/86739818?v=4", "events_url": "https://api.github.com/users/steveberdy/events{/privacy}", "followers_url": "https://api.github.com/users/steveberdy/followers", "following_url": "https://api.github.com/users/steveberdy/following{/other_user}", "gists_url": "https://api.github.com/users/steveberdy/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/steveberdy", "id": 86739818, "login": "steveberdy", "node_id": "MDQ6VXNlcjg2NzM5ODE4", "organizations_url": "https://api.github.com/users/steveberdy/orgs", "received_events_url": "https://api.github.com/users/steveberdy/received_events", "repos_url": "https://api.github.com/users/steveberdy/repos", "site_admin": false, "starred_url": "https://api.github.com/users/steveberdy/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/steveberdy/subscriptions", "type": "User", "url": "https://api.github.com/users/steveberdy", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-07-15T15:48:27Z
2021-11-21T21:00:16Z
2021-07-16T18:06:43Z
CONTRIBUTOR
resolved
## Summary Updates API links so the examples will work as expected. Fixes #5876
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5877/reactions" }
https://api.github.com/repos/psf/requests/issues/5877/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5877.diff", "html_url": "https://github.com/psf/requests/pull/5877", "merged_at": "2021-07-16T18:06:42Z", "patch_url": "https://github.com/psf/requests/pull/5877.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5877" }
true
[]
https://api.github.com/repos/psf/requests/issues/5876
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5876/labels{/name}
https://api.github.com/repos/psf/requests/issues/5876/comments
https://api.github.com/repos/psf/requests/issues/5876/events
https://github.com/psf/requests/issues/5876
945,524,226
MDU6SXNzdWU5NDU1MjQyMjY=
5,876
GitHub API links for request streaming are outdated
{ "avatar_url": "https://avatars.githubusercontent.com/u/86739818?v=4", "events_url": "https://api.github.com/users/steveberdy/events{/privacy}", "followers_url": "https://api.github.com/users/steveberdy/followers", "following_url": "https://api.github.com/users/steveberdy/following{/other_user}", "gists_url": "https://api.github.com/users/steveberdy/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/steveberdy", "id": 86739818, "login": "steveberdy", "node_id": "MDQ6VXNlcjg2NzM5ODE4", "organizations_url": "https://api.github.com/users/steveberdy/orgs", "received_events_url": "https://api.github.com/users/steveberdy/received_events", "repos_url": "https://api.github.com/users/steveberdy/repos", "site_admin": false, "starred_url": "https://api.github.com/users/steveberdy/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/steveberdy/subscriptions", "type": "User", "url": "https://api.github.com/users/steveberdy", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-07-15T15:45:53Z
2021-10-14T19:00:26Z
2021-07-16T18:06:43Z
CONTRIBUTOR
resolved
The URLs to GitHub API links [here](https://github.com/psf/requests/blob/master/docs/api.rst#api-changes) should be updated from `https://github.com/timeline.json` to `https://api.github.com/events` for a working example.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5876/reactions" }
https://api.github.com/repos/psf/requests/issues/5876/timeline
null
completed
null
null
false
[]
https://api.github.com/repos/psf/requests/issues/5875
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5875/labels{/name}
https://api.github.com/repos/psf/requests/issues/5875/comments
https://api.github.com/repos/psf/requests/issues/5875/events
https://github.com/psf/requests/pull/5875
945,325,266
MDExOlB1bGxSZXF1ZXN0NjkwNjcwMTk3
5,875
Make chardet/charset_normalizer optional dependencies
{ "avatar_url": "https://avatars.githubusercontent.com/u/58669?v=4", "events_url": "https://api.github.com/users/akx/events{/privacy}", "followers_url": "https://api.github.com/users/akx/followers", "following_url": "https://api.github.com/users/akx/following{/other_user}", "gists_url": "https://api.github.com/users/akx/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/akx", "id": 58669, "login": "akx", "node_id": "MDQ6VXNlcjU4NjY5", "organizations_url": "https://api.github.com/users/akx/orgs", "received_events_url": "https://api.github.com/users/akx/received_events", "repos_url": "https://api.github.com/users/akx/repos", "site_admin": false, "starred_url": "https://api.github.com/users/akx/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/akx/subscriptions", "type": "User", "url": "https://api.github.com/users/akx", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2021-07-15T12:24:28Z
2023-05-31T00:03:20Z
2022-05-11T01:26:03Z
NONE
resolved
An implementation of #5871 for consideration. Unlike my suggestion in #5871, this implementation _prefers_ `chardet` / `charset_normalizer` if it's available, with the idea that those libraries should hopefully do a better job than trying to decode the payload in the two most likely encodings. Decoding ASCII and UTF-8 (["UTF-8 is used by 97.0% of all the websites whose character encoding we know."](https://w3techs.com/technologies/details/en-utf8)) will continue to work without those libraries, and a helpful error is raised in other cases. This is still missing documentation, changelogs, etc. – help appreciated. Considering the switchover to `charset_normalizer` has broken some users' workflows anyway, I think it wouldn't be too much of an additional breaking change to do this without a major version bump.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 2, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 2, "url": "https://api.github.com/repos/psf/requests/issues/5875/reactions" }
https://api.github.com/repos/psf/requests/issues/5875/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5875.diff", "html_url": "https://github.com/psf/requests/pull/5875", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5875.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5875" }
true
[ "I think we're going to close this out given the outcome of tracking issue. The long term goal is to remove character detection from Requests. I'm not sure this solution is robust enough and is likely to introduce further unnecessary breakages at this point. We'll track progress on the original issue. Thanks!", "@nateprewitt What is the tracking issue, please? #5871 has been \"locked as off-topic\", #5797 has been \"locked as resolved\".\r\n\r\nI'm curious what the perceived non-robustness here is, because I do believe we could just drop the default chardet/charset_normalizer dependency and most of our users would be none the wiser.\r\n\r\n## Encodings on the web\r\n\r\nI wrote [a program](https://github.com/akx/net-encodings) to get the top-level pages of the domains in [the TRANCO list](https://tranco-list.eu/) to figure out the lay of the land encoding-wise. I filtered to the top 10000 or so domains because of a lack of patience, and the results are as follows:\r\n\r\nOut of 5938 pages, there are 10 pages (0.17%) where an encoding wasn't (correctly) declared.\r\nWith binary responses filtered out, there are 7 such pages (0.12%):\r\n\r\n| URL | Content-Type | Remarks |\r\n| --- | --- | --- |\r\n| http://micpn.com/ | (no content-type) | ASCII error page\r\n| https://grubhub.com/ | (no content-type) | ASCII error page telling me Grubhub doesn't do Finland |\r\n| https://mob.com/ | (no content-type) | utf-8 HTML |\r\n| https://sberbank.ru/ | text/html; charset=utf-8, text/html | malformed content-type header, content utf-8 |\r\n| https://sbrf.ru/ | text/html; charset=utf-8, text/html | malformed content-type header, content utf-8 |\r\n| https://unicode.org/ | (no content-type) | (ironically enough) serves an ASCII redirection page to home.unicode.org |\r\n| https://www.fuse-cloud.com/ | (no content-type) | returns `invalid request` |\r\n\r\n\r\nFor the rest, the following encodings were declared (`via fallback` meaning gleaned with requests' [internal fallback for text](https://github.com/psf/requests/blob/cb233a101d6333cf1895e3f46bde11874fcaba07/requests/utils.py#L550-L551):\r\n\r\n| Encoding | Count | % |\r\n| --- | --: | --: |\r\n| utf-8 | 4918 | 82.82% |\r\n| iso-8859-1 (via fallback) | 938 | 15.80% |\r\n| iso-8859-1 | 27 | 0.45% |\r\n| windows-1251 | 18 | 0.30% |\r\n| gbk | 9 | 0.15% |\r\n| euc-jp | 6 | 0.10% |\r\n| gb2312 | 4 | 0.07% |\r\n| iso-8859-2 | 4 | 0.07% |\r\n| iso-8859-15 | 3 | 0.05% |\r\n| shift_jis | 3 | 0.05% |\r\n| euc-kr | 2 | 0.03% |\r\n| us-ascii | 1 | 0.02% |\r\n| windows-1250 | 1 | 0.02% |\r\n| windows-1256 | 1 | 0.02% |\r\n| utf-8 (via fallback) | 1 | 0.02% |\r\n| windows-31j | 1 | 0.02% |\r\n| big-5 | 1 | 0.02% |\r\n\r\nThe top 3 encodings account for 99.07% of the pages analyzed.\r\n\r\nThe key takeaway that is **In this corpus, _all_ text pages will be decodable by my proposed `.text` implementation**, either by way of the explicit `.encoding` read from headers, or implied UTF-8. And again, should decoding fail, the error message guides the user to install either detector package and to try again.\r\n\r\n## UTF-8 misinterpretations\r\n\r\nI also believe it's quite unlikely for the UTF-8 codec to successfully misinterpret a string.\r\n\r\nTo that end, I wrote a small [test bench](https://gist.github.com/akx/edd4e2b033ebb00d283be0b6fac0bd64) that encodes random test sequences with random codecs and attempts to decode them as UTF-8, recording how many misinterpretations there are.\r\n\r\nAfter 2 million attempts, there were about 22663 misinterpretations (and 41038 correct interpretations!), and by far the top \"misbehaving\" encoding is UTF-7 (20669 out of 22663 misinterpretations), which is esoteric in its own right, but also [very esoteric on the web: 0.012%](https://w3techs.com/technologies/details/en-utf7). The other top misbehavers were UTF-16 and UTF-32, which are in the same esotericity league on the web. (None of these codecs appear in the TRANCO corpus.)\r\n", "Hi @nateprewitt – sorry for the extra ping, but could you take a look at the above comment?", "Hi @akx,\r\n\r\nThe tracking issue is still #5871 as noted in the last comment and our state of the change is in the first bullet point.\r\n\r\n> Yes, it [character detection] should be optional. We want to remove character detection entirely. It doesn't belong in Requests. This won't happen until we major version bump.\r\n\r\nYou'll find the research you've done is very similar to what was performed in the original issue by Apache [[1](https://github.com/potiuk/test-charset-normalizer)][[2](https://github.com/psf/requests/pull/5797#issuecomment-840764049)]. There are however issues with this approach.\r\n\r\nThe fact you noticed a difference between chardet and charset-normalizer to begin with demonstrates the sampling approach is insufficient. Trying to extrapolate behavior across billions of websites to the 10000 most used (and best behaved) is extremely lossy. It's also failing to account for usage within private networks where Requests is routinely used for internal tooling.\r\n\r\nOur key takeaway from the charset-normalizer migration is we cannot accurately gauge usage on this and there is no \"correct\" answer on how we handle it. That's where we arrived at the functionality just doesn't belong in Requests as a default. The best path forward is deferring to the end user for how they'd like to handle decoding. `text` may eventually choose to fallback to `utf-8`/`ascii`, but that's not a change we're looking to make at this time.\r\n\r\n> And again, should decoding fail, the error message guides the user to install either detector package and to try again.\r\n\r\nThis is a hard no from us. We spent months doing analysis on impact for the first change and _very_ reluctantly made it due to the impact to the broader Apache ecosystem. Despite best efforts, it was still more visible that we'd have liked and further ingrained these changes are not safe for a project of Requests size. We won't intentionally make a more significant breaking change like this without a major version bump." ]
https://api.github.com/repos/psf/requests/issues/5874
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5874/labels{/name}
https://api.github.com/repos/psf/requests/issues/5874/comments
https://api.github.com/repos/psf/requests/issues/5874/events
https://github.com/psf/requests/pull/5874
945,256,762
MDExOlB1bGxSZXF1ZXN0NjkwNjExMjEz
5,874
Remove legacy version check for cryptography
{ "avatar_url": "https://avatars.githubusercontent.com/u/58669?v=4", "events_url": "https://api.github.com/users/akx/events{/privacy}", "followers_url": "https://api.github.com/users/akx/followers", "following_url": "https://api.github.com/users/akx/following{/other_user}", "gists_url": "https://api.github.com/users/akx/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/akx", "id": 58669, "login": "akx", "node_id": "MDQ6VXNlcjU4NjY5", "organizations_url": "https://api.github.com/users/akx/orgs", "received_events_url": "https://api.github.com/users/akx/received_events", "repos_url": "https://api.github.com/users/akx/repos", "site_admin": false, "starred_url": "https://api.github.com/users/akx/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/akx/subscriptions", "type": "User", "url": "https://api.github.com/users/akx", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-07-15T10:55:38Z
2021-10-14T15:00:32Z
2021-07-16T14:49:15Z
NONE
resolved
It's unlikely that someone would be running [a version of cryptography from before June 2016](https://pypi.org/project/cryptography/1.3.3/) these days.
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5874/reactions" }
https://api.github.com/repos/psf/requests/issues/5874/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5874.diff", "html_url": "https://github.com/psf/requests/pull/5874", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5874.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5874" }
true
[ "Given that CentOS 7 was released in 2014 and many companies use that instead of Ubuntu or RHEL, I'm not entirely certain we can make that assumption", "I think I'm also not inclined to remove this yet. People can still manually reenable PyOpenSSL in requests via urllib3, and this check would still be needed/useful in that case.", "I agree with @sigmavirus24 and @nateprewitt and that makes a complete set. Thanks for opening this though, this may be something we can drop in the future when urllib3 drops pyOpenSSL/cryptography but that's a ways off." ]
https://api.github.com/repos/psf/requests/issues/5873
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5873/labels{/name}
https://api.github.com/repos/psf/requests/issues/5873/comments
https://api.github.com/repos/psf/requests/issues/5873/events
https://github.com/psf/requests/issues/5873
945,116,063
MDU6SXNzdWU5NDUxMTYwNjM=
5,873
Support for Certificate Transparency
{ "avatar_url": "https://avatars.githubusercontent.com/u/1949076?v=4", "events_url": "https://api.github.com/users/RJPercival/events{/privacy}", "followers_url": "https://api.github.com/users/RJPercival/followers", "following_url": "https://api.github.com/users/RJPercival/following{/other_user}", "gists_url": "https://api.github.com/users/RJPercival/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/RJPercival", "id": 1949076, "login": "RJPercival", "node_id": "MDQ6VXNlcjE5NDkwNzY=", "organizations_url": "https://api.github.com/users/RJPercival/orgs", "received_events_url": "https://api.github.com/users/RJPercival/received_events", "repos_url": "https://api.github.com/users/RJPercival/repos", "site_admin": false, "starred_url": "https://api.github.com/users/RJPercival/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/RJPercival/subscriptions", "type": "User", "url": "https://api.github.com/users/RJPercival", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-15T08:08:44Z
2021-10-13T21:00:41Z
2021-07-15T20:34:03Z
NONE
resolved
[OpenSSL 1.1 supports checking of Signed Certificate Timestamps](https://www.openssl.org/docs/man1.1.0/man7/ct.html) (SCTs) when establishing a TLS connection, but `requests` does not provide a way to enable or configure this. Doing so would allow for a higher degree of security for users that wish to opt into this.
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5873/reactions" }
https://api.github.com/repos/psf/requests/issues/5873/timeline
null
completed
null
null
false
[ "Requests can't take advantage until this API it's exposed via the standard library `ssl` module. I recommend opening an issue in [Python's issue tracker instead](https://bugs.python.org)." ]
https://api.github.com/repos/psf/requests/issues/5872
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5872/labels{/name}
https://api.github.com/repos/psf/requests/issues/5872/comments
https://api.github.com/repos/psf/requests/issues/5872/events
https://github.com/psf/requests/issues/5872
944,516,999
MDU6SXNzdWU5NDQ1MTY5OTk=
5,872
Failed to establish a new connection: [WinError 10060]
{ "avatar_url": "https://avatars.githubusercontent.com/u/32814992?v=4", "events_url": "https://api.github.com/users/ldc999/events{/privacy}", "followers_url": "https://api.github.com/users/ldc999/followers", "following_url": "https://api.github.com/users/ldc999/following{/other_user}", "gists_url": "https://api.github.com/users/ldc999/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ldc999", "id": 32814992, "login": "ldc999", "node_id": "MDQ6VXNlcjMyODE0OTky", "organizations_url": "https://api.github.com/users/ldc999/orgs", "received_events_url": "https://api.github.com/users/ldc999/received_events", "repos_url": "https://api.github.com/users/ldc999/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ldc999/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ldc999/subscriptions", "type": "User", "url": "https://api.github.com/users/ldc999", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-14T14:58:45Z
2021-07-15T00:08:14Z
2021-07-15T00:08:03Z
NONE
off-topic
Now I have a very difficult problem, I have spent a few days and still have not solved it, I hope to get help ,Thanks. When I request the google map website, I use the 'requests.get' method to report an exception. The request code and exception are as follows: ```python (Single thread) import requests header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', 'Accept': '*/*', 'Connection': 'close', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'zh-CN'} weburl = 'https://www.google.com.hk/maps/search/hospital/@1.26,103.7,12z' response = requests.get(weburl, headers=header, verify=False) ``` Actual Result -->Exception HTTPSConnectionPool(host='www.google.com.hk', port=443): Max retries exceeded with url: /maps/search/hospital/@1.26,103.7,12z (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000026D6189A700>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。')) ## Other info Currently my computer browser can access thew weburl normally. I also changed the parameter weburl value in the code to www.baidu.com, the request can also be successful ## System Information $ python -m requests.help { "chardet": { "version": "4.0.0" }, "charset_normalizer": { "version": "2.0.1" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.4" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.26.0" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.6" }, "using_charset_normalizer": false, "using_pyopenssl": false }
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5872/reactions" }
https://api.github.com/repos/psf/requests/issues/5872/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5871
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5871/labels{/name}
https://api.github.com/repos/psf/requests/issues/5871/comments
https://api.github.com/repos/psf/requests/issues/5871/events
https://github.com/psf/requests/issues/5871
944,382,996
MDU6SXNzdWU5NDQzODI5OTY=
5,871
Make chardet/charset_normalizer optional?
{ "avatar_url": "https://avatars.githubusercontent.com/u/58669?v=4", "events_url": "https://api.github.com/users/akx/events{/privacy}", "followers_url": "https://api.github.com/users/akx/followers", "following_url": "https://api.github.com/users/akx/following{/other_user}", "gists_url": "https://api.github.com/users/akx/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/akx", "id": 58669, "login": "akx", "node_id": "MDQ6VXNlcjU4NjY5", "organizations_url": "https://api.github.com/users/akx/orgs", "received_events_url": "https://api.github.com/users/akx/received_events", "repos_url": "https://api.github.com/users/akx/repos", "site_admin": false, "starred_url": "https://api.github.com/users/akx/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/akx/subscriptions", "type": "User", "url": "https://api.github.com/users/akx", "user_view_type": "public" }
[ { "color": "02e10c", "default": false, "description": null, "id": 76800, "name": "Feature Request", "node_id": "MDU6TGFiZWw3NjgwMA==", "url": "https://api.github.com/repos/psf/requests/labels/Feature%20Request" } ]
open
true
null
[]
null
23
2021-07-14T12:34:54Z
2022-01-13T16:35:47Z
null
NONE
off-topic
With a routine version bump of requirements, I noticed `chardet` had been switched out for `charset_normalizer` (which I had never heard of before) in #5797, apparently due to LGPL license concerns. I agree with @sigmavirus24's comment https://github.com/psf/requests/pull/5797#issuecomment-875158955 that it's strange for something as central in the Python ecosystem as `requests` is (45k stars, 8k forks, many contributors at the time of writing) to switch to such a relatively unknown and unproven library (132 stars, 5 forks, 2 contributors) for a _hard_ dependency in something as central in the Python ecosystem as `requests` is. The release notes say you could use `pip install "requests[use_chardet_on_py3]"` to use `chardet` instead of `charset_normalizer`, but with that extra set both libraries get installed. I would imagine many users don't really necessarily need the charset detection features in Requests; could we open a discussion on making both `chardet`/`charset_normalizer` optional, á la `requests[chardet]` or `requests[charset_normalizer]`? AFAICS, the only place where `chardet` is actually used in `requests` is `Response.apparent_encoding`, which is used by `Response.text` when there is no determined encoding. Maybe `apparent_encoding` could try to 1. as a built-in first attempt, try decoding the content as UTF-8 (which would likely be successful for many cases) 2. if neither `chardet` or `charset_normalizer` is installed, warn the user ("No encoding detection library is installed. Falling back to XXXX. Please see YYYY for instructions" or somesuch) and return e.g. `ascii` 3. use either chardet library as per usual
null
{ "+1": 8, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 8, "url": "https://api.github.com/repos/psf/requests/issues/5871/reactions" }
https://api.github.com/repos/psf/requests/issues/5871/timeline
null
null
null
null
false
[ "`apparent_encoding` genuinely just needs to go away. That can't be done until a major release. Once that happens, we don't need dependencies on either library", "Hi @akx \r\n\r\nHopefully, this change will benefit the people who actually depend on charset detection.", "`charset_normalizer` cannot correctly handle some very normal entries, e.g., an empty JSON response:\r\n\r\n```python\r\n>>> import charset_normalizer\r\n>>> charset_normalizer.detect(b'{}')\r\n/home/tseaver/projects/agendaless/Google/src/python-cloud-core/.nox/unit-3-6/lib/python3.6/site-packages/charset_normalizer/api.py:95: UserWarning: Trying to detect encoding from a tiny portion of (2) byte(s).\r\n warn('Trying to detect encoding from a tiny portion of ({}) byte(s).'.format(length))\r\n{'encoding': 'utf_16_be', 'language': '', 'confidence': 1.0}\r\n>>> b'{}'.decode('utf_16_be')\r\n'筽'\r\n```\r\n\r\nNote that `charset_normalizer.detect` is actually deprecated:\r\n\r\n```python\r\n>>> print(charset_normalizer.detect.__doc__)\r\n\r\n chardet legacy method\r\n Detect the encoding of the given byte string. It should be mostly backward-compatible.\r\n Encoding name will match Chardet own writing whenever possible. (Not on encoding name unsupported by it)\r\n This function is deprecated and should be used to migrate your project easily, consult the documentation for\r\n further information. Not planned for removal.\r\n\r\n :param byte_str: The byte sequence to examine.\r\n \r\n```", "Thanks @tseaver, I believe this is something we'd called out in initial testing. The same issue happened for large strings containing only numbers but was seemingly randomly categorized as utf-16. I was under the impression this had been resolved though.\r\n\r\n@Ousret can you take a look at this when you have a moment?", "Hi @tseaver \r\n\r\nThanks for the report, I have seen that you opened an issue in `charset_normalizer`. I will pursue this in the issue.\r\n@nateprewitt of course.\r\n", "> Hopefully, this change will benefit the people who actually depend on charset detection.\r\n\r\nAs I said, most people end up far more frustrated by this \"feature\" than helped by it. ", "The change causes issues on my side as well. Seems `charset_normalizer` does not detect below ascii string correctly (even when using the newest 2.0.2 version)\r\n\r\n````\r\n>>> rawdata = b'g4UsPJdfzNkGW2jwmKDGDilKGKYtpF2X.mx3MaTWL1tL7CNn5U7DeCcodKX7S3lwwJPKNjBT8etY'\r\n\r\n>>> import charset_normalizer\r\n>>> detected_cn = charset_normalizer.detect(rawdata)\r\n>>> detected_cn\r\n{'encoding': 'utf_16_le', 'language': '', 'confidence': 1.0}\r\n\r\n>>> import chardet\r\n>>> detected_cd = chardet.detect(rawdata)\r\n>>> print(detected_cd)\r\n{'encoding': 'ascii', 'confidence': 1.0, 'language': ''}\r\n>>>\r\n````\r\n\r\nFor the moment I am using the workaround described in your release note. Will open an issue in `charset_normalizer`.\r\n\r\n\r\n", "I took the liberty of implementing a version of what I drafted out in the original post in PR #5875. \r\n\r\nDecoding ASCII and UTF-8 ([\"UTF-8 is used by 97.0% of all the websites whose character encoding we know.\"](https://w3techs.com/technologies/details/en-utf8)) will continue to work without those libraries, and a helpful error is raised in other cases.", "Although it's solved, just wanted to mention that this is indeed a crucial mechanic, since `charset_normalizer` is still \"young\". For example, it doesn't work properly on Debian in some cases, while is quite consistent on Windows.", "@a-maliarov can you explain yourself with the ‘work consistent on Windows but not Debian’ ? Need concrete case.", "@Ousret hi, I think it would be better to post my specific issue within `charset_normalizer`'s repository. Will do later.", "I am still not sure how it impacted me, but I had an encoding issue when upgrading requests to 2.26 with my pdf generation. As far as I can tell, the lib I am using (xhtml2pdf) does not use requests or chardet/charset_normalizer directly.\r\n\r\nThe code is simply:\r\n\r\n```python\r\nhtml = 'html unicode string'\r\ninput_file = io.BytesIO(html.encode('utf-8'))\r\ntemp_file = NamedTemporaryFile('wb', delete=False)\r\nxhtml2pdf.pisa.CreatePDF(input_file, temp_file, encoding='utf8')\r\n```\r\n\r\nI'm not even sure how to find where or how the change to charset_normalizer impacted this. My solution for now has been to pin requests to 2.25.1.", "> I'm not even sure how to find where or how the change to charset_normalizer impacted this. My solution for now has been to pin requests to 2.25.1.\r\n\r\nYou can simply install `chardet` @Gagaro and it will be fully backwards-compatible (or use the right extra when installing requests)\r\nIn your requirements add requests as `requests[use_chardet_on_py3]==2.26.0` or install it with `pip install \"requests[use_chardet_on_py3]==2.26.0\"` - this should solve the problem entirely.\r\n\r\nIf not, then it means that it was a different chnage in 2.26.0 that impacted you.", "Thanks, it works with `[use_chardet_on_py3]`. I still don't see how this sub-dependency can have this impact.", "> Thanks, it works with `[use_chardet_on_py3]`. I still don't see how this sub-dependency can have this impact.\r\n\r\nUsing the charset-normalizer was done in backwards-compatible way to give people who implicitly depend on results of `chardet` an easy way to switch back to use chardet. \r\n\r\nSimply - if chardet is installed, it will be used instead of charset-normalizer.\r\n\r\nIt's known \"property\" of charset-normalizer that it sometimes might produce different results than chardet when encoding is guessed from content. Both Chardet and Charset-normalizer use some kind of heuristics to determine that and they both use different optimisations and shortcuts to make this guess \"fast\". \r\n\r\nSo when @ashb implemented the change he thought about users like you who might somehow depend on the way how chardet detects it and if chardet is installed, it will be used. The Gist of the change was that chardet should not be a \"required\" dependency because of the licencing is used. So it's not mandatory for requests. But if you install it as an optional extra or manually, that's fine (and to keep backwards compatibiliy it will be used as optional component). Thanks to that, the LGPL license (as being optional) does not limit the users of requests in redistributing their code and their users to redistribute it further.", "Yes I understand all that, what I don't is why does it impact `xhtml2pdf` which does not depend on `requests` / `chardet` / `charset-normalizer` :\r\n\r\n```\r\nxhtml2pdf==0.2.4\r\n - html5lib [required: >=1.0, installed: 1.1]\r\n - six [required: >=1.9, installed: 1.15.0]\r\n - webencodings [required: Any, installed: 0.5.1]\r\n - Pillow [required: Any, installed: 7.2.0]\r\n - pyPdf2 [required: Any, installed: 1.26.0]\r\n - reportlab [required: >=3.0, installed: 3.5.46]\r\n - pillow [required: >=4.0.0, installed: 7.2.0]\r\n - six [required: Any, installed: 1.15.0]\r\n ```\r\n\r\nDo `chardet` or `charset-normalizer` modify some things globally which could explain the side effects?\r\n\r\nThanks for taking the time to explain all of that.", "@Gagaro `html5lib` optionally requires `chardet` and likely behaves differently if it's not installed.\r\n\r\nhttps://github.com/html5lib/html5lib-python/blob/f7cab6f019ce94a1ec0192b6ff29aaebaf10b50d/requirements-optional.txt#L7-L9", "> @Gagaro `html5lib` optionally requires `chardet` and likely behaves differently if it's not installed.\r\n\r\nAh. So requests is not the only one with optional chardet dependency :)", "Indeed, nice catch! So we actually depend on `chardet` without even knowing it :sweat_smile: .", "I just upgraded from 2.25.1 to 2.26.0 and my logs now fill up with charset_normalizer lines, \r\nTons of them, I can fix it if I add explicit headers like `'Content-Type': 'application/scim+json; charset=utf-8'` to rest-apis and requests, but what about all the rest-apis out there without charset in characters, what is the workaround here.\r\nI really do not see any reason for chardet or charset_normalizer at all in requests, just crash if we fail to decode so we can fix it.\r\nit is just bloating the library, My initial tests also show that it is slower than previous version when using it with jwt tokens and base64 encoding. \r\n\r\nBelow is an excerp from a response from a keycloak(redhats OIDC OAUTH2 server) jwt token:\r\n```\r\n20211126154014.190|WARNING|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:104|override steps (5) and chunk_size (512) as content does not fit (192 byte(s) given) parameters.\r\n20211126154014.203|WARNING|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:104|override steps (5) and chunk_size (512) as content does not fit (192 byte(s) given) parameters.\r\n20211126154014.245|WARNING|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:104|override steps (5) and chunk_size (512) as content does not fit (316 byte(s) given) parameters.\r\n20211126154015.964|WARNING|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:104|override steps (5) and chunk_size (512) as content does not fit (3 byte(s) \r\ngiven) parameters.\r\n```", "Just install `chardet`. \r\n\r\nAnd yeah. I think requests maintainer want to remove both in the future.", "I also see performance degradation after moving from 2.25.1 to higher, this just bloats requests.\r\n\r\nwith `requests==2.27.1` I is now even worse, info in this module is like DEBUG.\r\n\r\nThis call resulting in this have the following header:\r\n```\r\n headers = {\r\n 'Accept': 'application/scim+json',\r\n 'Content-Type': 'application/scim+json; charset=utf-8',\r\n 'Authorization': f\"Bearer {access_token}\"\r\n }\r\n```\r\n\r\n```\r\n20220113145635.412|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:376|ascii passed initial chaos probing. Mean measured chaos is 0.000000 %\r\n20220113145635.415|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:430|ascii is most likely the one. Stopping the process.\r\n20220113145635.416|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:376|ascii passed initial chaos probing. Mean measured chaos is 0.000000 %\r\n20220113145635.417|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:430|ascii is most likely the one. Stopping the process.\r\n20220113145635.538|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:376|ascii passed initial chaos probing. Mean measured chaos is 0.000000 %\r\n20220113145635.541|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:430|ascii is most likely the one. Stopping the process.\r\n20220113145636.303|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:376|ascii passed initial chaos probing. Mean measured chaos is 0.000000 %\r\n20220113145636.304|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:430|ascii is most likely the one. Stopping the process.\r\n20220113145636.307|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:376|ascii passed initial chaos probing. Mean measured chaos is 0.000000 %\r\n20220113145636.308|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:430|ascii is most likely the one. Stopping the process.\r\n20220113145636.373|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:376|ascii passed initial chaos probing. Mean measured chaos is 0.000000 %\r\n20220113145636.373|INFO|C:\\dist\\venvs\\trk-fullstack-test\\lib\\site-packages\\charset_normalizer\\api.py:430|ascii is most likely the one. Stopping the process.\r\n```\r\n\r\nSo the first thing I do in my logging module is:\r\n```\r\nlogging.getLogger('charset_normalizer').disabled = True\r\n```\r\n", "@fenchu this isn't really relevant to this issue and alternatives to not use charset_normalizer have already been provided. There are also multiple ways to disable the use of character detection entirely. You've explicitly chosen the _one_ API that provides this feature. Reposting your grievance repeatedly isn't furthering the conversation here.\r\n\r\nSo to recap the thread for future readers:\r\n\r\n1. Yes, it should be optional. We want to remove character detection entirely. It doesn't belong in Requests. This won't happen until we major version bump.\r\n2. Installing `chardet` manually or using `requests[use_chardet_on_py3]` will have the exact same functionality in 2.27.1 as it did in 2.25.1.\r\n3. `content` and `iter_content` both expose the data returned by the response _without_ any attempted character encoding. If you don't think the character encoding is correct and don't want to use an auto-encoder, you can either manually encode the `content` bytes or [set the `encoding` attribute](https://github.com/psf/requests/blob/main/requests/models.py#L865-L867) on the Response before calling `.text`." ]
https://api.github.com/repos/psf/requests/issues/5870
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5870/labels{/name}
https://api.github.com/repos/psf/requests/issues/5870/comments
https://api.github.com/repos/psf/requests/issues/5870/events
https://github.com/psf/requests/issues/5870
943,477,971
MDU6SXNzdWU5NDM0Nzc5NzE=
5,870
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
{ "avatar_url": "https://avatars.githubusercontent.com/u/50236306?v=4", "events_url": "https://api.github.com/users/edikiuspro/events{/privacy}", "followers_url": "https://api.github.com/users/edikiuspro/followers", "following_url": "https://api.github.com/users/edikiuspro/following{/other_user}", "gists_url": "https://api.github.com/users/edikiuspro/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/edikiuspro", "id": 50236306, "login": "edikiuspro", "node_id": "MDQ6VXNlcjUwMjM2MzA2", "organizations_url": "https://api.github.com/users/edikiuspro/orgs", "received_events_url": "https://api.github.com/users/edikiuspro/received_events", "repos_url": "https://api.github.com/users/edikiuspro/repos", "site_admin": false, "starred_url": "https://api.github.com/users/edikiuspro/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/edikiuspro/subscriptions", "type": "User", "url": "https://api.github.com/users/edikiuspro", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-13T14:32:25Z
2021-10-11T16:00:28Z
2021-07-13T15:14:18Z
NONE
resolved
My code: import requests from bs4 import BeautifulSoup as BS s = requests.Session() s.verify=False auth_html=s.get(url='https://wnioski.mazowieckie.pl/MuwWsc/pl/') auth_bs=BS(auth_html.content,"html.parser") csrf=auth_bs.select("input[name=__RequestVerificationToken]")[0]['value'] print(csrf) Error code: Traceback (most recent call last): File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn conn.connect() File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connection.py", line 411, in connect self.sock = ssl_wrap_socket( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\util\ssl_.py", line 428, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\util\ssl_.py", line 472, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1040, in _create self.do_handshake() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() FileNotFoundError: [Errno 2] No such file or directory During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connectionpool.py", line 755, in urlopen retries = retries.increment( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\util\retry.py", line 531, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\packages\six.py", line 734, in reraise raise value.with_traceback(tb) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn conn.connect() File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connection.py", line 411, in connect self.sock = ssl_wrap_socket( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\util\ssl_.py", line 428, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\util\ssl_.py", line 472, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1040, in _create self.do_handshake() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Admin\OneDrive\parser.py", line 5, in <module> auth_html=s.get(url='https://wnioski.mazowieckie.pl/MuwWsc/pl/') File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\sessions.py", line 555, in get return self.request('GET', url, **kwargs) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5870/reactions" }
https://api.github.com/repos/psf/requests/issues/5870/timeline
null
completed
null
null
false
[ "Hi @edikiuspro, this is an issue with your Python installation. The standard library SSL module is throwing the `No such file or directory` error. We unfortunately can't provide assistance with that. We'd recommend posting on StackOverflow.com with any further debugging questions, as we try to reserve this tracker specifically for defects in Requests. Thanks!" ]
https://api.github.com/repos/psf/requests/issues/5869
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5869/labels{/name}
https://api.github.com/repos/psf/requests/issues/5869/comments
https://api.github.com/repos/psf/requests/issues/5869/events
https://github.com/psf/requests/pull/5869
941,754,612
MDExOlB1bGxSZXF1ZXN0Njg3NTgxMzYz
5,869
Stop abusing pytest-httpbin to test commonName support
{ "avatar_url": "https://avatars.githubusercontent.com/u/42327?v=4", "events_url": "https://api.github.com/users/pquentin/events{/privacy}", "followers_url": "https://api.github.com/users/pquentin/followers", "following_url": "https://api.github.com/users/pquentin/following{/other_user}", "gists_url": "https://api.github.com/users/pquentin/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pquentin", "id": 42327, "login": "pquentin", "node_id": "MDQ6VXNlcjQyMzI3", "organizations_url": "https://api.github.com/users/pquentin/orgs", "received_events_url": "https://api.github.com/users/pquentin/received_events", "repos_url": "https://api.github.com/users/pquentin/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pquentin/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pquentin/subscriptions", "type": "User", "url": "https://api.github.com/users/pquentin", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-12T07:24:18Z
2021-10-11T07:00:32Z
2021-07-12T14:44:44Z
CONTRIBUTOR
resolved
pytest-httpbin<1.0 ships with a server certificate with a commonName but no subjectAltName. urllib3 2.0 will stop supporting those in the future, so we want to upgrade pytest-httpbin. Unfortunately, `test_https_warnings` was relying on this broken certificate. With this change, we use `trustme` to create a broken certificate specifically for this test, so that we can upgrade pytest-httpbin and make sure that other tests relying on httpbin TLS support will continue to work with urllib3 2.0. Closes #5530
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5869/reactions" }
https://api.github.com/repos/psf/requests/issues/5869/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5869.diff", "html_url": "https://github.com/psf/requests/pull/5869", "merged_at": "2021-07-12T14:44:43Z", "patch_url": "https://github.com/psf/requests/pull/5869.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5869" }
true
[ "You can see the tests passing in my fork: https://github.com/pquentin/requests/actions/runs/1021954813" ]
https://api.github.com/repos/psf/requests/issues/5868
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5868/labels{/name}
https://api.github.com/repos/psf/requests/issues/5868/comments
https://api.github.com/repos/psf/requests/issues/5868/events
https://github.com/psf/requests/pull/5868
941,023,478
MDExOlB1bGxSZXF1ZXN0Njg3MDAzOTI3
5,868
v2.26.0
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-09T19:45:56Z
2021-10-11T15:00:34Z
2021-07-13T14:52:02Z
MEMBER
resolved
2.26.0 (2021-07-13) ------------------- **Improvements** - Requests now supports Brotli compression, if either the `brotli` or `brotlicffi` package is installed. (#5783) - `Session.send` now correctly resolves proxy configurations from both the Session and Request. Behavior now matches `Session.request`. (#5681) **Bugfixes** - Fixed a race condition in zip extraction when using Requests in parallel from zip archive. (#5707) **Dependencies** - Instead of `chardet`, use the MIT-licensed `charset_normalizer` for Python3 to remove license ambiguity for projects bundling requests. If `chardet` is already installed on your machine it will be used instead of `charset_normalizer` to keep backwards compatibility. (#5797) You can also install `chardet` while installing requests by specifying `[use_chardet_on_py3]` extra as follows: ```shell pip install "requests[use_chardet_on_py3]" ``` Note that installation of `chardet` in your environment through any means will disable use of `charset_normalizer`. Python 2.7 still depends upon the `chardet` module. - Requests now supports `idna` 3.x on Python 3. `idna` 2.x will continue to be used on Python 2 installations. (#5711) **Deprecations** - The `requests[security]` extra has been converted to a no-op install. PyOpenSSL is no longer the recommended secure option for Requests. (#5867) - Requests has officially dropped support for Python 3.5. (#5867)
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 2, "-1": 0, "confused": 0, "eyes": 1, "heart": 1, "hooray": 0, "laugh": 0, "rocket": 1, "total_count": 5, "url": "https://api.github.com/repos/psf/requests/issues/5868/reactions" }
https://api.github.com/repos/psf/requests/issues/5868/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5868.diff", "html_url": "https://github.com/psf/requests/pull/5868", "merged_at": "2021-07-13T14:52:02Z", "patch_url": "https://github.com/psf/requests/pull/5868.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5868" }
true
[ "Yep, great call out. I'll get that added." ]
https://api.github.com/repos/psf/requests/issues/5867
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5867/labels{/name}
https://api.github.com/repos/psf/requests/issues/5867/comments
https://api.github.com/repos/psf/requests/issues/5867/events
https://github.com/psf/requests/pull/5867
941,004,437
MDExOlB1bGxSZXF1ZXN0Njg2OTg3OTA4
5,867
Disable requests[security] and remove 3.5 support references
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-07-09T19:09:52Z
2021-10-07T20:00:26Z
2021-07-09T19:40:55Z
MEMBER
resolved
## requests[security] This PR will remove functionality from the `requests[security]` extra. We initially removed default support for PyOpenSSL in Requests 2.24.0 (#5443) as it is now considered less secure. Deprecation of the `extras_require` was announced in [Requests 2.25.0](https://github.com/psf/requests/blob/master/HISTORY.md#2250-2020-11-11) and we're officially removing the `extras_require` functionality in Requests 2.26.0. Projects currently using `requests[security]` after this change will continue to operate as if performing a standard requests installation (secure by default). While not recommended, if PyOpenSSL support is still a requirement in your project, you may install `urllib3[secure]` and add `urllib3.contrib.pyopenssl.inject_into_urllib3()` to your code to re-enable the functionality. ## Python 3.5 Support We will also be removing support for Python 3.5 in Requests 2.26.0 as announced in the [2.25.0 release notes](https://github.com/psf/requests/blob/master/HISTORY.md#2250-2020-11-11).
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5867/reactions" }
https://api.github.com/repos/psf/requests/issues/5867/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5867.diff", "html_url": "https://github.com/psf/requests/pull/5867", "merged_at": "2021-07-09T19:40:55Z", "patch_url": "https://github.com/psf/requests/pull/5867.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5867" }
true
[]
https://api.github.com/repos/psf/requests/issues/5866
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5866/labels{/name}
https://api.github.com/repos/psf/requests/issues/5866/comments
https://api.github.com/repos/psf/requests/issues/5866/events
https://github.com/psf/requests/issues/5866
940,846,161
MDU6SXNzdWU5NDA4NDYxNjE=
5,866
Request to link-local IPv6 address of service not listening for IPv6 tries all network interfaces, fails five times for each
{ "avatar_url": "https://avatars.githubusercontent.com/u/87194087?v=4", "events_url": "https://api.github.com/users/origin400-p/events{/privacy}", "followers_url": "https://api.github.com/users/origin400-p/followers", "following_url": "https://api.github.com/users/origin400-p/following{/other_user}", "gists_url": "https://api.github.com/users/origin400-p/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/origin400-p", "id": 87194087, "login": "origin400-p", "node_id": "MDQ6VXNlcjg3MTk0MDg3", "organizations_url": "https://api.github.com/users/origin400-p/orgs", "received_events_url": "https://api.github.com/users/origin400-p/received_events", "repos_url": "https://api.github.com/users/origin400-p/repos", "site_admin": false, "starred_url": "https://api.github.com/users/origin400-p/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/origin400-p/subscriptions", "type": "User", "url": "https://api.github.com/users/origin400-p", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-09T15:04:53Z
2021-10-11T12:00:21Z
2021-07-13T11:25:36Z
NONE
resolved
Summary. ## Expected Result Something more like what cURL does, trying the primary/first interface in the list, failing, then reverting to IPv4. ## Actual Result Requests tries each networking interface shown by the Windows ipconfig command (three in my case) on the link-local IPv6 address. Since the service in question isn't listening for IPv6, the TCP connection fails, and Requests tries again four more times before moving on to the next interface's link-local IPv6 address, which proceeds the same. Each interface takes about 2 seconds to get through this, taking six seconds in total before falling back to IPv4, which succeeds. ## Reproduction Steps ```python import requests r =requests.get('http://hostname-with-link-local-IPv6-address:8001/') ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.8.1" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "1010104f" }, "urllib3": { "version": "1.26.6" }, "using_pyopenssl": false } ``` This is using Python 3.8.1 on Windows 10 x64 Version 21H1 (OS Build 19043.1052). Running ipconfig shows three interfaces: one Ethernet, and two VMware Network Adapters. The following Wireshark transcript (with anonymized link-local addresses and port number; 8001 is not the actual port I'm using) shows the three sets of failed IPv6 sessions and eventual fallback to IPv4. ``` 1 0.000000 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 76 55447 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 2 0.000017 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 64 8001 → 55447 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 3 0.504934 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 76 [TCP Retransmission] 55447 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 4 0.504960 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 64 8001 → 55447 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 5 1.016384 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 76 [TCP Retransmission] 55447 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 6 1.016426 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 64 8001 → 55447 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 7 1.525929 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 76 [TCP Retransmission] 55447 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 8 1.525955 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 64 8001 → 55447 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 9 2.035264 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 76 [TCP Retransmission] 55447 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 10 2.035294 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 64 8001 → 55447 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 11 2.035705 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 76 55454 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 12 2.035717 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 64 8001 → 55454 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 13 2.541853 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 76 [TCP Retransmission] 55454 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 14 2.541872 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 64 8001 → 55454 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 15 3.049899 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 76 [TCP Retransmission] 55454 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 16 3.049927 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 64 8001 → 55454 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 17 3.562027 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 76 [TCP Retransmission] 55454 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 18 3.562048 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 64 8001 → 55454 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 19 4.071151 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 76 [TCP Retransmission] 55454 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 20 4.071187 2001:db8::8a2e:370:7335 2001:db8::8a2e:370:7335 TCP 64 8001 → 55454 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 21 4.071510 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 76 55456 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 22 4.071522 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 64 8001 → 55456 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 23 4.584244 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 76 [TCP Retransmission] 55456 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 24 4.584271 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 64 8001 → 55456 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 25 5.094989 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 76 [TCP Retransmission] 55456 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 26 5.095010 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 64 8001 → 55456 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 27 5.604492 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 76 [TCP Retransmission] 55456 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 28 5.604510 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 64 8001 → 55456 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 29 6.113265 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 76 [TCP Retransmission] 55456 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 30 6.113289 2001:db8::8a2e:370:7336 2001:db8::8a2e:370:7336 TCP 64 8001 → 55456 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 31 6.113658 172.16.254.1 172.16.254.1 TCP 56 55457 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65495 WS=256 SACK_PERM=1 32 6.113710 172.16.254.1 172.16.254.1 TCP 56 8001 → 55457 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=65495 WS=256 SACK_PERM=1 33 6.113771 172.16.254.1 172.16.254.1 TCP 44 55457 → 8001 [ACK] Seq=1 Ack=1 Win=2619648 Len=0 34 6.113800 172.16.254.1 172.16.254.1 HTTP 207 GET / HTTP/1.1 35 6.113825 172.16.254.1 172.16.254.1 TCP 44 8001 → 55457 [ACK] Seq=1 Ack=164 Win=2619648 Len=0 36 6.122350 172.16.254.1 172.16.254.1 TCP 203 8001 → 55457 [PSH, ACK] Seq=1 Ack=164 Win=2619648 Len=159 [TCP segment of a reassembled PDU] 37 6.122374 172.16.254.1 172.16.254.1 TCP 44 55457 → 8001 [ACK] Seq=164 Ack=160 Win=2619392 Len=0 38 6.122415 172.16.254.1 172.16.254.1 HTTP 67 HTTP/1.1 200 OK (text/html) 39 6.122425 172.16.254.1 172.16.254.1 TCP 44 55457 → 8001 [ACK] Seq=164 Ack=183 Win=2619392 Len=0 40 6.123083 172.16.254.1 172.16.254.1 TCP 44 55457 → 8001 [FIN, ACK] Seq=164 Ack=183 Win=2619392 Len=0 41 6.123103 172.16.254.1 172.16.254.1 TCP 44 8001 → 55457 [ACK] Seq=183 Ack=165 Win=2619648 Len=0 42 6.128661 172.16.254.1 172.16.254.1 TCP 44 8001 → 55457 [FIN, ACK] Seq=183 Ack=165 Win=2619648 Len=0 43 6.128714 172.16.254.1 172.16.254.1 TCP 44 55457 → 8001 [ACK] Seq=165 Ack=184 Win=2619392 Len=0 ``` In contrast, cURL tries only the Ethernet interface, fails once, and rapidly falls back to IPv4. ``` 1 0.000000 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 76 56252 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65475 WS=256 SACK_PERM=1 2 0.000015 2001:db8::8a2e:370:7334 2001:db8::8a2e:370:7334 TCP 64 8001 → 56252 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 3 0.211071 10.1.211.231 10.1.211.231 TCP 56 56253 → 8001 [SYN] Seq=0 Win=65535 Len=0 MSS=65495 WS=256 SACK_PERM=1 4 0.211142 10.1.211.231 10.1.211.231 TCP 56 8001 → 56253 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=65495 WS=256 SACK_PERM=1 5 0.211183 10.1.211.231 10.1.211.231 TCP 44 56253 → 8001 [ACK] Seq=1 Ack=1 Win=2619648 Len=0 6 0.211364 10.1.211.231 10.1.211.231 HTTP 140 GET / HTTP/1.1 7 0.211387 10.1.211.231 10.1.211.231 TCP 44 8001 → 56253 [ACK] Seq=1 Ack=97 Win=2619648 Len=0 8 0.218706 172.16.254.1 10.1.211.231 TCP 203 8001 → 56253 [PSH, ACK] Seq=1 Ack=97 Win=2619648 Len=159 [TCP segment of a reassembled PDU] 9 0.218733 10.1.211.231 10.1.211.231 TCP 44 56253 → 8001 [ACK] Seq=97 Ack=160 Win=2619392 Len=0 10 0.218777 10.1.211.231 10.1.211.231 HTTP 67 HTTP/1.1 200 OK (text/html) 11 0.218789 10.1.211.231 10.1.211.231 TCP 44 56253 → 8001 [ACK] Seq=97 Ack=183 Win=2619392 Len=0 12 0.219077 10.1.211.231 10.1.211.231 TCP 44 56253 → 8001 [FIN, ACK] Seq=97 Ack=183 Win=2619392 Len=0 13 0.219096 10.1.211.231 10.1.211.231 TCP 44 8001 → 56253 [ACK] Seq=183 Ack=98 Win=2619648 Len=0 14 0.226608 10.1.211.231 10.1.211.231 TCP 44 8001 → 56253 [FIN, ACK] Seq=183 Ack=98 Win=2619648 Len=0 15 0.226679 10.1.211.231 10.1.211.231 TCP 44 56253 → 8001 [ACK] Seq=98 Ack=184 Win=2619392 Len=0 ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/87194087?v=4", "events_url": "https://api.github.com/users/origin400-p/events{/privacy}", "followers_url": "https://api.github.com/users/origin400-p/followers", "following_url": "https://api.github.com/users/origin400-p/following{/other_user}", "gists_url": "https://api.github.com/users/origin400-p/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/origin400-p", "id": 87194087, "login": "origin400-p", "node_id": "MDQ6VXNlcjg3MTk0MDg3", "organizations_url": "https://api.github.com/users/origin400-p/orgs", "received_events_url": "https://api.github.com/users/origin400-p/received_events", "repos_url": "https://api.github.com/users/origin400-p/repos", "site_admin": false, "starred_url": "https://api.github.com/users/origin400-p/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/origin400-p/subscriptions", "type": "User", "url": "https://api.github.com/users/origin400-p", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5866/reactions" }
https://api.github.com/repos/psf/requests/issues/5866/timeline
null
completed
null
null
false
[ "This isn't a bug in requests, it also happens using other methods so it's a bug somewhere in Python itself, at least on Windows." ]
https://api.github.com/repos/psf/requests/issues/5865
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5865/labels{/name}
https://api.github.com/repos/psf/requests/issues/5865/comments
https://api.github.com/repos/psf/requests/issues/5865/events
https://github.com/psf/requests/issues/5865
940,629,364
MDU6SXNzdWU5NDA2MjkzNjQ=
5,865
How to set requests to use ipv4 by default?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1451096?v=4", "events_url": "https://api.github.com/users/demonguy/events{/privacy}", "followers_url": "https://api.github.com/users/demonguy/followers", "following_url": "https://api.github.com/users/demonguy/following{/other_user}", "gists_url": "https://api.github.com/users/demonguy/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/demonguy", "id": 1451096, "login": "demonguy", "node_id": "MDQ6VXNlcjE0NTEwOTY=", "organizations_url": "https://api.github.com/users/demonguy/orgs", "received_events_url": "https://api.github.com/users/demonguy/received_events", "repos_url": "https://api.github.com/users/demonguy/repos", "site_admin": false, "starred_url": "https://api.github.com/users/demonguy/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/demonguy/subscriptions", "type": "User", "url": "https://api.github.com/users/demonguy", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-09T10:20:25Z
2021-10-08T19:00:27Z
2021-07-10T19:00:08Z
NONE
resolved
When i tried to use `requests.get("www.google.com")` and it hangs for 3 minutes and then succeed. after debug i found it connect to ipv6 address first and then tries to ipv4. So far i use `timeout=3` to force ipv6 try to timeout ASAP. but it's tricky. is there anyway to make it use ipv4 by default?
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5865/reactions" }
https://api.github.com/repos/psf/requests/issues/5865/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5864
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5864/labels{/name}
https://api.github.com/repos/psf/requests/issues/5864/comments
https://api.github.com/repos/psf/requests/issues/5864/events
https://github.com/psf/requests/pull/5864
940,160,126
MDExOlB1bGxSZXF1ZXN0Njg2MjczMzM3
5,864
More Options To Run Example Code
{ "avatar_url": "https://avatars.githubusercontent.com/u/61983321?v=4", "events_url": "https://api.github.com/users/jameskaggwa/events{/privacy}", "followers_url": "https://api.github.com/users/jameskaggwa/followers", "following_url": "https://api.github.com/users/jameskaggwa/following{/other_user}", "gists_url": "https://api.github.com/users/jameskaggwa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jameskaggwa", "id": 61983321, "login": "jameskaggwa", "node_id": "MDQ6VXNlcjYxOTgzMzIx", "organizations_url": "https://api.github.com/users/jameskaggwa/orgs", "received_events_url": "https://api.github.com/users/jameskaggwa/received_events", "repos_url": "https://api.github.com/users/jameskaggwa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jameskaggwa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jameskaggwa/subscriptions", "type": "User", "url": "https://api.github.com/users/jameskaggwa", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-08T19:34:17Z
2021-10-07T18:00:30Z
2021-07-09T17:51:38Z
NONE
resolved
#### Making the example code sample available as a copy and paste and then run in any exiting python file.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5864/reactions" }
https://api.github.com/repos/psf/requests/issues/5864/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5864.diff", "html_url": "https://github.com/psf/requests/pull/5864", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5864.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5864" }
true
[ "Hi @jameskaggwa, thanks for contributing to Requests! Unfortunately, I don't think we'll accept this PR at this time. We expect a basic level of Python knowledge with the docs, so understanding writing code in a file vs in the interpreter is assumed. Otherwise, the docs become significantly bloated and more difficult to find relevant information." ]
https://api.github.com/repos/psf/requests/issues/5863
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5863/labels{/name}
https://api.github.com/repos/psf/requests/issues/5863/comments
https://api.github.com/repos/psf/requests/issues/5863/events
https://github.com/psf/requests/issues/5863
940,045,305
MDU6SXNzdWU5NDAwNDUzMDU=
5,863
Empty space when using GET
{ "avatar_url": "https://avatars.githubusercontent.com/u/59108437?v=4", "events_url": "https://api.github.com/users/Aethese/events{/privacy}", "followers_url": "https://api.github.com/users/Aethese/followers", "following_url": "https://api.github.com/users/Aethese/following{/other_user}", "gists_url": "https://api.github.com/users/Aethese/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Aethese", "id": 59108437, "login": "Aethese", "node_id": "MDQ6VXNlcjU5MTA4NDM3", "organizations_url": "https://api.github.com/users/Aethese/orgs", "received_events_url": "https://api.github.com/users/Aethese/received_events", "repos_url": "https://api.github.com/users/Aethese/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Aethese/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Aethese/subscriptions", "type": "User", "url": "https://api.github.com/users/Aethese", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-08T16:48:09Z
2021-10-06T19:00:27Z
2021-07-08T18:18:44Z
NONE
resolved
I am trying to use GET to get current code for a project of mine to have an auto update system, but whenever I GET the latest latest code (raw github file) it adds blank lines in between lines of code, for example: ``` def clear(): os.system('cls' if os.name =='nt' else 'clear') clear() ``` It is adding unnecessary lines in between everything when their is none in the code. My code is: ``` import requests, time ask = input('Would you like to update to the latest version of Switchence? ') if ask == 'y' or ask == 'yes': print('Ok, updating...') try: onlineVersion = requests.get('https://raw.githubusercontent.com/Aethese/Switchence/main/main.py') if onlineVersion.status_code != 200: print(f'[ERROR] status code is not 200, it is {onlineVersion.status_code}') time.sleep(5) else: onlineVersion = onlineVersion.text with open('autoupdate.py', 'w') as file: file.write(onlineVersion) print('Successfully updated to latest version! Rerun the program to use the newest version!') time.sleep(5) except Exception as error: print(f'Couldn\'t get latest latest update | {error}') time.sleep(5) elif ask == 'n' or ask == 'no': print('Ok, you will not update to the latest version') time.sleep(5) else: print('The only acceptable answers are Yes or No') time.sleep(5) ``` Can someone help me or explain to me why my code won't work? I am running latest pip version of requests.
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5863/reactions" }
https://api.github.com/repos/psf/requests/issues/5863/timeline
null
completed
null
null
false
[ "This question is likely more suited for StackOverflow as there probably isn't a defect in Requests causing your issue. Please reserve this issue tracker for defects in Requests." ]
https://api.github.com/repos/psf/requests/issues/5861
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5861/labels{/name}
https://api.github.com/repos/psf/requests/issues/5861/comments
https://api.github.com/repos/psf/requests/issues/5861/events
https://github.com/psf/requests/issues/5861
939,668,280
MDU6SXNzdWU5Mzk2NjgyODA=
5,861
http redirection found that the authentication is missing
{ "avatar_url": "https://avatars.githubusercontent.com/u/14362799?v=4", "events_url": "https://api.github.com/users/Hanfee/events{/privacy}", "followers_url": "https://api.github.com/users/Hanfee/followers", "following_url": "https://api.github.com/users/Hanfee/following{/other_user}", "gists_url": "https://api.github.com/users/Hanfee/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Hanfee", "id": 14362799, "login": "Hanfee", "node_id": "MDQ6VXNlcjE0MzYyNzk5", "organizations_url": "https://api.github.com/users/Hanfee/orgs", "received_events_url": "https://api.github.com/users/Hanfee/received_events", "repos_url": "https://api.github.com/users/Hanfee/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Hanfee/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Hanfee/subscriptions", "type": "User", "url": "https://api.github.com/users/Hanfee", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-08T09:37:07Z
2021-10-06T11:00:22Z
2021-07-08T10:55:22Z
NONE
resolved
Summary. I find a problem , if http is redirected . auth is missing ```python if 'Authorization' in headers and self.should_strip_auth(response.request.url, url): # If we get redirected to a new host, we should strip out any # authentication headers. del headers['Authorization'] ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5861/reactions" }
https://api.github.com/repos/psf/requests/issues/5861/timeline
null
completed
null
null
false
[ "Yes that's on purpose. You can find the reasoning why in our documentation and in our issue tracker" ]
https://api.github.com/repos/psf/requests/issues/5860
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5860/labels{/name}
https://api.github.com/repos/psf/requests/issues/5860/comments
https://api.github.com/repos/psf/requests/issues/5860/events
https://github.com/psf/requests/pull/5860
938,529,554
MDExOlB1bGxSZXF1ZXN0Njg0ODk4MTcw
5,860
Document de-duplication of keys for params and data
{ "avatar_url": "https://avatars.githubusercontent.com/u/5687998?v=4", "events_url": "https://api.github.com/users/verhovsky/events{/privacy}", "followers_url": "https://api.github.com/users/verhovsky/followers", "following_url": "https://api.github.com/users/verhovsky/following{/other_user}", "gists_url": "https://api.github.com/users/verhovsky/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/verhovsky", "id": 5687998, "login": "verhovsky", "node_id": "MDQ6VXNlcjU2ODc5OTg=", "organizations_url": "https://api.github.com/users/verhovsky/orgs", "received_events_url": "https://api.github.com/users/verhovsky/received_events", "repos_url": "https://api.github.com/users/verhovsky/repos", "site_admin": false, "starred_url": "https://api.github.com/users/verhovsky/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/verhovsky/subscriptions", "type": "User", "url": "https://api.github.com/users/verhovsky", "user_view_type": "public" }
[]
open
false
null
[]
null
0
2021-07-07T06:17:40Z
2022-06-11T06:26:05Z
null
CONTRIBUTOR
null
and format the files dict format correctly
null
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5860/reactions" }
https://api.github.com/repos/psf/requests/issues/5860/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5860.diff", "html_url": "https://github.com/psf/requests/pull/5860", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5860.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5860" }
true
[]
https://api.github.com/repos/psf/requests/issues/5859
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5859/labels{/name}
https://api.github.com/repos/psf/requests/issues/5859/comments
https://api.github.com/repos/psf/requests/issues/5859/events
https://github.com/psf/requests/pull/5859
938,219,180
MDExOlB1bGxSZXF1ZXN0Njg0NjQ0NDIw
5,859
✅ Fix the tests suite on master by pinning Flask
{ "avatar_url": "https://avatars.githubusercontent.com/u/9326700?v=4", "events_url": "https://api.github.com/users/Ousret/events{/privacy}", "followers_url": "https://api.github.com/users/Ousret/followers", "following_url": "https://api.github.com/users/Ousret/following{/other_user}", "gists_url": "https://api.github.com/users/Ousret/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Ousret", "id": 9326700, "login": "Ousret", "node_id": "MDQ6VXNlcjkzMjY3MDA=", "organizations_url": "https://api.github.com/users/Ousret/orgs", "received_events_url": "https://api.github.com/users/Ousret/received_events", "repos_url": "https://api.github.com/users/Ousret/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Ousret/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Ousret/subscriptions", "type": "User", "url": "https://api.github.com/users/Ousret", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-07-06T20:04:55Z
2021-10-04T21:00:28Z
2021-07-06T20:39:50Z
CONTRIBUTOR
resolved
httpbin does not limit Flask version. Latest 2.0 brings BC-break on the tests suite. This is a temporary fix. Waiting upon further investigation.
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5859/reactions" }
https://api.github.com/repos/psf/requests/issues/5859/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5859.diff", "html_url": "https://github.com/psf/requests/pull/5859", "merged_at": "2021-07-06T20:39:50Z", "patch_url": "https://github.com/psf/requests/pull/5859.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5859" }
true
[]
https://api.github.com/repos/psf/requests/issues/5858
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5858/labels{/name}
https://api.github.com/repos/psf/requests/issues/5858/comments
https://api.github.com/repos/psf/requests/issues/5858/events
https://github.com/psf/requests/pull/5858
938,165,348
MDExOlB1bGxSZXF1ZXN0Njg0NTk5MTU3
5,858
<removed>
{ "avatar_url": "https://avatars.githubusercontent.com/u/59779640?v=4", "events_url": "https://api.github.com/users/thiago1993/events{/privacy}", "followers_url": "https://api.github.com/users/thiago1993/followers", "following_url": "https://api.github.com/users/thiago1993/following{/other_user}", "gists_url": "https://api.github.com/users/thiago1993/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/thiago1993", "id": 59779640, "login": "thiago1993", "node_id": "MDQ6VXNlcjU5Nzc5NjQw", "organizations_url": "https://api.github.com/users/thiago1993/orgs", "received_events_url": "https://api.github.com/users/thiago1993/received_events", "repos_url": "https://api.github.com/users/thiago1993/repos", "site_admin": false, "starred_url": "https://api.github.com/users/thiago1993/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/thiago1993/subscriptions", "type": "User", "url": "https://api.github.com/users/thiago1993", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-07-06T18:45:34Z
2021-07-06T18:55:52Z
2021-07-06T18:55:37Z
NONE
spam
POP
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5858/reactions" }
https://api.github.com/repos/psf/requests/issues/5858/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5858.diff", "html_url": "https://github.com/psf/requests/pull/5858", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5858.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5858" }
true
[]
https://api.github.com/repos/psf/requests/issues/5857
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5857/labels{/name}
https://api.github.com/repos/psf/requests/issues/5857/comments
https://api.github.com/repos/psf/requests/issues/5857/events
https://github.com/psf/requests/pull/5857
936,836,671
MDExOlB1bGxSZXF1ZXN0NjgzNDg0NzIw
5,857
Fix calling get_connection() with a positional argument when it is optional
{ "avatar_url": "https://avatars.githubusercontent.com/u/2033598?v=4", "events_url": "https://api.github.com/users/BoboTiG/events{/privacy}", "followers_url": "https://api.github.com/users/BoboTiG/followers", "following_url": "https://api.github.com/users/BoboTiG/following{/other_user}", "gists_url": "https://api.github.com/users/BoboTiG/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/BoboTiG", "id": 2033598, "login": "BoboTiG", "node_id": "MDQ6VXNlcjIwMzM1OTg=", "organizations_url": "https://api.github.com/users/BoboTiG/orgs", "received_events_url": "https://api.github.com/users/BoboTiG/received_events", "repos_url": "https://api.github.com/users/BoboTiG/repos", "site_admin": false, "starred_url": "https://api.github.com/users/BoboTiG/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/BoboTiG/subscriptions", "type": "User", "url": "https://api.github.com/users/BoboTiG", "user_view_type": "public" }
[]
closed
true
null
[]
null
5
2021-07-05T08:32:16Z
2021-10-05T08:00:35Z
2021-07-06T11:33:30Z
CONTRIBUTOR
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5857/reactions" }
https://api.github.com/repos/psf/requests/issues/5857/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5857.diff", "html_url": "https://github.com/psf/requests/pull/5857", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5857.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5857" }
true
[ "This says it's fixing something, but it's not strictly necessary and there's no context for why you feel this to be necessary. Can you elaborate?", "Oh sorry for the lack of details, it seems I closed my computer without having filled the description...\r\n\r\nI subclassed the `HTTPAdapter` class, here is the revelant code: https://github.com/httpie/httpie-snapdsocket/blob/aa0d58beca2475b461ba9eac420fff5583e67bed/httpie_snapdsocket.py#L21\r\nIt works like a charm.\r\n\r\nBut then, I wanted to replace \r\n```python\r\ndef get_connection(self, url, proxies=None):\r\n # ...\r\n return super().get_connection(url, proxies=proxies)\r\n```\r\nwith \r\n```python\r\ndef get_connection(self, url, **kwargs):\r\n # ...\r\n return super().get_connection(url, **kwargs)\r\n```\r\nTo be resilient to future API updates on the `requests` side.\r\n\r\nIt will not work:\r\n```python\r\nTraceback (most recent call last):\r\n File \"httpie-snapdsocket/tests.py\", line 17, in test_simple\r\n res = session.get('snapd:///v2/find?name=' + package).json()\r\n File \".../site-packages/requests/sessions.py\", line 555, in get\r\n return self.request('GET', url, **kwargs)\r\n File \".../requests/sessions.py\", line 542, in request\r\n resp = self.send(prep, **send_kwargs)\r\n File \".../site-packages/requests/sessions.py\", line 655, in send\r\n r = adapter.send(request, **kwargs)\r\n File \".../site-packages/requests/adapters.py\", line 412, in send\r\n conn = self.get_connection(request.url, proxies)\r\nTypeError: get_connection() takes 2 positional arguments but 3 were given\r\n```\r\n\r\nI can live with it though.", "> ```python\r\n> def get_connection(self, url, **kwargs):\r\n> # ...\r\n> return super().get_connection(url, **kwargs)\r\n> ```\r\n\r\nWhy not\r\n\r\n```python\r\ndef get_connection(self, url, proxies=None, **kwargs):\r\n # ...\r\n kwargs.setdefault(\"proxies\", proxies)\r\n return super().get_connection(url, **kwargs)\r\n```\r\n\r\nThat achieves what you want without making a unnecessary change here", "The goal was to not care about `kwargs` at all. So that when/if the `get_connection()` signature changes, my code will still work.", "It's incredibly unlikely to change" ]
https://api.github.com/repos/psf/requests/issues/5856
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5856/labels{/name}
https://api.github.com/repos/psf/requests/issues/5856/comments
https://api.github.com/repos/psf/requests/issues/5856/events
https://github.com/psf/requests/pull/5856
936,327,390
MDExOlB1bGxSZXF1ZXN0NjgzMDc4MDU4
5,856
Fix inconsistent exception type in response.json() method
{ "avatar_url": "https://avatars.githubusercontent.com/u/86739818?v=4", "events_url": "https://api.github.com/users/steveberdy/events{/privacy}", "followers_url": "https://api.github.com/users/steveberdy/followers", "following_url": "https://api.github.com/users/steveberdy/following{/other_user}", "gists_url": "https://api.github.com/users/steveberdy/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/steveberdy", "id": 86739818, "login": "steveberdy", "node_id": "MDQ6VXNlcjg2NzM5ODE4", "organizations_url": "https://api.github.com/users/steveberdy/orgs", "received_events_url": "https://api.github.com/users/steveberdy/received_events", "repos_url": "https://api.github.com/users/steveberdy/repos", "site_admin": false, "starred_url": "https://api.github.com/users/steveberdy/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/steveberdy/subscriptions", "type": "User", "url": "https://api.github.com/users/steveberdy", "user_view_type": "public" }
[]
closed
true
null
[]
{ "closed_at": "2021-12-30T21:48:07Z", "closed_issues": 11, "created_at": "2021-09-02T07:23:33Z", "creator": { "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }, "description": "", "due_on": null, "html_url": "https://github.com/psf/requests/milestone/29", "id": 7115399, "labels_url": "https://api.github.com/repos/psf/requests/milestones/29/labels", "node_id": "MI_kwDOABTKOs4AbJKH", "number": 29, "open_issues": 0, "state": "closed", "title": "2.27.0", "updated_at": "2021-12-30T21:48:07Z", "url": "https://api.github.com/repos/psf/requests/milestones/29" }
8
2021-07-03T21:08:32Z
2021-12-01T08:00:28Z
2021-07-26T15:56:44Z
CONTRIBUTOR
resolved
## Summary Fixes the inconsistency of errors thrown in the `response.json()` method in `models.py`, while preserving backwards compatibility. ### What we used to have Depending on whether or not `simplejson` was installed in the user's library, and whether the user was running Python 3+ versus Python 2, a different exception would get thrown when there was an issue with decoding response text as JSON. If `simplejson` was installed, `simplejson.JSONDecodeError` would get thrown. If not, `json.JSONDecodeError` would get thrown for Python 3+ users, and `ValueError` for Python 2 users. Thus, depending on the scenario, users would find themselves having to catch either `simplejson.JSONDecodeError`, `json.JSONDecodeError`, or `ValueError` in the case of the `response.json()` method failing. This inconsistency is not ideal. ### What we have now There is now one error class in `exceptions.py` that will represent all errors that can be thrown or caught in the `response.json()` method: `requests.JSONDecodeError`. All `simplejson` functionality was replaced with `json` functionality, but the new error type aliases both `json.JSONDecodeError` and `simplejson.JSONDecodeError`. If `simplejson` is not installed, its `JSONDecodError` is replaced with a plain `Exception` when aliased. If the user is running Python 3+, `json.JSONDecodeError` is aliased, but if the user is running Python 2, that is replaced with `ValueError` when aliased, as the `JSONDecodeError` was not previously a part of the `json` library. Now, all five error types, `json.JSONDecodeError`, `simplejson.JSONDecodeError`, `ValueError`, and `requests.JSONDecodeError` and its parent class `requests.RequestException`, will be caught from the `requests.JSONDecodeError` that will be raised. Fixes #5794 @sigmavirus24
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5856/reactions" }
https://api.github.com/repos/psf/requests/issues/5856/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5856.diff", "html_url": "https://github.com/psf/requests/pull/5856", "merged_at": "2021-07-26T15:56:44Z", "patch_url": "https://github.com/psf/requests/pull/5856.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5856" }
true
[ "Same issues with Python 2 again. Is that normal?", "@steveberdy Please refer to my previous comments in the code review. Your current approach isn't going to work in Python 2. I'd recommend using your exception resolution in compat.py to handle this. I think there are also some outstanding comments that are still unresolved.", "@sigmavirus24 @nateprewitt I made the necessary edits to fix workflow failures. Any feedback on Python 2 compatibility before running the workflows again? Thanks.", "Hi @steveberdy, I'd recommend setting up a testing environment locally with our tox script and something like `pyenv` to manage Python versions. If you're having difficulty with that, you can test changes yourself on another branch using Github actions in your own repository. That will help expedite your testing cycle and avoid needing to ping this thread every time a change is made.", "@nateprewitt Thank you for the advice. I ran the workflows, and all tests passed: https://github.com/steveberdy/requests/actions/runs/1023889042", "Is this ready to merge?", "Let's just commit to the next release being 2.27.0. Heck we can push that out whenever and if we can get the proxy stuff merged too (once it's in a good state) then I think we can cut 2.27 with just these two \"features\"", "Alright, sounds like a plan to me. Thanks again, @steveberdy." ]
https://api.github.com/repos/psf/requests/issues/5855
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5855/labels{/name}
https://api.github.com/repos/psf/requests/issues/5855/comments
https://api.github.com/repos/psf/requests/issues/5855/events
https://github.com/psf/requests/issues/5855
935,297,900
MDU6SXNzdWU5MzUyOTc5MDA=
5,855
proxy URLs without schemes break under Python 3.9
{ "avatar_url": "https://avatars.githubusercontent.com/u/46406?v=4", "events_url": "https://api.github.com/users/leifwalsh/events{/privacy}", "followers_url": "https://api.github.com/users/leifwalsh/followers", "following_url": "https://api.github.com/users/leifwalsh/following{/other_user}", "gists_url": "https://api.github.com/users/leifwalsh/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/leifwalsh", "id": 46406, "login": "leifwalsh", "node_id": "MDQ6VXNlcjQ2NDA2", "organizations_url": "https://api.github.com/users/leifwalsh/orgs", "received_events_url": "https://api.github.com/users/leifwalsh/received_events", "repos_url": "https://api.github.com/users/leifwalsh/repos", "site_admin": false, "starred_url": "https://api.github.com/users/leifwalsh/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/leifwalsh/subscriptions", "type": "User", "url": "https://api.github.com/users/leifwalsh", "user_view_type": "public" }
[ { "color": "e10c02", "default": false, "description": null, "id": 117744, "name": "Bug", "node_id": "MDU6TGFiZWwxMTc3NDQ=", "url": "https://api.github.com/repos/psf/requests/labels/Bug" } ]
closed
true
null
[]
{ "closed_at": "2021-12-30T21:48:07Z", "closed_issues": 11, "created_at": "2021-09-02T07:23:33Z", "creator": { "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }, "description": "", "due_on": null, "html_url": "https://github.com/psf/requests/milestone/29", "id": 7115399, "labels_url": "https://api.github.com/repos/psf/requests/milestones/29/labels", "node_id": "MI_kwDOABTKOs4AbJKH", "number": 29, "open_issues": 0, "state": "closed", "title": "2.27.0", "updated_at": "2021-12-30T21:48:07Z", "url": "https://api.github.com/repos/psf/requests/milestones/29" }
6
2021-07-01T23:56:49Z
2022-03-30T22:00:46Z
2021-12-30T21:36:55Z
NONE
resolved
In https://bugs.python.org/issue27657 it was decided to reverse an earlier decision about how `urllib.parse.urlparse` handles URLs that don't specify a scheme (e.g. `example.org:80`). This behavior change is in Python 3.9. One way this can present to a user is by confusing requests's attempt to add the scheme if it's missing: https://github.com/psf/requests/blob/1466ad713cf84738cd28f1224a7ab4a19e50e361/requests/utils.py#L904 With the old behavior, `urlparse` would return `ParseResult(scheme='', netloc='', path='example.org:80', params='', query='', fragment='')` and then `prepend_scheme_if_needed` would happily add the scheme, typically `http`. With the new behavior, you instead get `ParseResult(scheme='example.org', netloc='', path='80', params='', query='', fragment='')`, so `prepend_scheme_if_needed` thinks it has a scheme, and does nothing. Then later, if this is used as a proxy URL, `urllib3` will complain [here](https://github.com/urllib3/urllib3/blob/dc25db8e9f03ef2c506431e8a98f77c304ac2941/src/urllib3/poolmanager.py#L534), because it has [its own URL parser](https://github.com/urllib3/urllib3/blob/dc25db8e9f03ef2c506431e8a98f77c304ac2941/src/urllib3/util/url.py#L348) that is now I think out of sync with the stdlib. (I guess this means you could fix this by making requests use `urllib3.util.url.parse_url` instead of `urllib.parse.urlparse`, but that's maybe an antisocial fix) ## Expected Result If user code has given requests a proxy dict like `{'http': 'example.org:80'}`, the request is sent through that proxy. ## Actual Result `urllib3` raises `ProxySchemeUnknown` ## Reproduction Steps ```python import requests session = requests.Session() session.proxies = {'https': 'example.org:80'} session.get('https://www.google.com/') ``` ## System Information $ python -m requests.help ``` { "implementation": { "name": "CPython", "version": "3.9.5" }, "platform": { "system": "Linux" }, "requests": { "version": "2.22.0" }, "urllib3": { "version": "1.25.3" }, "using_pyopenssl": false } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 2, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 2, "url": "https://api.github.com/repos/psf/requests/issues/5855/reactions" }
https://api.github.com/repos/psf/requests/issues/5855/timeline
null
completed
null
null
false
[ "\"soon 3.7 and 3.8\" in the issue title isn't correct. The behavior change was present in 3.8.1 and 3.7.6 but reverted in 3.8.2 and 3.7.7.", "Oh good, I missed that, thanks. (There were a lot of bugs to read and I ended up skimming past that piece of history)", "@sethmlarson am I correct in that urllib3's url parsing is not a public API we can rely on?", "`parse_url()` is in the `urllib3.util` namespace so is supported. I encourage it's use as it's been vetted heavily.", "I did a bit of work around this last night. I have a draft PR up (#5917) that has the minimal fix for `prepend_scheme_if_needed` that should solve the specific problem listed. I did a separate commit that replaced all of our uses of `urlparse` with `parse_url` that raised some unfortunate side effects.\r\n\r\n`parse_url` has coupled parsing and validation into the same function, so we end up with a number of failures in the code base that aren't easy to handle and raise as more reasonable errors. Things like redirects fail when we're trying to parse things like incoming location headers, which shouldn't be a terminal case. For now I think we can handle these on a case by case basis and address it more extensively if we find other failure cases with the `urlparse` change.", "Now that #5917 is merged, this should be set to go out on Monday with Requests 2.27.0. Resolving as fixed." ]
https://api.github.com/repos/psf/requests/issues/5854
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5854/labels{/name}
https://api.github.com/repos/psf/requests/issues/5854/comments
https://api.github.com/repos/psf/requests/issues/5854/events
https://github.com/psf/requests/issues/5854
935,250,143
MDU6SXNzdWU5MzUyNTAxNDM=
5,854
stream=True break the zip file
{ "avatar_url": "https://avatars.githubusercontent.com/u/4510984?v=4", "events_url": "https://api.github.com/users/GF-Huang/events{/privacy}", "followers_url": "https://api.github.com/users/GF-Huang/followers", "following_url": "https://api.github.com/users/GF-Huang/following{/other_user}", "gists_url": "https://api.github.com/users/GF-Huang/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/GF-Huang", "id": 4510984, "login": "GF-Huang", "node_id": "MDQ6VXNlcjQ1MTA5ODQ=", "organizations_url": "https://api.github.com/users/GF-Huang/orgs", "received_events_url": "https://api.github.com/users/GF-Huang/received_events", "repos_url": "https://api.github.com/users/GF-Huang/repos", "site_admin": false, "starred_url": "https://api.github.com/users/GF-Huang/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/GF-Huang/subscriptions", "type": "User", "url": "https://api.github.com/users/GF-Huang", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-01T22:07:42Z
2021-07-02T01:29:31Z
2021-07-01T23:57:36Z
NONE
null
![image](https://user-images.githubusercontent.com/4510984/124194421-28239880-dafb-11eb-9a6b-132c4e550ead.png) ![image](https://user-images.githubusercontent.com/4510984/124194806-cd3e7100-dafb-11eb-876b-e4de04ae4417.png) **If I download that file by browser, it can be open.** ## Expected Result Download file do not break the file. ## Actual Result File broken, can not open. ## Reproduction Steps ```python import requests ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "3.0.4" }, "cryptography": { "version": "3.2.1" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.7.6" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "1010108f", "version": "19.1.0" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "1010108f" }, "urllib3": { "version": "1.25.11" }, "using_pyopenssl": true } ``` This command is only available on Requests v2.16.4 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, &c).
{ "avatar_url": "https://avatars.githubusercontent.com/u/4510984?v=4", "events_url": "https://api.github.com/users/GF-Huang/events{/privacy}", "followers_url": "https://api.github.com/users/GF-Huang/followers", "following_url": "https://api.github.com/users/GF-Huang/following{/other_user}", "gists_url": "https://api.github.com/users/GF-Huang/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/GF-Huang", "id": 4510984, "login": "GF-Huang", "node_id": "MDQ6VXNlcjQ1MTA5ODQ=", "organizations_url": "https://api.github.com/users/GF-Huang/orgs", "received_events_url": "https://api.github.com/users/GF-Huang/received_events", "repos_url": "https://api.github.com/users/GF-Huang/repos", "site_admin": false, "starred_url": "https://api.github.com/users/GF-Huang/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/GF-Huang/subscriptions", "type": "User", "url": "https://api.github.com/users/GF-Huang", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5854/reactions" }
https://api.github.com/repos/psf/requests/issues/5854/timeline
null
completed
null
null
false
[ "Sorry, the tqdm example cause this issue, the `tqdm.wrapattr` did not close the file at the final.\r\n\r\n![image](https://user-images.githubusercontent.com/4510984/124201607-18ac4b80-db0b-11eb-9586-9beeed27ebc3.png)\r\n" ]
https://api.github.com/repos/psf/requests/issues/5853
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5853/labels{/name}
https://api.github.com/repos/psf/requests/issues/5853/comments
https://api.github.com/repos/psf/requests/issues/5853/events
https://github.com/psf/requests/issues/5853
935,070,423
MDU6SXNzdWU5MzUwNzA0MjM=
5,853
How to get the response from CONNECT while using proxy on a HTTPS target url
{ "avatar_url": "https://avatars.githubusercontent.com/u/26380784?v=4", "events_url": "https://api.github.com/users/lilanleo/events{/privacy}", "followers_url": "https://api.github.com/users/lilanleo/followers", "following_url": "https://api.github.com/users/lilanleo/following{/other_user}", "gists_url": "https://api.github.com/users/lilanleo/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/lilanleo", "id": 26380784, "login": "lilanleo", "node_id": "MDQ6VXNlcjI2MzgwNzg0", "organizations_url": "https://api.github.com/users/lilanleo/orgs", "received_events_url": "https://api.github.com/users/lilanleo/received_events", "repos_url": "https://api.github.com/users/lilanleo/repos", "site_admin": false, "starred_url": "https://api.github.com/users/lilanleo/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/lilanleo/subscriptions", "type": "User", "url": "https://api.github.com/users/lilanleo", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-01T17:36:54Z
2021-10-03T17:03:11Z
2021-07-05T16:32:29Z
NONE
resolved
Hi, I'm trying to send a GET to a **HTTPS** target using proxy. Normally(like in curl), I will receive **two** response, one is from CONNECT <https://target>, the other is from GET <https://target> But the returning response obj from requests.get(url, proxy) only contains the second response. Could I ask how can I get the first response from CONNECT method? And is there any method to send only CONNECT but not GET? Thanks a lot.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5853/reactions" }
https://api.github.com/repos/psf/requests/issues/5853/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5852
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5852/labels{/name}
https://api.github.com/repos/psf/requests/issues/5852/comments
https://api.github.com/repos/psf/requests/issues/5852/events
https://github.com/psf/requests/issues/5852
935,037,179
MDU6SXNzdWU5MzUwMzcxNzk=
5,852
Request won't hit on endpoint
{ "avatar_url": "https://avatars.githubusercontent.com/u/21988764?v=4", "events_url": "https://api.github.com/users/vergelli/events{/privacy}", "followers_url": "https://api.github.com/users/vergelli/followers", "following_url": "https://api.github.com/users/vergelli/following{/other_user}", "gists_url": "https://api.github.com/users/vergelli/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/vergelli", "id": 21988764, "login": "vergelli", "node_id": "MDQ6VXNlcjIxOTg4NzY0", "organizations_url": "https://api.github.com/users/vergelli/orgs", "received_events_url": "https://api.github.com/users/vergelli/received_events", "repos_url": "https://api.github.com/users/vergelli/repos", "site_admin": false, "starred_url": "https://api.github.com/users/vergelli/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/vergelli/subscriptions", "type": "User", "url": "https://api.github.com/users/vergelli", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-07-01T16:53:42Z
2021-10-03T16:00:30Z
2021-07-05T15:33:16Z
NONE
resolved
I know that this error may not be caused by anything related to _Request_, but I would like to know if you know anything that could help me find a solution. I'm working on a program that makes multiple petitions to a Redmine through its Rest service, and I'm using _python request_. The program I did was tested on a Redmine that was installed locally in a VM ( Centos 8) and work perfectly. The problem arises when I try to test it on a Redmine that is dockerized. Then any petition is rejected, it doesn't even strike on the database. This code is run in a Jupyter Notebook ``` import requests from app import connection response = requests.get( "http://<the_vm_ip>:3000/user.json", verify=False, auth=( connection.REDMINE_USER, connection.REDMINE_PASSWORD) ) ``` Received: ``` --------------------------------------------------------------------------- TimeoutError Traceback (most recent call last) ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py in _new_conn(self) 168 try: --> 169 conn = connection.create_connection( 170 (self._dns_host, self.port), self.timeout, **extra_kw ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options) 95 if err is not None: ---> 96 raise err 97 ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options) 85 sock.bind(source_address) ---> 86 sock.connect(sa) 87 return sock TimeoutError: [WinError 10060] An error occurred during the connection attempt as the connected party did not respond properly after a period of time, or the established connection failed as the connected host failed to respond During handling of the above exception, another exception occurred: NewConnectionError Traceback (most recent call last) ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 698 # Make the request on the httplib connection object. --> 699 httplib_response = self._make_request( 700 conn, ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 393 else: --> 394 conn.request(method, url, **httplib_request_kw) 395 ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py in request(self, method, url, body, headers) 233 headers["User-Agent"] = _get_default_user_agent() --> 234 super(HTTPConnection, self).request(method, url, body=body, headers=headers) 235 ~\AppData\Local\Programs\Python\Python39\lib\http\client.py in request(self, method, url, body, headers, encode_chunked) 1254 """Send a complete request to the server.""" -> 1255 self._send_request(method, url, body, headers, encode_chunked) 1256 ~\AppData\Local\Programs\Python\Python39\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked) 1300 body = _encode(body, 'body') -> 1301 self.endheaders(body, encode_chunked=encode_chunked) 1302 ~\AppData\Local\Programs\Python\Python39\lib\http\client.py in endheaders(self, message_body, encode_chunked) 1249 raise CannotSendHeader() -> 1250 self._send_output(message_body, encode_chunked=encode_chunked) 1251 ~\AppData\Local\Programs\Python\Python39\lib\http\client.py in _send_output(self, message_body, encode_chunked) 1009 del self._buffer[:] -> 1010 self.send(msg) 1011 ~\AppData\Local\Programs\Python\Python39\lib\http\client.py in send(self, data) 949 if self.auto_open: --> 950 self.connect() 951 else: ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py in connect(self) 199 def connect(self): --> 200 conn = self._new_conn() 201 self._prepare_conn(conn) ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py in _new_conn(self) 180 except SocketError as e: --> 181 raise NewConnectionError( 182 self, "Failed to establish a new connection: %s" % e NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000072E29D3C70>: Failed to establish a new connection: [WinError 10060] Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder During handling of the above exception, another exception occurred: MaxRetryError Traceback (most recent call last) ~\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 438 if not chunked: --> 439 resp = conn.urlopen( 440 method=request.method, ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 754 --> 755 retries = retries.increment( 756 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] ~\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 572 if new_retry.is_exhausted(): --> 573 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 574 MaxRetryError: HTTPConnectionPool(host='<my_vm_ip>', port=3000): Max retries exceeded with url: /user.json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000072E29D3C70>: Failed to establish a new connection: [WinError 10060] Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder')) During handling of the above exception, another exception occurred: ConnectionError Traceback (most recent call last) <ipython-input-3-69baa6e28937> in <module> 3 'cookie': 'self.cookie'} 4 ----> 5 response = requests.get( "<my_vm_ip>:3000/user.json", verify=False, auth=( "admin", "password"), headers=header, allow_redirects=True, stream=True) 6 7 response ~\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py in get(url, params, **kwargs) 74 75 kwargs.setdefault('allow_redirects', True) ---> 76 return request('get', url, params=params, **kwargs) 77 78 ~\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py in request(method, url, **kwargs) 59 # cases, and look like a memory leak in others. 60 with sessions.Session() as session: ---> 61 return session.request(method=method, url=url, **kwargs) 62 63 ~\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 540 } 541 send_kwargs.update(settings) --> 542 resp = self.send(prep, **send_kwargs) 543 544 return resp ~\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py in send(self, request, **kwargs) 653 654 # Send the request --> 655 r = adapter.send(request, **kwargs) 656 657 # Total elapsed time of the request (approximately) ~\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 514 raise SSLError(e, request=request) 515 --> 516 raise ConnectionError(e, request=request) 517 518 except ClosedPoolError as e: ConnectionError: HTTPConnectionPool(host='<my_vm_ip>', port=3000): Max retries exceeded with url: /user.json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000072E29D3C70>: Failed to establish a new connection: [WinError 10060] An error occurred during the connection attempt as the connected party did not respond properly after a period of time, or the established connection failed as the connected host failed to respond ')) ``` The whole description is posted in this [StackOverflow thread](https://stackoverflow.com/questions/68166651/dockerized-redmine-not-responding-api-rest-requests/68168106?noredirect=1#comment120480086_68168106) just in case, but again, I know this might not be related to request, Sorry in Advance.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5852/reactions" }
https://api.github.com/repos/psf/requests/issues/5852/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5851
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5851/labels{/name}
https://api.github.com/repos/psf/requests/issues/5851/comments
https://api.github.com/repos/psf/requests/issues/5851/events
https://github.com/psf/requests/pull/5851
934,142,171
MDExOlB1bGxSZXF1ZXN0NjgxMjQ3OTM4
5,851
Fix extract_zipped_paths infinite loop when provided invalid unc path
{ "avatar_url": "https://avatars.githubusercontent.com/u/79589038?v=4", "events_url": "https://api.github.com/users/tl-hbk/events{/privacy}", "followers_url": "https://api.github.com/users/tl-hbk/followers", "following_url": "https://api.github.com/users/tl-hbk/following{/other_user}", "gists_url": "https://api.github.com/users/tl-hbk/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/tl-hbk", "id": 79589038, "login": "tl-hbk", "node_id": "MDQ6VXNlcjc5NTg5MDM4", "organizations_url": "https://api.github.com/users/tl-hbk/orgs", "received_events_url": "https://api.github.com/users/tl-hbk/received_events", "repos_url": "https://api.github.com/users/tl-hbk/repos", "site_admin": false, "starred_url": "https://api.github.com/users/tl-hbk/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tl-hbk/subscriptions", "type": "User", "url": "https://api.github.com/users/tl-hbk", "user_view_type": "public" }
[]
closed
true
null
[]
{ "closed_at": "2021-12-30T21:48:07Z", "closed_issues": 11, "created_at": "2021-09-02T07:23:33Z", "creator": { "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }, "description": "", "due_on": null, "html_url": "https://github.com/psf/requests/milestone/29", "id": 7115399, "labels_url": "https://api.github.com/repos/psf/requests/milestones/29/labels", "node_id": "MI_kwDOABTKOs4AbJKH", "number": 29, "open_issues": 0, "state": "closed", "title": "2.27.0", "updated_at": "2021-12-30T21:48:07Z", "url": "https://api.github.com/repos/psf/requests/milestones/29" }
0
2021-06-30T21:29:35Z
2021-12-01T08:00:28Z
2021-08-03T00:40:35Z
CONTRIBUTOR
resolved
Fixes https://github.com/psf/requests/issues/5850
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5851/reactions" }
https://api.github.com/repos/psf/requests/issues/5851/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5851.diff", "html_url": "https://github.com/psf/requests/pull/5851", "merged_at": "2021-08-03T00:40:34Z", "patch_url": "https://github.com/psf/requests/pull/5851.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5851" }
true
[]
https://api.github.com/repos/psf/requests/issues/5850
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5850/labels{/name}
https://api.github.com/repos/psf/requests/issues/5850/comments
https://api.github.com/repos/psf/requests/issues/5850/events
https://github.com/psf/requests/issues/5850
933,051,642
MDU6SXNzdWU5MzMwNTE2NDI=
5,850
Infinite loop when verify is invalid UNC path
{ "avatar_url": "https://avatars.githubusercontent.com/u/79589038?v=4", "events_url": "https://api.github.com/users/tl-hbk/events{/privacy}", "followers_url": "https://api.github.com/users/tl-hbk/followers", "following_url": "https://api.github.com/users/tl-hbk/following{/other_user}", "gists_url": "https://api.github.com/users/tl-hbk/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/tl-hbk", "id": 79589038, "login": "tl-hbk", "node_id": "MDQ6VXNlcjc5NTg5MDM4", "organizations_url": "https://api.github.com/users/tl-hbk/orgs", "received_events_url": "https://api.github.com/users/tl-hbk/received_events", "repos_url": "https://api.github.com/users/tl-hbk/repos", "site_admin": false, "starred_url": "https://api.github.com/users/tl-hbk/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tl-hbk/subscriptions", "type": "User", "url": "https://api.github.com/users/tl-hbk", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-29T19:49:07Z
2021-11-01T01:22:15Z
2021-08-03T00:40:35Z
CONTRIBUTOR
resolved
When an invalid UNC path is passed to `requests.utils.extract_zipped_paths` it results in an infinite loop ## Expected Result For `extract_zipped_paths` to return the path and an Exception to be thrown when the cert path is checked prior to verification being attempted. ## Actual Result Code gets stuck looping here https://github.com/psf/requests/blob/5855dd711f0ab9c9c4782574b8814b1e4c7f98cc/requests/utils.py#L245-L248 ## Reproduction Steps ```python import requests.utils requests.utils.extract_zipped_paths(r"\\localhost\a\b\c") # Assumes this path is invalid on testing machine ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "3.4.7" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.8.10" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "101010bf", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.4" }, "using_pyopenssl": true } ``` This command is only available on Requests v2.16.4 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, &c).
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5850/reactions" }
https://api.github.com/repos/psf/requests/issues/5850/timeline
null
completed
null
null
false
[ "This code path is only hit when using a patched `certifi` package that has `certifi.where()` return a UNC path" ]
https://api.github.com/repos/psf/requests/issues/5849
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5849/labels{/name}
https://api.github.com/repos/psf/requests/issues/5849/comments
https://api.github.com/repos/psf/requests/issues/5849/events
https://github.com/psf/requests/issues/5849
932,271,195
MDU6SXNzdWU5MzIyNzExOTU=
5,849
How to upload large chunks of file in requests ?
{ "avatar_url": "https://avatars.githubusercontent.com/u/33820064?v=4", "events_url": "https://api.github.com/users/pghole/events{/privacy}", "followers_url": "https://api.github.com/users/pghole/followers", "following_url": "https://api.github.com/users/pghole/following{/other_user}", "gists_url": "https://api.github.com/users/pghole/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pghole", "id": 33820064, "login": "pghole", "node_id": "MDQ6VXNlcjMzODIwMDY0", "organizations_url": "https://api.github.com/users/pghole/orgs", "received_events_url": "https://api.github.com/users/pghole/received_events", "repos_url": "https://api.github.com/users/pghole/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pghole/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pghole/subscriptions", "type": "User", "url": "https://api.github.com/users/pghole", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-29T06:44:39Z
2021-10-03T17:03:11Z
2021-07-05T16:32:03Z
NONE
resolved
Hello team, I have to upload large files (~5GB). I am dividing the file in small chunks (10MB), can't send all together(as the api I am requesting fails for large data 5GB if sent in one request). The api I am uploading to, has a specification that it needs minimum of 10MB data to be sent. I did use read(10485760) and send it via requests which works fine. However, I do not want to read all the 10MB in the memory and if I leverage multithreading in my script, so each thread reading 10MB would cost me too much memory. Is there a way I can send a total of 10MB to the api requests but read only 4096/8192 bytes at a time and transfer till I reach 10MB, so that I do not overuse memory. Pls.note I don't want to send the fileobj in the requests as that will use less memory but I will not be able to break the chunk at 10MB and entire 5GB data will go to the request, which I do not want. Is there any way via requests. I see the httplib has it. https://github.com/python/cpython/blob/3.9/Lib/http/client.py - I will call the send(fh.read(4096) function here in loop till I complete 10MB and will complete one request of 10MB without heavy memory usage. Pls. suggest. Urgent
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5849/reactions" }
https://api.github.com/repos/psf/requests/issues/5849/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5848
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5848/labels{/name}
https://api.github.com/repos/psf/requests/issues/5848/comments
https://api.github.com/repos/psf/requests/issues/5848/events
https://github.com/psf/requests/issues/5848
931,012,528
MDU6SXNzdWU5MzEwMTI1Mjg=
5,848
Requests can't be imported if file is named email.py
{ "avatar_url": "https://avatars.githubusercontent.com/u/13700219?v=4", "events_url": "https://api.github.com/users/reisenmachtfreude/events{/privacy}", "followers_url": "https://api.github.com/users/reisenmachtfreude/followers", "following_url": "https://api.github.com/users/reisenmachtfreude/following{/other_user}", "gists_url": "https://api.github.com/users/reisenmachtfreude/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/reisenmachtfreude", "id": 13700219, "login": "reisenmachtfreude", "node_id": "MDQ6VXNlcjEzNzAwMjE5", "organizations_url": "https://api.github.com/users/reisenmachtfreude/orgs", "received_events_url": "https://api.github.com/users/reisenmachtfreude/received_events", "repos_url": "https://api.github.com/users/reisenmachtfreude/repos", "site_admin": false, "starred_url": "https://api.github.com/users/reisenmachtfreude/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/reisenmachtfreude/subscriptions", "type": "User", "url": "https://api.github.com/users/reisenmachtfreude", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-27T20:32:19Z
2021-09-25T22:00:40Z
2021-06-27T21:51:58Z
NONE
resolved
If I create a file called email.py importing requests end in an error. ## Expected Result I would expect the filename does not influence the functionality ## Actual Result The following exception occurs: ``` Traceback (most recent call last): File "/home/someDir/email.py", line 1, in <module> import requests File "/usr/lib/python3/dist-packages/requests/__init__.py", line 43, in <module> import urllib3 File "/usr/lib/python3/dist-packages/urllib3/__init__.py", line 11, in <module> from . import exceptions File "/usr/lib/python3/dist-packages/urllib3/exceptions.py", line 3, in <module> from six.moves.http_client import IncompleteRead as httplib_IncompleteRead File "/usr/lib/python3/dist-packages/six.py", line 203, in load_module mod = mod._resolve() File "/usr/lib/python3/dist-packages/six.py", line 115, in _resolve return _import_module(self.mod) File "/usr/lib/python3/dist-packages/six.py", line 82, in _import_module __import__(name) File "/usr/lib/python3.9/http/client.py", line 71, in <module> import email.parser ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module> from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module> from urllib.request import urlopen File "/usr/lib/python3.9/urllib/request.py", line 88, in <module> import http.client File "/usr/lib/python3.9/http/client.py", line 71, in <module> import email.parser ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package Original exception was: Traceback (most recent call last): File "/home/someDir/email.py", line 1, in <module> import requests File "/usr/lib/python3/dist-packages/requests/__init__.py", line 43, in <module> import urllib3 File "/usr/lib/python3/dist-packages/urllib3/__init__.py", line 11, in <module> from . import exceptions File "/usr/lib/python3/dist-packages/urllib3/exceptions.py", line 3, in <module> from six.moves.http_client import IncompleteRead as httplib_IncompleteRead File "/usr/lib/python3/dist-packages/six.py", line 203, in load_module mod = mod._resolve() File "/usr/lib/python3/dist-packages/six.py", line 115, in _resolve return _import_module(self.mod) File "/usr/lib/python3/dist-packages/six.py", line 82, in _import_module __import__(name) File "/usr/lib/python3.9/http/client.py", line 71, in <module> import email.parser ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package ``` ## Reproduction Steps create a file email.py. Content of the file ``` import requests ``` Execute with `/usr/local/bin/python3 email.py` If the file is renamed, e.g. `mv email.py email2.py` the execution works without errors. ## System Information OS: ``` Distributor ID: Ubuntu Description: Ubuntu 21.04 Release: 21.04 Codename: hirsute ``` Python 3.9.5 ``` Name: requests Version: 2.25.1 Summary: Python HTTP for Humans. Home-page: https://requests.readthedocs.io Author: Kenneth Reitz Author-email: [email protected] License: Apache 2.0 Location: /usr/lib/python3/dist-packages Requires: Required-by: ... ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5848/reactions" }
https://api.github.com/repos/psf/requests/issues/5848/timeline
null
completed
null
null
false
[ "That's because `email` is a standard library module. Not recommended to conflict with those, you'll get all sorts of weird breakages.\n\nClosing as not an issue. " ]
https://api.github.com/repos/psf/requests/issues/5847
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5847/labels{/name}
https://api.github.com/repos/psf/requests/issues/5847/comments
https://api.github.com/repos/psf/requests/issues/5847/events
https://github.com/psf/requests/issues/5847
930,729,387
MDU6SXNzdWU5MzA3MjkzODc=
5,847
Request fails for subdomains of localhost
{ "avatar_url": "https://avatars.githubusercontent.com/u/1538187?v=4", "events_url": "https://api.github.com/users/Mixermachine/events{/privacy}", "followers_url": "https://api.github.com/users/Mixermachine/followers", "following_url": "https://api.github.com/users/Mixermachine/following{/other_user}", "gists_url": "https://api.github.com/users/Mixermachine/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Mixermachine", "id": 1538187, "login": "Mixermachine", "node_id": "MDQ6VXNlcjE1MzgxODc=", "organizations_url": "https://api.github.com/users/Mixermachine/orgs", "received_events_url": "https://api.github.com/users/Mixermachine/received_events", "repos_url": "https://api.github.com/users/Mixermachine/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Mixermachine/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Mixermachine/subscriptions", "type": "User", "url": "https://api.github.com/users/Mixermachine", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2021-06-26T16:15:49Z
2021-09-26T14:00:33Z
2021-06-28T13:03:20Z
NONE
resolved
Requesting subdomains of localhost fails with error message on Windows. This error does not appear on Linux (tested on an ARM64 server). Tested on a Windows laptop (Lenovo T14s, AMD 4750u) and a Windows desktop (AMD 2600) ## Expected Result I need to make a get request to an url in the following format: http://XXX.localhost (where XXX is replaced with an arbitrary value.) example: http://ark8s-844db1a4-2988-4f30-9ff6-e78df428bad3-test.localhost An nginx server inside kubernetes listens to this url. When I use the url in the browser the desired site is fetched. ## Actual Result I get the following error: `HTTPConnectionPool(host='ark8s-844db1a4-2988-4f30-9ff6-e78df428bad3-test.localhost', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001D1E89E4940>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))` ## Reproduction Steps ```python import requests requests.get('http://test.localhost') ``` Same result for when 'test' is replaced with any other value no matter if a server is listening there or not. Requesting localhost works as expected. Subdomains of localhost do not work. ## System Information Windows 10 Ryzen 4750U ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.5" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.6" }, "using_pyopenssl": false } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5847/reactions" }
https://api.github.com/repos/psf/requests/issues/5847/timeline
null
completed
null
null
false
[ "The error here `getaddrinfo failed` indicates that Python (not requests) can not find your domain name. You should be able to reproduce this with\r\n\r\n```py\r\nimport socket\r\n\r\nprint(socket.getaddrinfo(\"ark8s-844db1a4-2988-4f30-9ff6-e78df428bad3-test.localhost\", 80, family=socket.AF_INET, proto=socket.IPPROTO_TCP))\r\n```", "Thank you for your answer.\r\nYes I get the same error there\r\n\r\n`socket.gaierror: [Errno 11001] getaddrinfo failed`\r\n\r\nDo you know where I can raise this issue?", "It's not even just a Python issue. You could write C code and code in other languages that would encounter this. It means your machine isn't configured to resolve those addresses. Unfortunately I don't know how to do that on Windows but I suspect StackOverflow knows", "Mh that is really weird.\r\nWhen I enter the address on the same machine in the browser it will fetch the page.\r\n\r\nLooked into it, the host file of Windows does not seem to support wildcards...\r\nDamn, I guess I have to find another solution.\r\nThe subdomains are generated with entropy so i can't add them to the host file.\r\n\r\nThx @sigmavirus24 for pointing me in the right direction" ]
https://api.github.com/repos/psf/requests/issues/5846
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5846/labels{/name}
https://api.github.com/repos/psf/requests/issues/5846/comments
https://api.github.com/repos/psf/requests/issues/5846/events
https://github.com/psf/requests/issues/5846
930,167,724
MDU6SXNzdWU5MzAxNjc3MjQ=
5,846
TestRequests.test_pyopenssl_redirect is broken in CI
{ "avatar_url": "https://avatars.githubusercontent.com/u/42327?v=4", "events_url": "https://api.github.com/users/pquentin/events{/privacy}", "followers_url": "https://api.github.com/users/pquentin/followers", "following_url": "https://api.github.com/users/pquentin/following{/other_user}", "gists_url": "https://api.github.com/users/pquentin/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pquentin", "id": 42327, "login": "pquentin", "node_id": "MDQ6VXNlcjQyMzI3", "organizations_url": "https://api.github.com/users/pquentin/orgs", "received_events_url": "https://api.github.com/users/pquentin/received_events", "repos_url": "https://api.github.com/users/pquentin/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pquentin/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pquentin/subscriptions", "type": "User", "url": "https://api.github.com/users/pquentin", "user_view_type": "public" }
[]
closed
true
null
[]
null
9
2021-06-25T13:18:23Z
2023-05-01T00:03:16Z
2022-04-30T16:47:31Z
CONTRIBUTOR
resolved
TestRequests.test_pyopenssl_redirect is broken in CI. I just fixed the urllib3 integration tests to work on GitHub Actions in https://github.com/urllib3/urllib3/pull/2304, and noticed that TestRequests.test_pyopenssl_redirect is broken, and is broken on your CI as well. ## Expected Result The test should pass. ## Actual Result The test reliably fails, on all Python 3.6+ versions: https://github.com/psf/requests/runs/2715203297. Interestingly, it works on 2.7 and 3.5. ## Reproduction Steps Run you CI: https://github.com/psf/requests/runs/2715203297 ## System Information Fails on Linux, Windows and macOS. Also on PyPI. But only on Python 3.6+.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5846/reactions" }
https://api.github.com/repos/psf/requests/issues/5846/timeline
null
completed
null
null
false
[ "Thanks for filing an issue, @pquentin! We first saw this a couple weeks ago but I haven't had a chance to track down the issue. We have both our httpbin/pytest-httpbin dependencies pinned, so they shouldn't have changed, unless an underlying dependency was recently updated. The local endpoint is now terminating the connection when we attempt to make our test call, causing the failure.\r\n\r\nWe're technically removing first-class support for pyopenssl in the next release. Seth started that process in 2.25.0, and we'll be turning `requests[security]` into a no-op in 2.26.0. We'll need to do a little digging to understand the failure, then decide if we can fix or if removing the test is accessible. We can track that outstanding work here if anyone has any leads in the meantime.", "I work on the Python packaging team for SUSE, and I've been trying to nail down this issue myself. I strongly suspect the culprit is Werkzeug 2.0.1 (installing Werkzeug 1.0.1 makes the test pass), but given the massive amount of changes I'm struggling to nail down which change causes it.", "Thanks @nateprewitt and @s-t-e-v-e-n-k!\r\n\r\nSo that explains why this works in Python 2.7 and Python 3.5: werkzeug 2 does not support those versions. I ran `git bisect` and the test starts to fail in https://github.com/pallets/werkzeug/pull/2003. Unfortunately this pull request changes 2,800 lines of code. (I tested this with Flask 1.1.4, not sure if it makes a difference.)", "Has anyone filed a bug with werkzeug? If this is related to upgrading that package it sounds like a regression to me that they need to fix. Given this is part of a redirect test, I also noticed Tom Christie filed a bug about double-encoding redirects which sounds like it _might_ be related", "If anyone can formulate a standalone minimal example, I can try to help debug it.", "Thanks @davidism! It appears to only be [one test](https://github.com/psf/requests/blob/main/tests/test_requests.py#L882-L883) that's broken around pyopenssl. The SSL handshake is failing and the server is closing the connection. It's using a [certificate bundle fixture](https://github.com/kevin1024/pytest-httpbin/blob/be3c3205972195ca632949ed7af1dc7086cb7899/pytest_httpbin/plugin.py#L39-L41) from pytest-httpbin which is just overriding our cert bundle with this [cert](https://github.com/kevin1024/pytest-httpbin/blob/be3c3205972195ca632949ed7af1dc7086cb7899/pytest_httpbin/certs/cacert.pem). Presumably, Flask did something like dropping support for Common Names or some other security improvement that's making this certificate non-negotiable.\r\n\r\nThis is an [example build](https://github.com/nateprewitt/requests/actions/runs/1867367516) of the failure but the stacktrace isn't terribly helpful. The connection is being aborted with:\r\n```\r\n[SSL: HTTP_REQUEST] http request (_ssl.c:852)\r\n```\r\n I was planning to start from the Werkzeug patch (https://github.com/pallets/werkzeug/pull/2003) and work backwards from there. If you have any insights though, that'd be greatly appreciated. I'll see if I can simplify the repro further so it's just a standalone script.\r\n\r\n", "I've looked at the PR, and I really can't figure out why that broke this test, it was a big refactor but it shouldn't have affected TLS. It didn't modify `serving.py` at all, and Werkzeug's dev server is what would be handling TLS requests. Werkzeug extends Python's `http.server`, calling `ssl.wrap_socket`. You could check if you have an issue with the cert when using the built-in server directly.\r\n\r\nRegarding redirects, I don't know what httpbin does, but we did change to using 307/308 redirects by default, but that was well before that PR. Is the first request successful and the redirect not, or is the initial request unsuccessful?", "@nateprewitt This test is passing now, presumably since https://github.com/psf/requests/pull/5859. Should we close this issue in favor of #6070?", "It's passing due to the infrastructure pinning for Flask<2.0 but the specific test is still failing with the upgrade. I'd originally had this as the \"issue\" and #6070 as the broader action item, but I'm fine merging the two. I'll resolve this in favor of the broader ticket." ]
https://api.github.com/repos/psf/requests/issues/5845
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5845/labels{/name}
https://api.github.com/repos/psf/requests/issues/5845/comments
https://api.github.com/repos/psf/requests/issues/5845/events
https://github.com/psf/requests/issues/5845
927,702,615
MDU6SXNzdWU5Mjc3MDI2MTU=
5,845
Relax IDNA2008 requirement?
{ "avatar_url": "https://avatars.githubusercontent.com/u/778068?v=4", "events_url": "https://api.github.com/users/snarfed/events{/privacy}", "followers_url": "https://api.github.com/users/snarfed/followers", "following_url": "https://api.github.com/users/snarfed/following{/other_user}", "gists_url": "https://api.github.com/users/snarfed/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/snarfed", "id": 778068, "login": "snarfed", "node_id": "MDQ6VXNlcjc3ODA2OA==", "organizations_url": "https://api.github.com/users/snarfed/orgs", "received_events_url": "https://api.github.com/users/snarfed/received_events", "repos_url": "https://api.github.com/users/snarfed/repos", "site_admin": false, "starred_url": "https://api.github.com/users/snarfed/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/snarfed/subscriptions", "type": "User", "url": "https://api.github.com/users/snarfed", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-06-22T23:15:30Z
2021-10-05T15:10:52Z
2021-07-07T13:27:23Z
NONE
resolved
Hi all! First, thank you for all your hard work developing and maintaining requests. I know firsthand how thankless and time consuming managing an open source project can be, and I can only imagine how much more so on a project this popular. We appreciate it! I originally raised this as https://github.com/psf/requests/issues/3687#issuecomment-835688746, after that issue was closed. I suspect no one noticed, so I'm raising as a new issue. requests currently uses the `idna` library to check input URLs for IDNA2008 compliance, and rejects URLs that don't comply. This breaks non-compliant URLs with emoji characters, like http://☃.net/, which you all said was intentional in https://github.com/psf/requests/issues/3687#issuecomment-260757981 (also see https://github.com/psf/requests/issues/3683#issuecomment-261240279), since those domains' time is arguably limited, ie they're effectively "dead domains walking." Understood. However, not all TLDs require IDNA2008 compliance. Unlike gTLDs, ccTLDs generally get to choose their own domain policies - [background from Wikipedia](https://en.wikipedia.org/wiki/Country_code_top-level_domain), [ICANN](https://www.icann.org/resources/pages/cctlds-21-2012-02-25-en), [a GoDaddy representative](https://github.com/kjd/idna/issues/18#issuecomment-830969692) - and a handful of them have stuck with IDNA2003, UTS#46, or related variants. (Not to mention older proprietary schemes like [ThaiURL](https://en.wikipedia.org/wiki/ThaiURL) 😁.) For example, [.ws, .la, .ai, .to, and .fm evidently explicitly allow emoji.](https://gizmodo.com/emoji-domains-are-the-future-maybe-1823319626) Similarly, afaik domain owners can do whatever they want with their own subdomains. So thanks to Punycode, third level (and beyond) hostnames like https://🌏➡➡❤🔒.ayeshious.com and https://🔒🔒🔒.scotthelme.co.uk seem to not be at risk of breaking due to gTLD registries enforcing IDNA2008 on pay-level domain registrations. Any chance you all could relax the IDNA2008 requirement so that you support both of those kinds of domains? Right now, I'm working around this with code like this, using the `domain2idna` library, to support at least IDNA2003 in addition to IDNA2008. It'd be nice not to have to. ```py try: resp = requests.get(url, ...) except requests.exceptions.InvalidURL: punycode = domain2idna(url) if punycode != url: # the domain is valid idna2003 but not idna2008. encode and try again. resp = requests.get(punycode, ...) ``` Thanks again for listening, and for maintaining requests!
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5845/reactions" }
https://api.github.com/repos/psf/requests/issues/5845/timeline
null
completed
null
null
false
[ "This is not likely to land as there are additional security requirements to be mindful of when using IDNA2003, hence why it's preferable to use IDNA2008. My recommendation in this case is to do the normalization yourself and pass Requests an ASCII-only host.", "Fair enough, understood. Thanks for the response." ]
https://api.github.com/repos/psf/requests/issues/5844
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5844/labels{/name}
https://api.github.com/repos/psf/requests/issues/5844/comments
https://api.github.com/repos/psf/requests/issues/5844/events
https://github.com/psf/requests/issues/5844
925,504,093
MDU6SXNzdWU5MjU1MDQwOTM=
5,844
Allow for other JSON packages
{ "avatar_url": "https://avatars.githubusercontent.com/u/5131271?v=4", "events_url": "https://api.github.com/users/achapkowski/events{/privacy}", "followers_url": "https://api.github.com/users/achapkowski/followers", "following_url": "https://api.github.com/users/achapkowski/following{/other_user}", "gists_url": "https://api.github.com/users/achapkowski/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/achapkowski", "id": 5131271, "login": "achapkowski", "node_id": "MDQ6VXNlcjUxMzEyNzE=", "organizations_url": "https://api.github.com/users/achapkowski/orgs", "received_events_url": "https://api.github.com/users/achapkowski/received_events", "repos_url": "https://api.github.com/users/achapkowski/repos", "site_admin": false, "starred_url": "https://api.github.com/users/achapkowski/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/achapkowski/subscriptions", "type": "User", "url": "https://api.github.com/users/achapkowski", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-20T02:12:23Z
2021-09-18T18:00:22Z
2021-06-20T17:47:29Z
NONE
resolved
It would be nice to be able to allow requests to register other ‘json’ libraries like Ujson.
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5844/reactions" }
https://api.github.com/repos/psf/requests/issues/5844/timeline
null
completed
null
null
false
[ "You can call `ujson.loads(resp.text)`?" ]
https://api.github.com/repos/psf/requests/issues/5843
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5843/labels{/name}
https://api.github.com/repos/psf/requests/issues/5843/comments
https://api.github.com/repos/psf/requests/issues/5843/events
https://github.com/psf/requests/issues/5843
924,862,018
MDU6SXNzdWU5MjQ4NjIwMTg=
5,843
SSL ERROR - WRONG_VERSION_NUMBER
{ "avatar_url": "https://avatars.githubusercontent.com/u/60690727?v=4", "events_url": "https://api.github.com/users/eilgug/events{/privacy}", "followers_url": "https://api.github.com/users/eilgug/followers", "following_url": "https://api.github.com/users/eilgug/following{/other_user}", "gists_url": "https://api.github.com/users/eilgug/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/eilgug", "id": 60690727, "login": "eilgug", "node_id": "MDQ6VXNlcjYwNjkwNzI3", "organizations_url": "https://api.github.com/users/eilgug/orgs", "received_events_url": "https://api.github.com/users/eilgug/received_events", "repos_url": "https://api.github.com/users/eilgug/repos", "site_admin": false, "starred_url": "https://api.github.com/users/eilgug/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/eilgug/subscriptions", "type": "User", "url": "https://api.github.com/users/eilgug", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-06-18T12:34:30Z
2022-02-11T02:12:20Z
2021-11-13T01:48:48Z
NONE
resolved
While i'm using proxies just get always this error. I've try several times at least i resolved by removing the "s" in the https: proxy too as suggested in [this topic](https://stackoverflow.com/questions/65516325/ssl-wrong-version-number-on-python-request): I think this problem is related to the last version, because i've tried on an older one and it works great. ## Solution Steps ```python import requests ... self.proxies = { 'http': f'http://...:8080/', 'https': f'http://...:8080/' } def get(self, url): request_url = self.base_url + url return requests.get(request_url, headers=self.headers, proxies=self.proxies) ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.5" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.5" }, "using_pyopenssl": false } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 2, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 2, "url": "https://api.github.com/repos/psf/requests/issues/5843/reactions" }
https://api.github.com/repos/psf/requests/issues/5843/timeline
null
completed
null
null
false
[ "Sounds kind of like #5943 \r\n\r\nCan you check that issue and see if it answers your question? If not, I think you need to provide some more complete example code & errors.", "Almost certain this is the same issue mentioned in the comment above. Try changing https->http. Closing as duplicate. " ]
https://api.github.com/repos/psf/requests/issues/5842
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5842/labels{/name}
https://api.github.com/repos/psf/requests/issues/5842/comments
https://api.github.com/repos/psf/requests/issues/5842/events
https://github.com/psf/requests/issues/5842
922,961,018
MDU6SXNzdWU5MjI5NjEwMTg=
5,842
Support specifying adapter per-request
{ "avatar_url": "https://avatars.githubusercontent.com/u/27799541?v=4", "events_url": "https://api.github.com/users/brandon-leapyear/events{/privacy}", "followers_url": "https://api.github.com/users/brandon-leapyear/followers", "following_url": "https://api.github.com/users/brandon-leapyear/following{/other_user}", "gists_url": "https://api.github.com/users/brandon-leapyear/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/brandon-leapyear", "id": 27799541, "login": "brandon-leapyear", "node_id": "MDQ6VXNlcjI3Nzk5NTQx", "organizations_url": "https://api.github.com/users/brandon-leapyear/orgs", "received_events_url": "https://api.github.com/users/brandon-leapyear/received_events", "repos_url": "https://api.github.com/users/brandon-leapyear/repos", "site_admin": false, "starred_url": "https://api.github.com/users/brandon-leapyear/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/brandon-leapyear/subscriptions", "type": "User", "url": "https://api.github.com/users/brandon-leapyear", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-06-16T18:40:49Z
2021-09-14T22:00:27Z
2021-06-16T21:50:44Z
NONE
resolved
Currently, the only way an adapter can be applied is by mounting into a Session. It would be great to add something like `http_adapter` as an argument to the `.get()`/`.post()` functions. In our project, we need to retry all idempotent requests, but we have some RPC-endpoints (e.g. a GraphQL endpoint) that uses `POST` even for idempotent requests. So we need some way of specifying that a particular request is idempotent and should be retried. Alternatively, this can be achieved by being able to specify a predicate in `Session.mount` that takes in a `Request` and returns `True` if this mounted adapter should be used. But specifying the adapter directly in the `.get()`/`.post()` functions would be better, so that the logic of "should i retry?" is on the actual request instead of centralized in one location
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5842/reactions" }
https://api.github.com/repos/psf/requests/issues/5842/timeline
null
completed
null
null
false
[ "Our current workaround:\r\n```python\r\nclass MyAdapter(HTTPAdapter):\r\n \"\"\"Requests transport adapter that retries requests when activated.\"\"\"\r\n\r\n def __init__(self, *args, **kwargs):\r\n max_retries = kwargs.pop(\"max_retries\", None)\r\n\r\n super().__init__(*args, **kwargs)\r\n\r\n self._retry_next_request = False\r\n\r\n if max_retries:\r\n self._max_retries = Retry.from_int(max_retries)\r\n\r\n def activate_once(self):\r\n self._retry_next_request = True\r\n\r\n def send(self, request, *args, **kwargs):\r\n if not self._retry_next_request:\r\n return super().send(request, *args, **kwargs)\r\n\r\n old_max_retries = self.max_retries\r\n self.max_retries = self._max_retries\r\n\r\n try:\r\n result = super().send(request, *args, **kwargs)\r\n finally:\r\n self._retry_next_request = False\r\n\r\n self.max_retries = old_max_retries\r\n return result\r\n\r\nsession = requests.Session()\r\nadapter = MyAdapter(max_retries=...)\r\nsession.mount(\"http://\", adapter)\r\nsession.mount(\"https://\", adapter)\r\n\r\n# this is retried\r\nadapter.activate_once()\r\nsession.post(...)\r\n\r\n# this is not retried\r\nsession.post(...)\r\n```", "You can specify which domains are used for an adapter. See this hastily thrown together example:\r\n\r\n```\r\nPython 3.9.5 (default, May 14 2021, 00:00:00)\r\n[GCC 11.1.1 20210428 (Red Hat 11.1.1-1)] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import requests\r\n>>> s = requests.Session()\r\n>>> print(requests.adapters.HTTPAdapter)\r\n<class 'requests.adapters.HTTPAdapter'>\r\n>>> class MyAdapter(requests.adapters.HTTPAdapter):\r\n... def send(self, *args, **kwargs):\r\n... print(\"Hello!\")\r\n... super().send(*args, **kwargs)\r\n...\r\n>>> a = MyAdapter()\r\n>>> s.mount(\"https://httpbin.org\", a)\r\n>>> s.get(\"https://example.com\").status_code\r\n200\r\n>>> s.get(\"https://httpbin.org/get\").status_code\r\nHello!\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"/usr/lib/python3.9/site-packages/requests/sessions.py\", line 555, in get\r\n return self.request('GET', url, **kwargs)\r\n File \"/usr/lib/python3.9/site-packages/requests/sessions.py\", line 542, in request\r\n resp = self.send(prep, **send_kwargs)\r\n File \"/usr/lib/python3.9/site-packages/requests/sessions.py\", line 659, in send\r\n r.elapsed = timedelta(seconds=elapsed)\r\nAttributeError: 'NoneType' object has no attribute 'elapsed'\r\n>>>\r\n```\r\n\r\nIt's prefix matching here. As an aside, there is an ability to directly override several of the methods on a Session responsible for handling redirects at the moment. It's not well-documented because it isn't an oft-needed feature and most people seem to have been able to puzzle it out themselves. Adapters aren't quite the right level for this.\r\n\r\nThere's also a method for using urllib3's Retry logic in Requests which _is_ documented and might suite you better", "Thanks for the quick response!\r\n\r\nI don't think prefix matching is sufficient for our use-case. Our use-case is a single endpoint (e.g. `POST example.com/graphql`) where different request bodies should be retried, but others shouldn't.\r\n\r\nWe are using urllib3's Retry logic, but that's not sufficient either, because there's no hook for \"use these retry options for a request where the body satisfies some predicate, and use these other retry options if not\"" ]
https://api.github.com/repos/psf/requests/issues/5841
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5841/labels{/name}
https://api.github.com/repos/psf/requests/issues/5841/comments
https://api.github.com/repos/psf/requests/issues/5841/events
https://github.com/psf/requests/issues/5841
921,140,855
MDU6SXNzdWU5MjExNDA4NTU=
5,841
Custom auth with Oauth2 password authentication flow does not seem to work
{ "avatar_url": "https://avatars.githubusercontent.com/u/70274528?v=4", "events_url": "https://api.github.com/users/scd75/events{/privacy}", "followers_url": "https://api.github.com/users/scd75/followers", "following_url": "https://api.github.com/users/scd75/following{/other_user}", "gists_url": "https://api.github.com/users/scd75/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/scd75", "id": 70274528, "login": "scd75", "node_id": "MDQ6VXNlcjcwMjc0NTI4", "organizations_url": "https://api.github.com/users/scd75/orgs", "received_events_url": "https://api.github.com/users/scd75/received_events", "repos_url": "https://api.github.com/users/scd75/repos", "site_admin": false, "starred_url": "https://api.github.com/users/scd75/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/scd75/subscriptions", "type": "User", "url": "https://api.github.com/users/scd75", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-06-15T08:27:09Z
2021-09-13T12:00:49Z
2021-06-15T11:25:54Z
NONE
resolved
Summary. I am trying to implement a OAuth2 password flow authentication process with Requests. I then rely on a Custom AUthentication method as I could not find any built-in method. Is there any? Yet, while the prepared request seems to be fine, the final requets did not seem to pick up the header, as I get a "not authorised" error. What you expected. ## Actual Result What happened instead. ## Reproduction Steps ```python import requests import os from requests.auth import AuthBase username= os.environ['ADMIN_LOGIN'], password= os.environ['ADMIN_PWD'], class CustomAuth(AuthBase): """Attaches Oauth2 password Authentication to the given Request object.""" def __init__(self, username, password): # setup any auth-related data here auth_response = requests.post( url = os.environ['APP_URL'] +'/api/v1/login/access-token', data = { 'username': username, 'password': password, } ).json() self.token = auth_response['access_token'] def __call__(self, r): # modify and return the request r.headers['Authorization'] = 'bearer ' + self.token print(r.headers) return r response = requests.get( url = os.environ['APP_URL'] +'/api/v1/orders', auth= CustomAuth(username, password) ) print(response, response.content) ``` Output: ``` {'User-Agent': 'python-requests/2.25.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjM3NDczNjgsInN1YiI6IjEifQ.UVDa1sfbbWByXkUWGFqSrLIN9L-0JKNepUm9BZBe5SE'} <Response [401]> b'{"detail":"Not authenticated"}' ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.5" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.5" }, "using_pyopenssl": false } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5841/reactions" }
https://api.github.com/repos/psf/requests/issues/5841/timeline
null
completed
null
null
false
[ "Have you tried requests-oauthlib?", "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5840
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5840/labels{/name}
https://api.github.com/repos/psf/requests/issues/5840/comments
https://api.github.com/repos/psf/requests/issues/5840/events
https://github.com/psf/requests/issues/5840
917,378,759
MDU6SXNzdWU5MTczNzg3NTk=
5,840
http call throwing error in background mode
{ "avatar_url": "https://avatars.githubusercontent.com/u/16843102?v=4", "events_url": "https://api.github.com/users/ujjaldey/events{/privacy}", "followers_url": "https://api.github.com/users/ujjaldey/followers", "following_url": "https://api.github.com/users/ujjaldey/following{/other_user}", "gists_url": "https://api.github.com/users/ujjaldey/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ujjaldey", "id": 16843102, "login": "ujjaldey", "node_id": "MDQ6VXNlcjE2ODQzMTAy", "organizations_url": "https://api.github.com/users/ujjaldey/orgs", "received_events_url": "https://api.github.com/users/ujjaldey/received_events", "repos_url": "https://api.github.com/users/ujjaldey/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ujjaldey/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ujjaldey/subscriptions", "type": "User", "url": "https://api.github.com/users/ujjaldey", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-10T13:57:30Z
2021-06-10T21:55:38Z
2021-06-10T21:55:14Z
NONE
off-topic
I am trying to make an HTTP call using `python-requests`. When I am running the script in the background as `python main.py &`, it works perfectly ok. But as soon as I close the terminal, it starts giving me the error "_[Errno 5] Input/output error_". The process keeps running in the background. Any idea how to make the HTTP call while running the python script in the background (and no terminal open)? My sample code: ``` import logging import time import requests logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO,filename='log.log') logger = logging.getLogger(__name__) def make_req() -> None: res = requests.get('https://w3schools.com/python/demopage.htm') return res.text def main() -> None: logger.info("----------------------------------------------") try: out = make_req() print(out) logger.info(out) except Exception as e: logger.error("-->"+ str(e)) if __name__ == '__main__': while True: main() time.sleep(5) ``` Output: ``` 2021-06-10 14:03:51,840 - __main__ - INFO - ---------------------------------------------- 2021-06-10 14:03:52,061 - __main__ - ERROR - -->[Errno 5] Input/output error 2021-06-10 14:03:57,081 - __main__ - INFO - ---------------------------------------------- 2021-06-10 14:03:57,317 - __main__ - ERROR - -->[Errno 5] Input/output error ``` Thanks in advance.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5840/reactions" }
https://api.github.com/repos/psf/requests/issues/5840/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5839
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5839/labels{/name}
https://api.github.com/repos/psf/requests/issues/5839/comments
https://api.github.com/repos/psf/requests/issues/5839/events
https://github.com/psf/requests/issues/5839
917,319,899
MDU6SXNzdWU5MTczMTk4OTk=
5,839
Need Help Understanding the project structure.
{ "avatar_url": "https://avatars.githubusercontent.com/u/85453780?v=4", "events_url": "https://api.github.com/users/ujjwaltwitx/events{/privacy}", "followers_url": "https://api.github.com/users/ujjwaltwitx/followers", "following_url": "https://api.github.com/users/ujjwaltwitx/following{/other_user}", "gists_url": "https://api.github.com/users/ujjwaltwitx/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ujjwaltwitx", "id": 85453780, "login": "ujjwaltwitx", "node_id": "MDQ6VXNlcjg1NDUzNzgw", "organizations_url": "https://api.github.com/users/ujjwaltwitx/orgs", "received_events_url": "https://api.github.com/users/ujjwaltwitx/received_events", "repos_url": "https://api.github.com/users/ujjwaltwitx/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ujjwaltwitx/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ujjwaltwitx/subscriptions", "type": "User", "url": "https://api.github.com/users/ujjwaltwitx", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-10T13:01:45Z
2021-10-05T14:19:30Z
2021-07-07T13:28:50Z
NONE
resolved
I am a begineer so, I need help understanding the project so that I could contribute.
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 2, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 2, "rocket": 0, "total_count": 4, "url": "https://api.github.com/repos/psf/requests/issues/5839/reactions" }
https://api.github.com/repos/psf/requests/issues/5839/timeline
null
completed
null
null
false
[ "Unfortunately this isn't the place to ask this question, as this issue tracker is reserved for defects in Requests. Our project structure isn't too complicated / non-standard, continue to do studying and research online and you will figure it out." ]
https://api.github.com/repos/psf/requests/issues/5838
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5838/labels{/name}
https://api.github.com/repos/psf/requests/issues/5838/comments
https://api.github.com/repos/psf/requests/issues/5838/events
https://github.com/psf/requests/issues/5838
913,672,421
MDU6SXNzdWU5MTM2NzI0MjE=
5,838
Requests
{ "avatar_url": "https://avatars.githubusercontent.com/u/85451796?v=4", "events_url": "https://api.github.com/users/Bombaleya/events{/privacy}", "followers_url": "https://api.github.com/users/Bombaleya/followers", "following_url": "https://api.github.com/users/Bombaleya/following{/other_user}", "gists_url": "https://api.github.com/users/Bombaleya/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Bombaleya", "id": 85451796, "login": "Bombaleya", "node_id": "MDQ6VXNlcjg1NDUxNzk2", "organizations_url": "https://api.github.com/users/Bombaleya/orgs", "received_events_url": "https://api.github.com/users/Bombaleya/received_events", "repos_url": "https://api.github.com/users/Bombaleya/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Bombaleya/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Bombaleya/subscriptions", "type": "User", "url": "https://api.github.com/users/Bombaleya", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-06-07T15:24:17Z
2021-06-07T15:41:10Z
2021-06-07T15:41:02Z
NONE
null
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5838/reactions" }
https://api.github.com/repos/psf/requests/issues/5838/timeline
null
completed
null
null
false
[]
https://api.github.com/repos/psf/requests/issues/5837
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5837/labels{/name}
https://api.github.com/repos/psf/requests/issues/5837/comments
https://api.github.com/repos/psf/requests/issues/5837/events
https://github.com/psf/requests/issues/5837
912,888,083
MDU6SXNzdWU5MTI4ODgwODM=
5,837
How can i get the network cache. i need a to get a link from there that changing every few seconds
{ "avatar_url": "https://avatars.githubusercontent.com/u/73111474?v=4", "events_url": "https://api.github.com/users/Godwhitelight/events{/privacy}", "followers_url": "https://api.github.com/users/Godwhitelight/followers", "following_url": "https://api.github.com/users/Godwhitelight/following{/other_user}", "gists_url": "https://api.github.com/users/Godwhitelight/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Godwhitelight", "id": 73111474, "login": "Godwhitelight", "node_id": "MDQ6VXNlcjczMTExNDc0", "organizations_url": "https://api.github.com/users/Godwhitelight/orgs", "received_events_url": "https://api.github.com/users/Godwhitelight/received_events", "repos_url": "https://api.github.com/users/Godwhitelight/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Godwhitelight/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Godwhitelight/subscriptions", "type": "User", "url": "https://api.github.com/users/Godwhitelight", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-06T16:54:05Z
2021-06-06T17:14:40Z
2021-06-06T17:09:27Z
NONE
spam
Help please
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5837/reactions" }
https://api.github.com/repos/psf/requests/issues/5837/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here." ]
https://api.github.com/repos/psf/requests/issues/5836
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5836/labels{/name}
https://api.github.com/repos/psf/requests/issues/5836/comments
https://api.github.com/repos/psf/requests/issues/5836/events
https://github.com/psf/requests/issues/5836
910,143,762
MDU6SXNzdWU5MTAxNDM3NjI=
5,836
post failed with 405 on macos 11.4 if data is larger than 65828
{ "avatar_url": "https://avatars.githubusercontent.com/u/5899962?v=4", "events_url": "https://api.github.com/users/dwSun/events{/privacy}", "followers_url": "https://api.github.com/users/dwSun/followers", "following_url": "https://api.github.com/users/dwSun/following{/other_user}", "gists_url": "https://api.github.com/users/dwSun/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dwSun", "id": 5899962, "login": "dwSun", "node_id": "MDQ6VXNlcjU4OTk5NjI=", "organizations_url": "https://api.github.com/users/dwSun/orgs", "received_events_url": "https://api.github.com/users/dwSun/received_events", "repos_url": "https://api.github.com/users/dwSun/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dwSun/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dwSun/subscriptions", "type": "User", "url": "https://api.github.com/users/dwSun", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-06-03T06:22:22Z
2021-11-26T03:00:38Z
2021-08-28T02:20:27Z
NONE
resolved
Summary. post failed with 405 on macos 11.4 if data is larger than 65828 ## Reproduction Steps server.py ```python #!/usr/bin/env python3 # -*- coding: utf-8 -*- import json from flask import Flask, request app = Flask(__name__) @app.route("/<url>", methods=["POST", "OPTIONS"]) def url(url): print("[{0}] accessed".format(url)) data = request.data data = json.loads(data) return ( json.dumps({"code": 0, "msg": "ok"}), 200, {"Content-Type": "application/json; charset=utf-8"}, ) if __name__ == "__main__": app.run(host="0.0.0.0", port=5000, debug=True) ``` test.py ```python #!/usr/bin/env python3 # -*- coding: utf-8 -*- import requests def test_api(server, count=10, log=True): try: if log: print("access [{}] with [{}]".format(server, count)) r = requests.post( "http://{}:5000/some_url".format(server), json={"data": "0" * count}, ) assert r.status_code == 200, "failed with [{}]".format(r.status_code) r = r.json(encoding="utf-8") return True except Exception as ex: print("[{}] failed [{}] [{}]".format(server, ex, count)) return False def run_api(server): print("#" * 20) for i in range(65800, 65900): if not test_api(server, i, log=False): break if __name__ == "__main__": linux = "192.168.8.153" macos_11_4 = "192.168.8.107" windows = "192.168.8.127" run_api(linux) run_api(macos_11_4) run_api(windows) ``` - 1 run server.py on windows, macos_11.4 and linux - 2 run test.py on windows, macos_11.4 and linux - 3 run test.py on macos_11.2.3 only on macos_11.4, test.py failed: ```sh #################### [192.168.8.153] failed [('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))] [65828] #################### [192.168.8.107] failed [('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))] [65828] #################### [192.168.8.127] failed [('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))] [65828] ``` server.py logs: ```sh 192.168.8.107 - - [03/Jun/2021 14:15:59] "POST /some_url HTTP/1.1" 200 - 192.168.8.107 - - [03/Jun/2021 14:15:59] "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}POST /some_url HTTP/1.1" 405 - ``` also tried requests 2.24.0 on macos_11.4, same error ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.6.13" }, "platform": { "release": "20.5.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.5" }, "using_pyopenssl": false } ``` postman and golang works without error when use data larger than 65828 on macos_11.4
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5836/reactions" }
https://api.github.com/repos/psf/requests/issues/5836/timeline
null
completed
null
null
false
[ "@dwSun, your server logs show the server is responding with a 405 Method Not Allowed. The server appears to be responding as soon as the request is received and closing the connection. Requests is still writing the original request body when the connection is closed by the flask server, resulting in the ConnectionResetError. This doesn't appear to be a defect in Requests." ]
https://api.github.com/repos/psf/requests/issues/5835
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5835/labels{/name}
https://api.github.com/repos/psf/requests/issues/5835/comments
https://api.github.com/repos/psf/requests/issues/5835/events
https://github.com/psf/requests/pull/5835
907,834,956
MDExOlB1bGxSZXF1ZXN0NjU4NjE1OTEx
5,835
Fix GitHub links
{ "avatar_url": "https://avatars.githubusercontent.com/u/167821?v=4", "events_url": "https://api.github.com/users/fmarier/events{/privacy}", "followers_url": "https://api.github.com/users/fmarier/followers", "following_url": "https://api.github.com/users/fmarier/following{/other_user}", "gists_url": "https://api.github.com/users/fmarier/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/fmarier", "id": 167821, "login": "fmarier", "node_id": "MDQ6VXNlcjE2NzgyMQ==", "organizations_url": "https://api.github.com/users/fmarier/orgs", "received_events_url": "https://api.github.com/users/fmarier/received_events", "repos_url": "https://api.github.com/users/fmarier/repos", "site_admin": false, "starred_url": "https://api.github.com/users/fmarier/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/fmarier/subscriptions", "type": "User", "url": "https://api.github.com/users/fmarier", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-06-01T03:29:22Z
2021-08-31T00:07:04Z
2021-06-01T04:23:54Z
CONTRIBUTOR
resolved
All of these links now redirect to a repo under a different GitHub user account. Not sure whether you want to update the changelog, but I'm happy to amend this PR if you'd rather not change `HISTORY.md`.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5835/reactions" }
https://api.github.com/repos/psf/requests/issues/5835/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5835.diff", "html_url": "https://github.com/psf/requests/pull/5835", "merged_at": "2021-06-01T04:23:54Z", "patch_url": "https://github.com/psf/requests/pull/5835.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5835" }
true
[ "Thanks for the PR, @fmarier! Let’s leave the change log alone for now. I’m fine fixing the other references in the docs though.", "I've removed the changelog from this PR.", "Hmm, tests are failing on Python 3.6+ but it's obviously not related to this PR. Looks like something has broken in the last couple weeks. The only change I can see if urllib3 releasing a new version. We'll track that in a separate issue. Thanks again!" ]
https://api.github.com/repos/psf/requests/issues/5834
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5834/labels{/name}
https://api.github.com/repos/psf/requests/issues/5834/comments
https://api.github.com/repos/psf/requests/issues/5834/events
https://github.com/psf/requests/issues/5834
906,861,512
MDU6SXNzdWU5MDY4NjE1MTI=
5,834
Minor: pip install complains (not fails) with current
{ "avatar_url": "https://avatars.githubusercontent.com/u/3092067?v=4", "events_url": "https://api.github.com/users/griswolf/events{/privacy}", "followers_url": "https://api.github.com/users/griswolf/followers", "following_url": "https://api.github.com/users/griswolf/following{/other_user}", "gists_url": "https://api.github.com/users/griswolf/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/griswolf", "id": 3092067, "login": "griswolf", "node_id": "MDQ6VXNlcjMwOTIwNjc=", "organizations_url": "https://api.github.com/users/griswolf/orgs", "received_events_url": "https://api.github.com/users/griswolf/received_events", "repos_url": "https://api.github.com/users/griswolf/repos", "site_admin": false, "starred_url": "https://api.github.com/users/griswolf/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/griswolf/subscriptions", "type": "User", "url": "https://api.github.com/users/griswolf", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-05-30T19:38:43Z
2021-08-29T00:06:35Z
2021-05-30T19:44:36Z
NONE
resolved
Summary. During pip install -U requests this message is sent to the terminal: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. requests 2.25.1 requires idna<3,>=2.5, but you have idna 3.2 which is incompatible. ## Expected Result No such message ## Actual Result See above ## Reproduction Steps pip install -U idna re ## System Information { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "3.2" }, "implementation": { "name": "CPython", "version": "3.9.5" }, "platform": { "release": "19.6.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.5" }, "using_pyopenssl": false }
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5834/reactions" }
https://api.github.com/repos/psf/requests/issues/5834/timeline
null
completed
null
null
false
[ "We're aware, please look for existing issues before opening new ones. " ]
https://api.github.com/repos/psf/requests/issues/5833
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5833/labels{/name}
https://api.github.com/repos/psf/requests/issues/5833/comments
https://api.github.com/repos/psf/requests/issues/5833/events
https://github.com/psf/requests/issues/5833
904,032,198
MDU6SXNzdWU5MDQwMzIxOTg=
5,833
Discrepancies between self-prepared and session-prepared request headers
{ "avatar_url": "https://avatars.githubusercontent.com/u/28784688?v=4", "events_url": "https://api.github.com/users/rittneje/events{/privacy}", "followers_url": "https://api.github.com/users/rittneje/followers", "following_url": "https://api.github.com/users/rittneje/following{/other_user}", "gists_url": "https://api.github.com/users/rittneje/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/rittneje", "id": 28784688, "login": "rittneje", "node_id": "MDQ6VXNlcjI4Nzg0Njg4", "organizations_url": "https://api.github.com/users/rittneje/orgs", "received_events_url": "https://api.github.com/users/rittneje/received_events", "repos_url": "https://api.github.com/users/rittneje/repos", "site_admin": false, "starred_url": "https://api.github.com/users/rittneje/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/rittneje/subscriptions", "type": "User", "url": "https://api.github.com/users/rittneje", "user_view_type": "public" }
[]
open
false
null
[]
null
9
2021-05-27T17:50:01Z
2022-01-06T12:57:11Z
null
NONE
null
If we prepare a request normally (the `prepare()` method), it does not include any additional headers by default, even if the resulting prepared request is sent via a session. However, if the request is prepared via the session (the `prepare_request(Request)` method), then it will include a few headers by default: `Accept`, `Accept-Encoding`, `User-Agent`, and `Connection`. There are some (arguably buggy) HTTP servers that apparently will reject any request that includes the `Accept` or `Accept-Encoding` header with 406 Not Acceptable. This situation led to major confusion when trying to fix our usage of this library to send all the requests through a single session in order to leverage cookie handling. This default header logic does not appear to be documented anywhere. I also think it is very confusing that a self-prepared request and a session-prepared request would have different headers. Unfortunately, I assume this cannot be changed easily for fear of breaking backwards compatibility.
null
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5833/reactions" }
https://api.github.com/repos/psf/requests/issues/5833/timeline
null
null
null
null
false
[ "I'm fairly certain this was at one point covered in our docs. With that in mind, why is this a _bug report_? How can you expect `Request.prepare()` to do something with session state when it doesn't have access to the session?", "`Accept`, `Accept-Encoding`, and `User-Agent` have nothing to do with session state. Only the `Connection: keep-alive` header really makes sense to be different since without a session I assume there's no pool.", "Except that commonly people set these on the session and expect them to be session-level state. I think this is complicated by the fact that `Request.prepare()` is primarily used by folks who want complete control over their headers and everything else. This is why `Session.prepare_request()` was introduced - to do the things some people think should just :sparkes: magically :sparkles: happen and might be the \"only right\" behaviour (in their expectation). \r\n\r\nAt one point this was documented roughly as:\r\n\r\n- `Request.prepare()` + `Session.send()` is complete control and `Session.send()` shouldn't really be tacking on anything extra\r\n- `Request` + `Session.prepare_request()` + `Session.send()` has more control but also does the things that you might want Requests to handle (like reasonable default headers and applying session state)\r\n- `Session.request` (and friends) is for folks that don't need a more complex way of building requests\r\n- `requests.request` (and friends) is for quickstart and other quick usage that doesn't need session state persisted between requests\r\n\r\nI can see where you're coming from, but it's not backwards compatible nor is it how it was designed or documented", "To clarify, what I consider the issue here is not the existence of `Session.headers` itself, as in the ability to set headers on the session that get auto-applied to all requests. Rather, the issue is the default `Session.headers`, which (except for `Connection`) seem completely arbitrary, so it is very confusing why they are the defaults at all.\r\n\r\nAt the very least I think these default headers should be mentioned in the documentation, since for me at least it was entirely unexpected and undesirable.", "If it's not already documented, I'd merge a PR with that addition.", "Definitely an issue, I can't disable User-Agent in a Session context even with a prepared request : \r\n![cancer useragent](https://upload.illya.network/_files/3pylf37a.png)", "You can remove it after the fact:\r\n\r\n\r\n```py\r\nreq = requests.Request(...)\r\nprepared = session.prepare_request(req)\r\ndel prepared.headers['User-Agent']\r\nsession.send(prepared)\r\n```", "> You can remove it after the fact:\r\n> \r\n> ```python\r\n> req = requests.Request(...)\r\n> prepared = session.prepare_request(req)\r\n> del prepared.headers['User-Agent']\r\n> session.send(prepared)\r\n> ```\r\n\r\nSame issue : \r\n![](https://upload.illya.network/_files/udgacn1n.png)\r\n![](https://upload.illya.network/_files/8v6fucl8.png)", "Ah, right. Unfortunately the API right now is too limited to allow us to provide a clean way around what urllib3 does by default now (where if I remember correctly they want a sentinel value)." ]
https://api.github.com/repos/psf/requests/issues/5832
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5832/labels{/name}
https://api.github.com/repos/psf/requests/issues/5832/comments
https://api.github.com/repos/psf/requests/issues/5832/events
https://github.com/psf/requests/issues/5832
903,936,455
MDU6SXNzdWU5MDM5MzY0NTU=
5,832
What is the correct way to use requests.Session with celery ??
{ "avatar_url": "https://avatars.githubusercontent.com/u/17484350?v=4", "events_url": "https://api.github.com/users/jackton1/events{/privacy}", "followers_url": "https://api.github.com/users/jackton1/followers", "following_url": "https://api.github.com/users/jackton1/following{/other_user}", "gists_url": "https://api.github.com/users/jackton1/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jackton1", "id": 17484350, "login": "jackton1", "node_id": "MDQ6VXNlcjE3NDg0MzUw", "organizations_url": "https://api.github.com/users/jackton1/orgs", "received_events_url": "https://api.github.com/users/jackton1/received_events", "repos_url": "https://api.github.com/users/jackton1/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jackton1/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jackton1/subscriptions", "type": "User", "url": "https://api.github.com/users/jackton1", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-05-27T15:54:23Z
2021-11-04T00:00:31Z
2021-06-16T23:41:08Z
NONE
resolved
I have a fairly basic setup of celery running on `4.4.6` and `requests[security]` `2.24.0` most of the task look like. ```py @app.task(bind=True) def get_some_data_from_a_server_and_update_records(self, ...): # Make a request using requests via a Session that is maintained by the instance of the SDK my_sdk_client = Client() response = my_sdk_client.session.get(...) # Update my database ``` Django celery settings ```py # Celery CELERY_BROKER_URL = REDIS_URL CELERY_RESULT_BACKEND = REDIS_URL CELERY_TASK_QUEUES = ( Queue('critical', Exchange('critical'), routing_key='critical'), Queue('high', Exchange('high'), routing_key='high'), Queue('medium', Exchange('medium'), routing_key='medium'), Queue('low', Exchange('low'), routing_key='low'), ) CELERY_TASK_DEFAULT_QUEUE = 'medium' CELERY_TASK_IGNORE_RESULT = True CELERY_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERY_WORKER_HIJACK_ROOT_LOGGER = False CELERY_WORKER_POOL = 'threads' ``` Which runs on GKE using multiple pods i.e 8 - 10 pods with each worker reading from a dedicated queue Unfortunately this results in a number of `ConnectionErrors` as shown below ```py File /venv/lib/python3.6/site-packages/requests/sessions.py line 578 in post return self.request('POST', url, data=data, json=json, **kwargs) File /venv/lib/python3.6/site-packages/requests/sessions.py line 530 in request resp = self.send(prep, **send_kwargs) File /venv/lib/python3.6/site-packages/requests/sessions.py line 643 in send r = adapter.send(request, **kwargs) File /venv/lib/python3.6/site-packages/requests/adapters.py line 498 in send args locals raise ConnectionError(err, request=request) ConnectionError: ('Connection aborted.', OSError(0, 'Error')) ProtocolError: ('Connection aborted.', OSError(0, 'Error')) (Most recent call last) ``` The current docs don't highlight this which seems like a common use case and is currently a pain point. Based: https://github.com/psf/requests/issues/4323 Most debate around this has been about the lack of multiprocess safety using requests or ensuring you use a single Session per thread/process which doesn't seem feasible when you interact with more than one endpoint or initialize multiple Sessions in different tasks. We switched our execution pool to use `threads` but this doesn't solve the issue. # Suggestions - Expect a better setup documentation that clearly states any limitations running in a distributed application like celery. - How to work with celery and `requests` or `urllib3` - A Recommended execution pool based on how celery is intended to be used. i.e `prefork` vs `threads` or `gevent` / `eventlet`. ## Package Versions: ``` celery[redis]==4.4.6 # via coherentpath (setup.py), django-celery-beat, flower certifi==2019.11.28 # via requests, urllib3 cffi==1.13.2 # via bcrypt, cryptography, pynacl chardet==3.0.4 # via aiohttp, requests cryptography==3.3.2 # via django-cryptography, paramiko, pyopenssl, requests, urllib3 django-celery-beat==2.0.0 # via coherentpath (setup.py) django-timezone-field==4.1.1 # via coherentpath (setup.py), django-celery-beat future==0.18.2 # via celery, django-json-widget, python-jose humanize==0.5.1 # via flower idna-ssl==1.1.0 # via aiohttp idna==2.6 # via idna-ssl, jsonschema, requests, urllib3, yarl importlib-metadata==1.6.0 # via kombu, scout-apm kombu==4.6.11 # via celery oauthlib==3.1.0 # via django-oauth-toolkit, requests-oauthlib psycopg2==2.7.3.1 # via coherentpath (setup.py) pycparser==2.19 # via cffi pyopenssl==19.1.0 # via requests, urllib3 pyparsing==2.4.7 # via httplib2, packaging python-crontab==2.5.1 # via django-celery-beat python-dateutil==2.8.1 # via jsonmodels, pandas, python-crontab redis==3.5.3 # via celery requests-toolbelt==0.9.1 # via zeep requests[security]==2.24.0 urllib3[secure]==1.25.11 # via pdpyras, requests, scout-apm, selenium vine==1.3.0 # via amqp, celery ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/17484350?v=4", "events_url": "https://api.github.com/users/jackton1/events{/privacy}", "followers_url": "https://api.github.com/users/jackton1/followers", "following_url": "https://api.github.com/users/jackton1/following{/other_user}", "gists_url": "https://api.github.com/users/jackton1/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jackton1", "id": 17484350, "login": "jackton1", "node_id": "MDQ6VXNlcjE3NDg0MzUw", "organizations_url": "https://api.github.com/users/jackton1/orgs", "received_events_url": "https://api.github.com/users/jackton1/received_events", "repos_url": "https://api.github.com/users/jackton1/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jackton1/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jackton1/subscriptions", "type": "User", "url": "https://api.github.com/users/jackton1", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5832/reactions" }
https://api.github.com/repos/psf/requests/issues/5832/timeline
null
completed
null
null
false
[ "I've worked on products with several hundreds of thousands of tasks per minute running using requests and Sessions, API clients, etc. and never had this problem. \r\n\r\nWhat exactly should we be highlighting in particular in your opinion? The issue you linked if I remember correctly wanted to share the connection pool across the processes which isn't wise anyway. Are you pre-configuring all of your clients before celery forks? ", "Not sure how the clients need to be pre-configured ??\r\n\r\nBut basically using a client like\r\n\r\n```py\r\nclass APIClient(object):\r\n \r\n\tdef __init__(...):\r\n ...\r\n self._session = None\r\n\r\n\r\n @property\r\n def session(...):\r\n if not self._session:\r\n self._session = requests.Session()\r\n \r\n return self._session\r\n\r\n```\r\n\r\nAlso changed the current execution pool from `prefork` to `thread` or `threads`\r\n\r\nhttps://docs.celeryproject.org/en/v4.4.6/userguide/workers.html#remote-control\r\n\r\nAfter noticing a similar ConnectionError testing with `ProcessPoolExecutor`\r\n\r\nPython 2.7\r\n\r\n```python\r\n=================================== FAILURES ===================================\r\n ________________________ ***_multi_process_sessions[2] ________________________\r\n \r\n process_pool = <concurrent.futures.process.ProcessPoolExecutor object at 0x7f4f119b6a50>\r\n \r\n def ***_multi_process_sessions(process_pool):\r\n jobs = 3\r\n > result = list(process_pool.map(run, range(jobs)))\r\n \r\n ***s/integration/***_vault.py:101: \r\n _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n .tox/py27/lib/python2.7/site-packages/concurrent/futures/_base.py:641: in result_iterator\r\n yield fs.pop().result()\r\n .tox/py27/lib/python2.7/site-packages/concurrent/futures/_base.py:455: in result\r\n return self.__get_result()\r\n _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n \r\n self = <Future at 0x7f4f118b53d0 state=finished raised ConnectionError>\r\n \r\n def __get_result(self):\r\n if self._exception:\r\n if isinstance(self._exception, types.InstanceType):\r\n # The exception is an instance of an old-style class, which\r\n # means type(self._exception) returns types.ClassType instead\r\n # of the exception's actual class type.\r\n exception_type = self._exception.__class__\r\n else:\r\n exception_type = type(self._exception)\r\n > raise exception_type, self._exception, self._traceback\r\n E ConnectionError: ('Connection aborted.', BadStatusLine('No status line received - the server has closed the connection',))\r\n```\r\n\r\nPython 3\r\n\r\n```python\r\n \r\n Traceback (most recent call last):\r\n File \"/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/concurrent/futures/process.py\", line 175, in _process_worker\r\n r = call_item.fn(*call_item.args, **call_item.kwargs)\r\n File \"/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/concurrent/futures/process.py\", line 153, in _process_chunk\r\n return [fn(*args) for args in chunk]\r\n File \"/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/concurrent/futures/process.py\", line 153, in <listcomp>\r\n return [fn(*args) for args in chunk]\r\n File \".../***s/integration/***y\", line 94, in run\r\n\t\t...\r\n File \".../....py\", line 43, in __init__\r\n self.token = self.adapter.get_token(self)\r\n File \".../adapters/vault.py\", line 53, in get_token\r\n timeout=config.timeout,\r\n File \".../.tox/py36/lib/python3.6/site-packages/requests/sessions.py\", line 578, in post\r\n return self.request('POST', url, data=data, json=json, **kwargs)\r\n File \".../.tox/py36/lib/python3.6/site-packages/requests/sessions.py\", line 530, in request\r\n resp = self.send(prep, **send_kwargs)\r\n File \".../.tox/py36/lib/python3.6/site-packages/requests/sessions.py\", line 643, in send\r\n r = adapter.send(request, **kwargs)\r\n File \".../.tox/py36/lib/python3.6/site-packages/requests/adapters.py\", line 498, in send\r\n raise ConnectionError(err, request=request)\r\n requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))\r\n \"\"\"\r\n \r\n The above exception was the direct cause of the following exception:\r\n \r\n process_pool = <concurrent.futures.process.ProcessPoolExecutor object at 0x7fa6f6e90a20>\r\n \r\n def ***_multi_process_sessions(process_pool):\r\n jobs = 3\r\n > result = list(process_pool.map(run, range(jobs)))\r\n```\r\n\r\n\r\nThis is setup using a single process and concurrency of 1 thread per pod with up to 14 replicas\r\n\r\nUsing:\r\n\r\n```\r\ncelery -A myapp worker -l info -c 1 -Q critical,high\r\n```\r\n \r\n```\r\n[ Session(), Session(), ... ] POD 1, thread x\r\n[ Session(), Session(), ... ] POD 2, thread y\r\n[ Session(), Session(), ... ] POD 3, thread z\r\n```\r\n", "After much digging into this seems the design of the Session object is one that should be re-designed because this forces you to start managing the Session object minimizing the number of instances created per thread or process.\r\n\r\n" ]
https://api.github.com/repos/psf/requests/issues/5831
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5831/labels{/name}
https://api.github.com/repos/psf/requests/issues/5831/comments
https://api.github.com/repos/psf/requests/issues/5831/events
https://github.com/psf/requests/issues/5831
903,562,243
MDU6SXNzdWU5MDM1NjIyNDM=
5,831
Root CA not initialized if running in threads the first time
{ "avatar_url": "https://avatars.githubusercontent.com/u/1155039?v=4", "events_url": "https://api.github.com/users/freegroup/events{/privacy}", "followers_url": "https://api.github.com/users/freegroup/followers", "following_url": "https://api.github.com/users/freegroup/following{/other_user}", "gists_url": "https://api.github.com/users/freegroup/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/freegroup", "id": 1155039, "login": "freegroup", "node_id": "MDQ6VXNlcjExNTUwMzk=", "organizations_url": "https://api.github.com/users/freegroup/orgs", "received_events_url": "https://api.github.com/users/freegroup/received_events", "repos_url": "https://api.github.com/users/freegroup/repos", "site_admin": false, "starred_url": "https://api.github.com/users/freegroup/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/freegroup/subscriptions", "type": "User", "url": "https://api.github.com/users/freegroup", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-05-27T11:05:38Z
2022-02-26T06:00:24Z
2021-11-28T05:27:17Z
NONE
resolved
I want use mTLS for a server connection. If I start this in an thread, I get a connection refused message. If I call them once in the main thread and then in the spawned thread, everything is fine. It seems, that the RootCA is not initialized correct if I use them the first time within a thread. ## Reproduction Steps ```python import requests thread = None stop_sync = False def prooftoken_thread(): while not stop_sync: with lock: print("sync") response = requests.get(PROOFTOKEN_URL, allow_redirects=True, cert=("./secrets/certificate", "./secrets/key")) print(response.json()) time.sleep(10) if __name__ == '__main__': if PROOFTOKEN_URL: print("start proof token sync job with URL: {}".format(PROOFTOKEN_URL)) ################################### # remove this line and the thread will fail response = requests.get(PROOFTOKEN_URL, allow_redirects=True, cert=("./secrets/certificate", "./secrets/key")) ################################### thread = threading.Thread(target=prooftoken_thread, daemon=True) thread.start() else: print("No 'prooftoken_url' found. Running in 'app-only' mode.") print("AuthZ Server Up and running") app.run(host='0.0.0.0', port=8080, debug=False, threaded=False) ``` StackTrace in case of failure ``` Exception in thread Thread-2: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn conn = connection.create_connection( File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection raise err File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn conn.connect() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect conn = self._new_conn() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fa17cce1f10>: Failed to establish a new connection: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='eu-osb.accounts400.ondemand.com', port=443): Max retries exceeded with url: /sap/cp-kernel/identity/v1/prooftoken/1c30c40e-c434-41c1-a068-2036c08d2bb2/v2 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa17cce1f10>: Failed to establish a new connection: [Errno 111] Connection refused')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/local/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "src/main.py", line 137, in prooftoken_thread response = requests.get(PROOFTOKEN_URL, allow_redirects=True, cert=("./secrets/certificate", "./secrets/key")) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 76, in get return request('get', url, params=params, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='eu-osb.accounts400.ondemand.com', port=443): Max retries exceeded with url: /sap/cp-kernel/identity/v1/prooftoken/1c30c40e-c434-41c1-a068-2036c08d2bb2/v2 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa17cce1f10>: Failed to establish a new connection: [Errno 111] Connection refused')) ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.2" }, "platform": { "release": "20.4.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.4" }, "using_pyopenssl": false } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5831/reactions" }
https://api.github.com/repos/psf/requests/issues/5831/timeline
null
completed
null
null
false
[ "I get errors in the thread until I *init* the `certifi` lib in the main thread.\r\n\r\n```python\r\n import certifi\r\n print(certifi.where())\r\n```\r\n\r\nAfter the call of the statement above the errors in the thread are gone....\r\n\r\nIt seems that the `certifi` is not initialized correct.\r\n\r\n", "This isn't an issue with Requests, likely only can be fixed in Certifi itself." ]
https://api.github.com/repos/psf/requests/issues/5830
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5830/labels{/name}
https://api.github.com/repos/psf/requests/issues/5830/comments
https://api.github.com/repos/psf/requests/issues/5830/events
https://github.com/psf/requests/issues/5830
903,471,354
MDU6SXNzdWU5MDM0NzEzNTQ=
5,830
JSON parameter string in requests.post
{ "avatar_url": "https://avatars.githubusercontent.com/u/33341167?v=4", "events_url": "https://api.github.com/users/L-lei/events{/privacy}", "followers_url": "https://api.github.com/users/L-lei/followers", "following_url": "https://api.github.com/users/L-lei/following{/other_user}", "gists_url": "https://api.github.com/users/L-lei/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/L-lei", "id": 33341167, "login": "L-lei", "node_id": "MDQ6VXNlcjMzMzQxMTY3", "organizations_url": "https://api.github.com/users/L-lei/orgs", "received_events_url": "https://api.github.com/users/L-lei/received_events", "repos_url": "https://api.github.com/users/L-lei/repos", "site_admin": false, "starred_url": "https://api.github.com/users/L-lei/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/L-lei/subscriptions", "type": "User", "url": "https://api.github.com/users/L-lei", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-05-27T09:35:56Z
2021-08-27T00:08:18Z
2021-05-27T21:45:52Z
NONE
resolved
Shouldn't the content of JSON parameters be judged by type? isinstance(json_content,dict) res = requests.post(url=url,json='{"a":1}'),In this way, the receiver needs to deserialize JSON twice to get the data
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5830/reactions" }
https://api.github.com/repos/psf/requests/issues/5830/timeline
null
completed
null
null
false
[ "No, it's clearly documented as something that _will_ be JSON serialized with a JSON library. That means what you pass in will be passed to a serializer. Some people may want to pass a string and have that properly serialized. What would you expect to happen if we you did `json=\"Some text\"`? That should be `\"\\\"Some text\\\"\"` otherwise a server will never deserialize it properly." ]
https://api.github.com/repos/psf/requests/issues/5829
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5829/labels{/name}
https://api.github.com/repos/psf/requests/issues/5829/comments
https://api.github.com/repos/psf/requests/issues/5829/events
https://github.com/psf/requests/issues/5829
902,196,113
MDU6SXNzdWU5MDIxOTYxMTM=
5,829
limit the data transfer of individual HTTP requests
{ "avatar_url": "https://avatars.githubusercontent.com/u/22270983?v=4", "events_url": "https://api.github.com/users/Chiragasourabh/events{/privacy}", "followers_url": "https://api.github.com/users/Chiragasourabh/followers", "following_url": "https://api.github.com/users/Chiragasourabh/following{/other_user}", "gists_url": "https://api.github.com/users/Chiragasourabh/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Chiragasourabh", "id": 22270983, "login": "Chiragasourabh", "node_id": "MDQ6VXNlcjIyMjcwOTgz", "organizations_url": "https://api.github.com/users/Chiragasourabh/orgs", "received_events_url": "https://api.github.com/users/Chiragasourabh/received_events", "repos_url": "https://api.github.com/users/Chiragasourabh/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Chiragasourabh/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Chiragasourabh/subscriptions", "type": "User", "url": "https://api.github.com/users/Chiragasourabh", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-05-26T10:51:29Z
2021-08-27T00:08:19Z
2021-05-26T12:01:22Z
NONE
resolved
I have a system with limited network bandwidth. if I make an upload or download large file operation using the requests library, the single request is consuming the whole available bandwidth of the system. is there a way to add latency to these requests (which slows down throughout of serial requests but not consume overall bandwidth)? A direct solution to set download/upload bandwidth for an individual HTTP request or to keep a part of the total available bandwidth free would be great.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5829/reactions" }
https://api.github.com/repos/psf/requests/issues/5829/timeline
null
completed
null
null
false
[ "In the future, please search **closed and** open issues before creating new ones that are duplicates.\r\n\r\nSee also #1690, #4330" ]
https://api.github.com/repos/psf/requests/issues/5828
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5828/labels{/name}
https://api.github.com/repos/psf/requests/issues/5828/comments
https://api.github.com/repos/psf/requests/issues/5828/events
https://github.com/psf/requests/issues/5828
900,876,358
MDU6SXNzdWU5MDA4NzYzNTg=
5,828
page 404 through Requests but can access through browser
{ "avatar_url": "https://avatars.githubusercontent.com/u/63130426?v=4", "events_url": "https://api.github.com/users/garagesteve1155/events{/privacy}", "followers_url": "https://api.github.com/users/garagesteve1155/followers", "following_url": "https://api.github.com/users/garagesteve1155/following{/other_user}", "gists_url": "https://api.github.com/users/garagesteve1155/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/garagesteve1155", "id": 63130426, "login": "garagesteve1155", "node_id": "MDQ6VXNlcjYzMTMwNDI2", "organizations_url": "https://api.github.com/users/garagesteve1155/orgs", "received_events_url": "https://api.github.com/users/garagesteve1155/received_events", "repos_url": "https://api.github.com/users/garagesteve1155/repos", "site_admin": false, "starred_url": "https://api.github.com/users/garagesteve1155/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/garagesteve1155/subscriptions", "type": "User", "url": "https://api.github.com/users/garagesteve1155", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-05-25T14:16:19Z
2021-08-27T00:08:19Z
2021-05-26T12:02:02Z
NONE
resolved
Trying to view a page with Requests but getting page 404 with Requests but I can access the page no problem through my browser My Code (Sorry about how it looks, Im not familiar with using Github): string_page = str(page) with requests.Session() as s: > resp = s.get('https://bscscan.com/token/generic-tokentxns2?m=normal&contractAddress=0x470862af0cf8d27ebfe0ff77b0649779c29186db&a=&sid=f58c1cdefacc680b799412c7645ed7f7&p='+string_page) > page_info = str(resp.text) print(page_info)
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5828/reactions" }
https://api.github.com/repos/psf/requests/issues/5828/timeline
null
completed
null
null
false
[ "Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow](https://stackoverflow.com) for general usage questions instead and only report defects here.", "Seems like a defect to me. Page works on browser, not on code. Other\nsimilar pages work fine with my code but that one specific page does not\n\nOn Wed, May 26, 2021, 7:02 AM Ian Stapleton Cordasco <\n***@***.***> wrote:\n\n> Hi there! Thanks for opening this issue. Unfortunately, it seems this is a\n> request for help instead of a report of a defect in the project. Please use\n> StackOverflow <https://stackoverflow.com> for general usage questions\n> instead and only report defects here.\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/psf/requests/issues/5828#issuecomment-848710966>, or\n> unsubscribe\n> <https://github.com/notifications/unsubscribe-auth/APBUWOVHKOQHGKTSGTQGCT3TPTPM7ANCNFSM45PPDCUQ>\n> .\n>\n" ]
https://api.github.com/repos/psf/requests/issues/5827
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5827/labels{/name}
https://api.github.com/repos/psf/requests/issues/5827/comments
https://api.github.com/repos/psf/requests/issues/5827/events
https://github.com/psf/requests/issues/5827
899,873,893
MDU6SXNzdWU4OTk4NzM4OTM=
5,827
Deadlock on long requests
{ "avatar_url": "https://avatars.githubusercontent.com/u/46259?v=4", "events_url": "https://api.github.com/users/skhaz/events{/privacy}", "followers_url": "https://api.github.com/users/skhaz/followers", "following_url": "https://api.github.com/users/skhaz/following{/other_user}", "gists_url": "https://api.github.com/users/skhaz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/skhaz", "id": 46259, "login": "skhaz", "node_id": "MDQ6VXNlcjQ2MjU5", "organizations_url": "https://api.github.com/users/skhaz/orgs", "received_events_url": "https://api.github.com/users/skhaz/received_events", "repos_url": "https://api.github.com/users/skhaz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/skhaz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/skhaz/subscriptions", "type": "User", "url": "https://api.github.com/users/skhaz", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-05-24T17:50:56Z
2021-08-27T00:08:20Z
2021-05-24T19:38:04Z
NONE
resolved
# Update This seems to happen only inside WSL2, inside docker and on a Linux, it works flawlessly. ## Description I have a HTTP service that takes around 6 minutes to make a response. If I run cURL manually it works, I can get the result. If I run urllib it works. I am sure that the service returns with a HTTP 200 with JSON data. You can check running `curl -X POST "https://uc.a.run.app?user=foobar"` But on requests it took forevers and never returns. # Atention This request took around 6 minutes to be completed. I can get this work with `urllib`, but no with requests. ## Expected Result The request be completed. ## Actual Result The request get stuck forever on `request.post` ## Reproduction Steps ```python import requests url = f"https://uc.a.run.app?user=foobar" response = requests.post(url) # THIS CALL NEVER RETURNS print(f"{response.json()=}") ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.8.5" }, "platform": { "release": "5.4.72-microsoft-standard-WSL2", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "1010106f" }, "urllib3": { "version": "1.26.4" }, "using_pyopenssl": false } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/46259?v=4", "events_url": "https://api.github.com/users/skhaz/events{/privacy}", "followers_url": "https://api.github.com/users/skhaz/followers", "following_url": "https://api.github.com/users/skhaz/following{/other_user}", "gists_url": "https://api.github.com/users/skhaz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/skhaz", "id": 46259, "login": "skhaz", "node_id": "MDQ6VXNlcjQ2MjU5", "organizations_url": "https://api.github.com/users/skhaz/orgs", "received_events_url": "https://api.github.com/users/skhaz/received_events", "repos_url": "https://api.github.com/users/skhaz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/skhaz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/skhaz/subscriptions", "type": "User", "url": "https://api.github.com/users/skhaz", "user_view_type": "public" }
{ "+1": 1, "-1": 0, "confused": 0, "eyes": 1, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 2, "url": "https://api.github.com/repos/psf/requests/issues/5827/reactions" }
https://api.github.com/repos/psf/requests/issues/5827/timeline
null
completed
null
null
false
[]
https://api.github.com/repos/psf/requests/issues/5826
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5826/labels{/name}
https://api.github.com/repos/psf/requests/issues/5826/comments
https://api.github.com/repos/psf/requests/issues/5826/events
https://github.com/psf/requests/issues/5826
899,781,014
MDU6SXNzdWU4OTk3ODEwMTQ=
5,826
Response Content not read properly. _content_consumed: False
{ "avatar_url": "https://avatars.githubusercontent.com/u/10815442?v=4", "events_url": "https://api.github.com/users/tandonraghav/events{/privacy}", "followers_url": "https://api.github.com/users/tandonraghav/followers", "following_url": "https://api.github.com/users/tandonraghav/following{/other_user}", "gists_url": "https://api.github.com/users/tandonraghav/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/tandonraghav", "id": 10815442, "login": "tandonraghav", "node_id": "MDQ6VXNlcjEwODE1NDQy", "organizations_url": "https://api.github.com/users/tandonraghav/orgs", "received_events_url": "https://api.github.com/users/tandonraghav/received_events", "repos_url": "https://api.github.com/users/tandonraghav/repos", "site_admin": false, "starred_url": "https://api.github.com/users/tandonraghav/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tandonraghav/subscriptions", "type": "User", "url": "https://api.github.com/users/tandonraghav", "user_view_type": "public" }
[ { "color": "f7c6c7", "default": false, "description": null, "id": 167537670, "name": "Propose Close", "node_id": "MDU6TGFiZWwxNjc1Mzc2NzA=", "url": "https://api.github.com/repos/psf/requests/labels/Propose%20Close" } ]
closed
true
null
[]
null
6
2021-05-24T15:45:59Z
2021-08-27T00:08:19Z
2021-05-24T19:47:33Z
NONE
resolved
Summary. We are observing some weird behaviour with our requests lib. While making GET/POST calls we observe most of the time Headers are read and status=200, but fails to read _content. May I know what are the possible reasons for this? This is happening way too many times. The Response we get is - ``` "response":"{'cookies': , '_content': False, 'headers': {'Content-Length': '939', 'request-id': 'ZLnsodTJ', 'Server': 'nginx', 'Connection': 'keep-alive', 'Date': 'Mon, 24 May 2021 14:12:30 GMT', 'Content-Type': 'application\/json'}, 'url': u'http:\/\/xxx:yyyy\/', 'status_code': 200, '_content_consumed': False, 'encoding': 'utf-8', 'request': , 'connection': , 'elapsed': datetime.timedelta(0, 0, 9880), 'raw': , 'reason': 'OK', '_next': None, 'history': []} ``` This result in error in decoding response content. ## Expected Result ## Actual Result Exception while reading response. What happened instead. ## Reproduction Steps ```python import requests ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "3.0.4" }, "cryptography": { "version": "3.2.1" }, "idna": { "version": "" }, "implementation": { "name": "CPython", "version": "2.7.17" }, "platform": { "release": "4.4.0-1119-aws", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "1010108f", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "1000207f" }, "urllib3": { "version": "1.26.2" }, "using_pyopenssl": true } ``` This command is only available on Requests v2.16.4 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, &c).
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5826/reactions" }
https://api.github.com/repos/psf/requests/issues/5826/timeline
null
completed
null
null
false
[ "Hi @tandonraghav,\r\n\r\nThis issue doesn't make it clear what problem you're actually encountering. `_content` is a private variable, so there should never be a case where you're touching this directly. Are you saying the [`content`](https://docs.python-requests.org/en/master/user/quickstart/#binary-response-content) (note the lack of `_`) is producing a decoding error?\r\n\r\nIf you feel there is actually a bug here, please provide a complete example of how you're interacting with the response and the stack trace you're receiving. Thanks.", "@nateprewitt Most of the time we get 200 in status but the `content` is not present, hence json.load fails.\r\nI am not accessing `_content` but referred because that of what is see if i print `response.__dict__`\r\n\r\nI am seeing this behaviour when we do `requests.get` or `requests.post` call.\r\n\r\nThis is the logger which we are getting on printing `response.__dict__`\r\n\r\n```\r\n\"response\":\"{'cookies': , '_content': False, 'headers': {'Content-Length': '939', 'request-id': 'ZLnsodTJ', 'Server': 'nginx', 'Connection': 'keep-alive', 'Date': 'Mon, 24 May 2021 14:12:30 GMT', 'Content-Type': 'application\\/json'}, 'url': u'http:\\/\\/xxx:yyyy\\/', 'status_code': 200, '_content_consumed': False, 'encoding': 'utf-8', 'request': , 'connection': , 'elapsed': datetime.timedelta(0, 0, 9880), 'raw': , 'reason': 'OK', '_next': None, 'history': []}\r\n```\r\n\r\nHow is it possible that thousands of times status is 200 and no content in response? \r\nAlso, there is `Content-Length` present but still `_content_consumed: False` is coming.\r\n\r\nI do not have conclusive evidence that it is requests/urllib3 bug only. But this is our most likely suspect.\r\n\r\nAlso, I am not able to reproduce the exact behaviour but this is happening very frequently in our production systems.\r\nCan you please give some more pointers which can help in debugging this issue.\r\n\r\n\r\n```\r\ntry:\r\n resp = requests.get(url=url, **requests_kwargs)\r\n if self.is_successful(resp): \r\n json_dict = json.loads(resp.content) # Getting Error here!!!\r\nexcept Exception as e: \r\n print resp.__dict__ \r\n```\r\n", "Given how much information you've redacted, it's not exactly plausible to debug this magically for you. I would suggest looking at `request_kwargs` in these cases. I suspect you'll find `stream=True`.\r\n\r\nBeyond that, `json.loads` expects `text` not `bytes` and `resp.content` will be bytes. You should be using `resp.text`.\r\n\r\n\r\n> How is it possible that thousands of times status is 200 and no content in response?\r\n\r\nServers do the wrong thing often. This isn't surprising, especially seeing that your `Content-Type` appears to have a `\\` in it.\r\n\r\nAlso if you're on a reasonably modern version of `requests` you could also more directly do `json_dict = resp.json()`. I don't believe this is a bug in the library either", "@sigmavirus24 `\\` you are seeing because of the Log line we are printing.\r\n`request_kwargs` just contains some `auth` headers and are you saying `json.loads` is the issue which is not the case here.\r\nAlso, I am not setting `stream=True` which due to which it is reading half response only.\r\n\r\nWhat do you suspect server would have done wrong which can cause such a behaviour?\r\n\r\nAlso, i can agree might be this is not a bug at requests lib at end, but not sure of it.\r\n\r\n", "> are you saying `json.loads` is the issue which is not the case here\r\n\r\nI'm not saying it's the cause, I'm saying it's not necessary nor is the way you're using `resp.content` here correct. The stdlib expects text and you are providing bytes.\r\n\r\n> Also, I am not setting `stream=True` which due to which it is reading half response only.\r\n\r\nI don't understand what you're trying to say here.\r\n\r\n> What do you suspect server would have done wrong which can cause such a behaviour?\r\n\r\nThere's plenty. The best way to \r\n\r\n> Also, i can agree might be this is not a bug at requests lib at end, but not sure of it.\r\n\r\nExcept I'm fairly certain it isn't a bug.\r\n\r\nYou haven't provided the exception you're seeing and what you're pointing out `_content` is `False` is the case when `stream=True` is provided and the content hasn't been consumed from the underlying socket. There's so much information missing we can't possibly help you and you seem to be insisting that this should be kept open as a potential bug without any supporting evidence.\r\n\r\nAt this point, you've provided no way to reproduce and you haven't provided what you're actually seeing, just what you seem to think are relevant minimal details from which we must magically discern the cause. Sadly we're not magicians, nor are we network mind readers. We can't figure this out for you. I strongly suggest you invest in observability for your software. It will pay off far more than just whatever problem you're running into here", "@sigmavirus24 Thanks for response.. I was trying to say we are not setting `stream=True` then too we are getting `_content= False`. \r\nCurrently, I am trying to find out where the bug lies. Our servers are returning response properly and I can see that in the logs.\r\n\r\nBut somehow client is not getting the response body.\r\n\r\nAnyways, I will investigate more and get back to you." ]
https://api.github.com/repos/psf/requests/issues/5825
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5825/labels{/name}
https://api.github.com/repos/psf/requests/issues/5825/comments
https://api.github.com/repos/psf/requests/issues/5825/events
https://github.com/psf/requests/issues/5825
897,939,610
MDU6SXNzdWU4OTc5Mzk2MTA=
5,825
Chardet license
{ "avatar_url": "https://avatars.githubusercontent.com/u/25073721?v=4", "events_url": "https://api.github.com/users/huniyaarif1/events{/privacy}", "followers_url": "https://api.github.com/users/huniyaarif1/followers", "following_url": "https://api.github.com/users/huniyaarif1/following{/other_user}", "gists_url": "https://api.github.com/users/huniyaarif1/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/huniyaarif1", "id": 25073721, "login": "huniyaarif1", "node_id": "MDQ6VXNlcjI1MDczNzIx", "organizations_url": "https://api.github.com/users/huniyaarif1/orgs", "received_events_url": "https://api.github.com/users/huniyaarif1/received_events", "repos_url": "https://api.github.com/users/huniyaarif1/repos", "site_admin": false, "starred_url": "https://api.github.com/users/huniyaarif1/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/huniyaarif1/subscriptions", "type": "User", "url": "https://api.github.com/users/huniyaarif1", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-05-21T11:06:13Z
2021-08-27T00:08:20Z
2021-05-21T11:51:59Z
NONE
resolved
Hey I have a question. Chardet is using LGPL 2.1 licensing. Isn't it a copyleft license?
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5825/reactions" }
https://api.github.com/repos/psf/requests/issues/5825/timeline
null
completed
null
null
false
[ "This is and has been discussed elsewhere, search open and closed issues before opening a new one. " ]
https://api.github.com/repos/psf/requests/issues/5824
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5824/labels{/name}
https://api.github.com/repos/psf/requests/issues/5824/comments
https://api.github.com/repos/psf/requests/issues/5824/events
https://github.com/psf/requests/issues/5824
897,294,747
MDU6SXNzdWU4OTcyOTQ3NDc=
5,824
Timeline for fixing #5710?
{ "avatar_url": "https://avatars.githubusercontent.com/u/34655?v=4", "events_url": "https://api.github.com/users/dfrankow/events{/privacy}", "followers_url": "https://api.github.com/users/dfrankow/followers", "following_url": "https://api.github.com/users/dfrankow/following{/other_user}", "gists_url": "https://api.github.com/users/dfrankow/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dfrankow", "id": 34655, "login": "dfrankow", "node_id": "MDQ6VXNlcjM0NjU1", "organizations_url": "https://api.github.com/users/dfrankow/orgs", "received_events_url": "https://api.github.com/users/dfrankow/received_events", "repos_url": "https://api.github.com/users/dfrankow/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dfrankow/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dfrankow/subscriptions", "type": "User", "url": "https://api.github.com/users/dfrankow", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-05-20T18:58:39Z
2021-08-27T00:08:21Z
2021-05-20T19:21:53Z
NONE
resolved
I see https://github.com/psf/requests/issues/5710 says #5711 will fix an issue with using an old idna. Looks like the last movement there was Jan 20, now about 4 months ago. Can you offer any guidance on when #5710 will be fixed? Like others, this is blocking some of my development. In particular, I wish to try https://github.com/karolyi/py3-validate-email, which requires `idna~=3.0`, incompatible with the current requests requirements.
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 1, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 1, "url": "https://api.github.com/repos/psf/requests/issues/5824/reactions" }
https://api.github.com/repos/psf/requests/issues/5824/timeline
null
completed
null
null
false
[ "Hi @dfrankow,\r\n\r\nAs the last comments in both of those issues state (https://github.com/psf/requests/issues/5710#issuecomment-830211618) (https://github.com/psf/requests/pull/5711#issuecomment-764017260), this is likely to be included in the next release of Requests. The change is unfortunately breaking for a subset of users which is the reason it hasn't been merged yet.\r\n\r\nWe are pending outcomes on some other open PRs before creating the next release so there is no hard timeline. In the future, please keep discussions to the relevant issue instead of creating new ones. It creates unnecessary noise for those watching this repo and makes it difficult to track conversations on the topic. Thanks!", "Thanks for your response." ]
https://api.github.com/repos/psf/requests/issues/5823
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5823/labels{/name}
https://api.github.com/repos/psf/requests/issues/5823/comments
https://api.github.com/repos/psf/requests/issues/5823/events
https://github.com/psf/requests/issues/5823
896,034,652
MDU6SXNzdWU4OTYwMzQ2NTI=
5,823
The character ü gets replaced by ü
{ "avatar_url": "https://avatars.githubusercontent.com/u/64863140?v=4", "events_url": "https://api.github.com/users/MicheleCotrufo/events{/privacy}", "followers_url": "https://api.github.com/users/MicheleCotrufo/followers", "following_url": "https://api.github.com/users/MicheleCotrufo/following{/other_user}", "gists_url": "https://api.github.com/users/MicheleCotrufo/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/MicheleCotrufo", "id": 64863140, "login": "MicheleCotrufo", "node_id": "MDQ6VXNlcjY0ODYzMTQw", "organizations_url": "https://api.github.com/users/MicheleCotrufo/orgs", "received_events_url": "https://api.github.com/users/MicheleCotrufo/received_events", "repos_url": "https://api.github.com/users/MicheleCotrufo/repos", "site_admin": false, "starred_url": "https://api.github.com/users/MicheleCotrufo/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/MicheleCotrufo/subscriptions", "type": "User", "url": "https://api.github.com/users/MicheleCotrufo", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-05-19T23:16:12Z
2021-08-27T00:08:21Z
2021-05-20T13:07:39Z
NONE
resolved
I am using this library to retrieve some bibliographic information. If I do ``` import requests url = "http://dx.doi.org/10.1103/PhysRevA.96.053817" headers = {"accept": "application/x-bibtex"} r = requests.get(url, headers = headers) print(r.text) ``` I get a string that contains the character ü. Instead, that character should be ü (I also double-checked by querying directly via broswer). Do I need to change any encoding/decoding settings?
{ "avatar_url": "https://avatars.githubusercontent.com/u/64863140?v=4", "events_url": "https://api.github.com/users/MicheleCotrufo/events{/privacy}", "followers_url": "https://api.github.com/users/MicheleCotrufo/followers", "following_url": "https://api.github.com/users/MicheleCotrufo/following{/other_user}", "gists_url": "https://api.github.com/users/MicheleCotrufo/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/MicheleCotrufo", "id": 64863140, "login": "MicheleCotrufo", "node_id": "MDQ6VXNlcjY0ODYzMTQw", "organizations_url": "https://api.github.com/users/MicheleCotrufo/orgs", "received_events_url": "https://api.github.com/users/MicheleCotrufo/received_events", "repos_url": "https://api.github.com/users/MicheleCotrufo/repos", "site_admin": false, "starred_url": "https://api.github.com/users/MicheleCotrufo/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/MicheleCotrufo/subscriptions", "type": "User", "url": "https://api.github.com/users/MicheleCotrufo", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5823/reactions" }
https://api.github.com/repos/psf/requests/issues/5823/timeline
null
completed
null
null
false
[ "I seem to have found a solution. Setting `r.encoding='utf-8'` does the trick,\r\n\r\n```\r\nimport requests\r\nurl = \"http://dx.doi.org/10.1103/PhysRevA.96.053817\" \r\nheaders = {\"accept\": \"application/x-bibtex\"}\r\nr = requests.get(url, headers = headers)\r\nr.encoding='utf-8'\r\nprint(r.text)\r\n```\r\n\r\n" ]
https://api.github.com/repos/psf/requests/issues/5822
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5822/labels{/name}
https://api.github.com/repos/psf/requests/issues/5822/comments
https://api.github.com/repos/psf/requests/issues/5822/events
https://github.com/psf/requests/issues/5822
895,158,687
MDU6SXNzdWU4OTUxNTg2ODc=
5,822
Requests ignores KeyboardInterrupt
{ "avatar_url": "https://avatars.githubusercontent.com/u/4163396?v=4", "events_url": "https://api.github.com/users/mrx23dot/events{/privacy}", "followers_url": "https://api.github.com/users/mrx23dot/followers", "following_url": "https://api.github.com/users/mrx23dot/following{/other_user}", "gists_url": "https://api.github.com/users/mrx23dot/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/mrx23dot", "id": 4163396, "login": "mrx23dot", "node_id": "MDQ6VXNlcjQxNjMzOTY=", "organizations_url": "https://api.github.com/users/mrx23dot/orgs", "received_events_url": "https://api.github.com/users/mrx23dot/received_events", "repos_url": "https://api.github.com/users/mrx23dot/repos", "site_admin": false, "starred_url": "https://api.github.com/users/mrx23dot/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mrx23dot/subscriptions", "type": "User", "url": "https://api.github.com/users/mrx23dot", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-05-19T08:38:00Z
2021-08-27T00:08:20Z
2021-05-21T08:17:47Z
NONE
resolved
Requests ignores CTRL+C KeyboardInterrupt when it does it's timeout. ## Expected Result It should give up waiting when requested and exit immediately. ## Actual Result Keeps doing it's timeout until elapse then exits. ## Reproduction Steps ```python import requests # an invalid url resp = requests.get('http://192.1.5.2', timeout=50) # press CTRL+C while executing ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "3.1.1" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.6.5" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "1010108f", "version": "19.1.0" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "100020bf" }, "urllib3": { "version": "1.26.3" }, "using_pyopenssl": true } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/4163396?v=4", "events_url": "https://api.github.com/users/mrx23dot/events{/privacy}", "followers_url": "https://api.github.com/users/mrx23dot/followers", "following_url": "https://api.github.com/users/mrx23dot/following{/other_user}", "gists_url": "https://api.github.com/users/mrx23dot/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/mrx23dot", "id": 4163396, "login": "mrx23dot", "node_id": "MDQ6VXNlcjQxNjMzOTY=", "organizations_url": "https://api.github.com/users/mrx23dot/orgs", "received_events_url": "https://api.github.com/users/mrx23dot/received_events", "repos_url": "https://api.github.com/users/mrx23dot/repos", "site_admin": false, "starred_url": "https://api.github.com/users/mrx23dot/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mrx23dot/subscriptions", "type": "User", "url": "https://api.github.com/users/mrx23dot", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5822/reactions" }
https://api.github.com/repos/psf/requests/issues/5822/timeline
null
completed
null
null
false
[ "Hey @mrx23dot,\r\n\r\nThanks for the report. I took a quick look and was able to reproduce the issue. It's specific to Windows 10 and doesn't appear to happen in *nix flavor environments. A quick look at the stack trace shows the culprit isn't actually Requests, but the Python standard library. Specifically `socket.py`'s `connect` call.\r\n\r\nYou can reproduce the same issue without Requests or Urllib3 with the code below. Unfortunately, I don't think there's anything we can do here.\r\n\r\n```python\r\nfrom http.client import HTTPConnection\r\nconn = HTTPConnection('192.1.5.2', 80, timeout=50)\r\nconn.request('GET', '/')\r\nconn.getresponse()\r\n```", "Thank you, created other ticket in urlib\r\nhttps://github.com/urllib3/urllib3/issues/2237" ]
https://api.github.com/repos/psf/requests/issues/5821
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5821/labels{/name}
https://api.github.com/repos/psf/requests/issues/5821/comments
https://api.github.com/repos/psf/requests/issues/5821/events
https://github.com/psf/requests/pull/5821
894,486,367
MDExOlB1bGxSZXF1ZXN0NjQ2ODQzNDg3
5,821
Update advanced.rst
{ "avatar_url": "https://avatars.githubusercontent.com/u/7696441?v=4", "events_url": "https://api.github.com/users/Akay7/events{/privacy}", "followers_url": "https://api.github.com/users/Akay7/followers", "following_url": "https://api.github.com/users/Akay7/following{/other_user}", "gists_url": "https://api.github.com/users/Akay7/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Akay7", "id": 7696441, "login": "Akay7", "node_id": "MDQ6VXNlcjc2OTY0NDE=", "organizations_url": "https://api.github.com/users/Akay7/orgs", "received_events_url": "https://api.github.com/users/Akay7/received_events", "repos_url": "https://api.github.com/users/Akay7/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Akay7/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Akay7/subscriptions", "type": "User", "url": "https://api.github.com/users/Akay7", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-05-18T15:07:30Z
2021-10-16T11:00:24Z
2021-07-18T10:59:38Z
CONTRIBUTOR
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5821/reactions" }
https://api.github.com/repos/psf/requests/issues/5821/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5821.diff", "html_url": "https://github.com/psf/requests/pull/5821", "merged_at": "2021-07-18T10:59:38Z", "patch_url": "https://github.com/psf/requests/pull/5821.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5821" }
true
[]
https://api.github.com/repos/psf/requests/issues/5819
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5819/labels{/name}
https://api.github.com/repos/psf/requests/issues/5819/comments
https://api.github.com/repos/psf/requests/issues/5819/events
https://github.com/psf/requests/issues/5819
893,175,183
MDU6SXNzdWU4OTMxNzUxODM=
5,819
Help me update csrf token for the first time sess.headers.update({'X-CSRFToken' : sess.get('https:/
{ "avatar_url": "https://avatars.githubusercontent.com/u/84271940?v=4", "events_url": "https://api.github.com/users/Omborgad640/events{/privacy}", "followers_url": "https://api.github.com/users/Omborgad640/followers", "following_url": "https://api.github.com/users/Omborgad640/following{/other_user}", "gists_url": "https://api.github.com/users/Omborgad640/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Omborgad640", "id": 84271940, "login": "Omborgad640", "node_id": "MDQ6VXNlcjg0MjcxOTQw", "organizations_url": "https://api.github.com/users/Omborgad640/orgs", "received_events_url": "https://api.github.com/users/Omborgad640/received_events", "repos_url": "https://api.github.com/users/Omborgad640/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Omborgad640/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Omborgad640/subscriptions", "type": "User", "url": "https://api.github.com/users/Omborgad640", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2021-05-17T10:13:45Z
2021-05-19T21:57:02Z
2021-05-17T15:10:19Z
NONE
off-topic
Please refer to our [Stack Overflow tag](https://stackoverflow.com/questions/tagged/python-requests) for guidance. ![IMG_20210517_154240](https://user-images.githubusercontent.com/84271940/118472505-8a306600-b726-11eb-868c-da970d614d8a.jpg) How solve this error Please help
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5819/reactions" }
https://api.github.com/repos/psf/requests/issues/5819/timeline
null
completed
null
null
false
[ "> Please refer to our [Stack Overflow tag](https://stackoverflow.com/questions/tagged/python-requests) for guidance.\r\n> ![IMG_20210517_154240](https://user-images.githubusercontent.com/84271940/118472505-8a306600-b726-11eb-868c-da970d614d8a.jpg)\r\n> How solve this error\r\n> Please help\r\n\r\n", "As you mentioned in your issue, you should direct these sorts of \"how do I do X\" to StackOverflow instead of using our issue tracker. The issue tracker is reserved for defects in Requests.", "How can i use instacrack\n\nOn Mon, 17 May, 2021, 8:40 pm Seth Michael Larson, ***@***.***>\nwrote:\n\n> As you mentioned in your issue, you should direct these sorts of \"how do I\n> do X\" to StackOverflow instead of using our issue tracker. The issue\n> tracker is reserved for defects in Requests.\n>\n> —\n> You are receiving this because you modified the open/close state.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/psf/requests/issues/5819#issuecomment-842404152>, or\n> unsubscribe\n> <https://github.com/notifications/unsubscribe-auth/AUC6GRET2NX3YKGV4MUDAFTTOEWXFANCNFSM45AEXYDA>\n> .\n>\n" ]
https://api.github.com/repos/psf/requests/issues/5818
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5818/labels{/name}
https://api.github.com/repos/psf/requests/issues/5818/comments
https://api.github.com/repos/psf/requests/issues/5818/events
https://github.com/psf/requests/pull/5818
892,698,697
MDExOlB1bGxSZXF1ZXN0NjQ1MzM1NzUw
5,818
Add tests for conditional charset normalizer
{ "avatar_url": "https://avatars.githubusercontent.com/u/595491?v=4", "events_url": "https://api.github.com/users/potiuk/events{/privacy}", "followers_url": "https://api.github.com/users/potiuk/followers", "following_url": "https://api.github.com/users/potiuk/following{/other_user}", "gists_url": "https://api.github.com/users/potiuk/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/potiuk", "id": 595491, "login": "potiuk", "node_id": "MDQ6VXNlcjU5NTQ5MQ==", "organizations_url": "https://api.github.com/users/potiuk/orgs", "received_events_url": "https://api.github.com/users/potiuk/received_events", "repos_url": "https://api.github.com/users/potiuk/repos", "site_admin": false, "starred_url": "https://api.github.com/users/potiuk/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/potiuk/subscriptions", "type": "User", "url": "https://api.github.com/users/potiuk", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-05-16T15:48:41Z
2021-08-27T00:08:39Z
2021-05-17T12:32:56Z
CONTRIBUTOR
resolved
This PR extends and updates tox infrastructure of requests to run tests in different environment - with or without lgpl extra. It should be merged only after the PR introducing the lgpl extra has been merged: https://github.com/psf/requests/pull/5797
{ "avatar_url": "https://avatars.githubusercontent.com/u/595491?v=4", "events_url": "https://api.github.com/users/potiuk/events{/privacy}", "followers_url": "https://api.github.com/users/potiuk/followers", "following_url": "https://api.github.com/users/potiuk/following{/other_user}", "gists_url": "https://api.github.com/users/potiuk/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/potiuk", "id": 595491, "login": "potiuk", "node_id": "MDQ6VXNlcjU5NTQ5MQ==", "organizations_url": "https://api.github.com/users/potiuk/orgs", "received_events_url": "https://api.github.com/users/potiuk/received_events", "repos_url": "https://api.github.com/users/potiuk/repos", "site_admin": false, "starred_url": "https://api.github.com/users/potiuk/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/potiuk/subscriptions", "type": "User", "url": "https://api.github.com/users/potiuk", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5818/reactions" }
https://api.github.com/repos/psf/requests/issues/5818/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5818.diff", "html_url": "https://github.com/psf/requests/pull/5818", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5818.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5818" }
true
[ "Added it directly to #5797 . Closing this one." ]
https://api.github.com/repos/psf/requests/issues/5817
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5817/labels{/name}
https://api.github.com/repos/psf/requests/issues/5817/comments
https://api.github.com/repos/psf/requests/issues/5817/events
https://github.com/psf/requests/issues/5817
892,480,998
MDU6SXNzdWU4OTI0ODA5OTg=
5,817
Requests on pyth in 3 doesn't work the same as it does in python 2
{ "avatar_url": "https://avatars.githubusercontent.com/u/567047?v=4", "events_url": "https://api.github.com/users/jeffreydwalter/events{/privacy}", "followers_url": "https://api.github.com/users/jeffreydwalter/followers", "following_url": "https://api.github.com/users/jeffreydwalter/following{/other_user}", "gists_url": "https://api.github.com/users/jeffreydwalter/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jeffreydwalter", "id": 567047, "login": "jeffreydwalter", "node_id": "MDQ6VXNlcjU2NzA0Nw==", "organizations_url": "https://api.github.com/users/jeffreydwalter/orgs", "received_events_url": "https://api.github.com/users/jeffreydwalter/received_events", "repos_url": "https://api.github.com/users/jeffreydwalter/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jeffreydwalter/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jeffreydwalter/subscriptions", "type": "User", "url": "https://api.github.com/users/jeffreydwalter", "user_view_type": "public" }
[]
closed
true
null
[]
null
15
2021-05-15T15:57:17Z
2022-02-26T07:00:17Z
2021-11-28T03:35:53Z
NONE
resolved
I'm having a problem with making an `OPTIONS` request. If I run the following code in `python 2.7` with `requests 2.7.0` it works fine and I get a `204` back. If I run it with `python 3.8.5` I get a `403`: ``` import requests from requests_toolbelt.utils import dump def print_raw_http(response): data = dump.dump_all(response, request_prefix=b'', response_prefix=b'') print('\n' * 2 + data.decode('utf-8')) headers = { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)', } session = requests.Session() r = session.options('https://ocapi-app.arlo.com/api/auth', headers=headers) print_raw_http(r) r.raise_for_status() ``` ``` $ python -V Python 2.7.16 $ python3 -V Python 3.8.5 $ pip freeze | grep requests requests==2.7.0 $ pip3 freeze | grep requests requests==2.7.0 ``` `python 2.7`: ``` $ python blah.py OPTIONS /api/auth HTTP/1.1 Host: ocapi-app.arlo.com Connection: keep-alive Accept-Encoding: gzip, deflate Accept: */* User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone) Content-Length: 0 HTTP/1.1 204 No Content ``` `python 3.8.5`: ``` $ python3 blah.py OPTIONS /api/auth HTTP/1.1 Host: ocapi-app.arlo.com User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone) Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive Content-Length: 0 HTTP/1.1 403 Forbidden ``` Works fine with cURL too: ``` curl -vvvv -X OPTIONS "https://ocapi-app.arlo.com/api/auth" --output --http1.1 --no-alpn --no-npn -H "Host: ocapi-app.arlo.com" -H "Connection: keep-alive" -H "Accept-Encoding: gzip, deflate" -H "Accept: */*" -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)" -H "Content-length: 0" ``` ``` > OPTIONS /api/auth HTTP/1.1 > Host: ocapi-app.arlo.com > Connection: keep-alive > Accept-Encoding: gzip, deflate > Accept: */* > User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone) > Content-length: 0 > < HTTP/1.1 204 No Content ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5817/reactions" }
https://api.github.com/repos/psf/requests/issues/5817/timeline
null
completed
null
null
false
[ "When pasting code blocks it is much easier to read if you use three `` tics around the code block. See [these docs](https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks) for more information.\r\n", "Yes, I know how to use markdown. That was a copy/paste fail while doing this from my phone.\r\n\r\nSee here if you want a formatted version: https://github.com/psf/requests/issues/5801#issuecomment-828925212", "Requests 2.7.0 is ancient and unsupported", "@sigmavirus24 I'm a little confused about the versioning. According to pypi, requests is on [2.25.1](https://pypi.org/project/requests/)? What is the lastest stable version of requests?", "@jeffreydwalter Your pip freeze in the original post indicates 2.7.0, not 2.25.1. Is this the case?", "@sethmlarson, I was using 2.7.0, but I just installed requests==2.25.1, and the problem persists.", "@sethmlarson @sigmavirus24 can you please reopen this issue. This issue is relevant and happens with 2.25.1 as well.", "Thank you. Now that we're back in business, any thoughts about what the problem might be? The sample script I provided illustrates the problem.", "It seems like that requires auth. Can you reproduce this with some other website or just Arlo?", "It's an OPTION request. If you run my test script in python 2.7 (or curl)\nyou'll see you get back a 2XX response and a 403 in python 3.x.\n\nOn Mon, May 24, 2021, 5:43 PM Ian Stapleton Cordasco <\n***@***.***> wrote:\n\n> It seems like that requires auth. Can you reproduce this with some other\n> website or just Arlo?\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/psf/requests/issues/5817#issuecomment-847397642>, or\n> unsubscribe\n> <https://github.com/notifications/unsubscribe-auth/AAEKOBZRXO2INN7JSKAW4STTPLI7TANCNFSM446AL4DQ>\n> .\n>\n", "So, if you look at the response you're receiving @jeffreydwalter, you can see you're getting a CAPTCHA challenge from Cloudflare (not Arlo) because you've been identified as a bot.\r\n\r\nI did a couple quick checks and the issue _appears_ to be related how Requests is interacting with Urllib3's cipher setting. Cloudflare is doing fingerprinting and anything using Requests on Python 3.8+ is getting auto blocked. I happened upon this finding by downgrading urllib3 to 1.24 which works. However, both 1.23 and 1.24.1 do not.\r\n\r\nThis is the [commit](https://github.com/urllib3/urllib3/pull/1463/) that was added back to 1.24.1 which fixed accidental removal of setting a default cipher in 1.24.0. I'd need to sit down for a minute to work out what we're passing into urllib3 for Python 3.8. This issue isn't reproducible using urllib3 alone, so it's specific to Requests.\r\n\r\nThere's also a question of whether we want to be in the business of trying to circumvent safety measures on services that have chosen to set them up. I'll do some more investigation if I find time but this sits pretty low on the priority list.", "That's fair. I appreciate you illuminating the issue. I assume Arlo put\r\nthat in place to block people from using python to automate management of\r\ntheir personal cameras. There are 3-4 python libraries out there that\r\ncopied my library and all of them have been thwarted by this. I'd venture\r\nthere are a couple thousand users with broken home automation.\r\n\r\nI'm happy to take a look at the code if you can point me in the right\r\ndirection. If not and you don't think this will get fixed in a reasonable\r\namount of time, I can rewrite my library to use httpx or something else.\r\n\r\nThanks again!\r\n\r\nOn Mon, May 24, 2021, 6:49 PM Nate Prewitt ***@***.***> wrote:\r\n\r\n> There's also a question of whether we want to be in the business of trying\r\n> to circumvent safety measures on services that have chosen to set them up.\r\n> I'll do some more investigation if I find time but this sits pretty low on\r\n> the priority list.\r\n>\r\n> —\r\n> You are receiving this because you were mentioned.\r\n> Reply to this email directly, view it on GitHub\r\n> <https://github.com/psf/requests/issues/5817#issuecomment-847426348>, or\r\n> unsubscribe\r\n> <https://github.com/notifications/unsubscribe-auth/AAEKOBYP73EY5J7A3ECLFA3TPLQXXANCNFSM446AL4DQ>\r\n> .\r\n>\r\n", "@nateprewitt I can confirm that downgrading my urllib3 to 1.24 makes the issue go away. I think this is worth digging into because I don't think it's just a case of CloudFlare blocking use of python or requests. There's probably a subtle protocol issue at play which is causing them to reject the requests.", "Yeah this isn't something that Requests can do much about, you're being detected as \"requiring additional auth\" but the goalposts for what individual services like Cloudflare will decide can change any day so closing this as not actionable by our team. Thanks for the report!", "@sethmlarson what are you saying? You guys made a change to `urllib3` and/or `requests` that caused this issue. Downgrading to `urllib3` to `1.24` fixes the issue. The thing you can do about it is, fix the regression..." ]
https://api.github.com/repos/psf/requests/issues/5816
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5816/labels{/name}
https://api.github.com/repos/psf/requests/issues/5816/comments
https://api.github.com/repos/psf/requests/issues/5816/events
https://github.com/psf/requests/pull/5816
891,696,495
MDExOlB1bGxSZXF1ZXN0NjQ0NTIzOTEw
5,816
Warn user if environment variables are used
{ "avatar_url": "https://avatars.githubusercontent.com/u/633765?v=4", "events_url": "https://api.github.com/users/Akasurde/events{/privacy}", "followers_url": "https://api.github.com/users/Akasurde/followers", "following_url": "https://api.github.com/users/Akasurde/following{/other_user}", "gists_url": "https://api.github.com/users/Akasurde/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Akasurde", "id": 633765, "login": "Akasurde", "node_id": "MDQ6VXNlcjYzMzc2NQ==", "organizations_url": "https://api.github.com/users/Akasurde/orgs", "received_events_url": "https://api.github.com/users/Akasurde/received_events", "repos_url": "https://api.github.com/users/Akasurde/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Akasurde/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Akasurde/subscriptions", "type": "User", "url": "https://api.github.com/users/Akasurde", "user_view_type": "public" }
[]
open
false
null
[]
null
7
2021-05-14T07:43:32Z
2022-06-02T08:14:12Z
null
NONE
null
When session.verify=False, session.trust_env=True and REQUESTS_CA_BUNDLE or CURL_CA_BUNDLE is defined as environment variables then, notify user that requests will use environment variables rather than silently failing. partially fixes: #3829 Signed-off-by: Abhijeet Kasurde <[email protected]>
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 5, "-1": 0, "confused": 0, "eyes": 0, "heart": 5, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 10, "url": "https://api.github.com/repos/psf/requests/issues/5816/reactions" }
https://api.github.com/repos/psf/requests/issues/5816/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5816.diff", "html_url": "https://github.com/psf/requests/pull/5816", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5816.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5816" }
true
[ "I spend hours debugging this error. I am aware that this odd behavior is fixed in 3.* release.", "Really nice pr, I checked it – warnings works well, can save a tons of devs time.\r\nIt would be nice to have more verbose warning text, for those who are not familiar with this problem.", "> It would be nice to have more verbose warning text, for those who are not familiar with this problem.\r\n\r\nCould you please suggest something? 😂 \r\n", "Closing/re-opening since I can't trigger CI to run here", "What's the status of this PR?", "> I am aware that this odd behavior is fixed in 3.* release.\r\n\r\nFrom #6050 looks like 3.x isn't going to happen any time soon, and commitments to fix things in 3.x don't necessarily hold.\r\n", "> What's the status of this PR?\r\n\r\nI would love to see this PR getting merged. Let me know if you need something from myside." ]
https://api.github.com/repos/psf/requests/issues/5815
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5815/labels{/name}
https://api.github.com/repos/psf/requests/issues/5815/comments
https://api.github.com/repos/psf/requests/issues/5815/events
https://github.com/psf/requests/pull/5815
891,538,627
MDExOlB1bGxSZXF1ZXN0NjQ0Mzk1MTA0
5,815
fix typo in __init__.py
{ "avatar_url": "https://avatars.githubusercontent.com/u/22633385?v=4", "events_url": "https://api.github.com/users/eltociear/events{/privacy}", "followers_url": "https://api.github.com/users/eltociear/followers", "following_url": "https://api.github.com/users/eltociear/following{/other_user}", "gists_url": "https://api.github.com/users/eltociear/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/eltociear", "id": 22633385, "login": "eltociear", "node_id": "MDQ6VXNlcjIyNjMzMzg1", "organizations_url": "https://api.github.com/users/eltociear/orgs", "received_events_url": "https://api.github.com/users/eltociear/received_events", "repos_url": "https://api.github.com/users/eltociear/repos", "site_admin": false, "starred_url": "https://api.github.com/users/eltociear/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/eltociear/subscriptions", "type": "User", "url": "https://api.github.com/users/eltociear", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-05-14T02:22:50Z
2021-08-27T00:08:39Z
2021-05-14T03:34:53Z
NONE
resolved
initialisation -> initialization
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5815/reactions" }
https://api.github.com/repos/psf/requests/issues/5815/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5815.diff", "html_url": "https://github.com/psf/requests/pull/5815", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5815.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5815" }
true
[ "There are multiple spellings of the word. ", "@sethmlarson OK! Thank you for your reviewing." ]
https://api.github.com/repos/psf/requests/issues/5814
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5814/labels{/name}
https://api.github.com/repos/psf/requests/issues/5814/comments
https://api.github.com/repos/psf/requests/issues/5814/events
https://github.com/psf/requests/issues/5814
886,491,580
MDU6SXNzdWU4ODY0OTE1ODA=
5,814
Merging of default HTTP headers with specified headers breaks the defined ordering
{ "avatar_url": "https://avatars.githubusercontent.com/u/5196024?v=4", "events_url": "https://api.github.com/users/baderj/events{/privacy}", "followers_url": "https://api.github.com/users/baderj/followers", "following_url": "https://api.github.com/users/baderj/following{/other_user}", "gists_url": "https://api.github.com/users/baderj/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/baderj", "id": 5196024, "login": "baderj", "node_id": "MDQ6VXNlcjUxOTYwMjQ=", "organizations_url": "https://api.github.com/users/baderj/orgs", "received_events_url": "https://api.github.com/users/baderj/received_events", "repos_url": "https://api.github.com/users/baderj/repos", "site_admin": false, "starred_url": "https://api.github.com/users/baderj/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/baderj/subscriptions", "type": "User", "url": "https://api.github.com/users/baderj", "user_view_type": "public" }
[]
open
false
null
[]
null
3
2021-05-11T08:33:34Z
2021-05-11T16:58:38Z
null
NONE
null
Even if headers are defined in an ``OrderedDict``, their order might change if they coincide with the ``default_headers`` set in ``utils.py``, namely ``User-Agent``, ``Accept-Encoding``, ``Accept``, and ``Connection``. ## Expected Result The order of the headers should not change when passed as an ``OrderedDict``. So for example: ```python import requests from collections import OrderedDict headers = OrderedDict([ ("Accept", '1'), ("Accept-Encoding", '2'), ("User-Agent", '3'), ]) r = requests.get('http://www.example.com', headers=headers) ``` should result in the ``Accept`` header coming first, followed by ``Accept-Encoding`` and finally ``User-Agent``. ## Actual Result The ``User-Agent`` comes first, followed by ``Accept-Encoding`` and then ``Accept`` ## Reason The default headers --- as set by ``requests.utils.default_headers()`` --- are merged with the user specified headers by the function ``requests.sessions.merge_settings``. This function first takes the default headers and then updates that with the user specified headers. This ensures that user specified headers overwrite the default ones. However, the update process does not change the order of the default headers. So when setting ``User-Agent`` after ``Accept``, this will not be taken into account as both headers are already in the default headers and in reverse order. A fix to ``merge_settings`` could be to take the user specified headers first, and then iterate over the default headers and add them in if their are misssing. ## Workaround If one wants exactly the headers specified, one can first create a ``Session`` and remove the default headers: ``` s = requests.Session() s.headers = {} r = s.get(url, headers=headers, ...) ``` Having a way to change the default headers on the ``requests`` module would be a welcome addition. So one could change, for example, the user agent in one place and have it affect all requests calls that follow. ## Reproduction Steps ```python import requests from collections import OrderedDict headers = OrderedDict([ ("Accept", '1'), ("Accept-Encoding", '2'), ("User-Agent", '3'), ]) r = requests.get('http://www.example.com', headers=headers) ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "3.3.1" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.8.5" }, "platform": { "release": "5.8.0-50-generic", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "1010109f", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "1010106f" }, "urllib3": { "version": "1.26.4" }, "using_pyopenssl": true } ```
null
{ "+1": 2, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 2, "url": "https://api.github.com/repos/psf/requests/issues/5814/reactions" }
https://api.github.com/repos/psf/requests/issues/5814/timeline
null
null
null
null
false
[ "We provide no guarantees of heading ordering because the specification does not require ordering be preserved and we've never attempted to preserve ordering. That turns this into a feature request and the project is under a feature freeze", "Unfortunately there are many cases where the ordering of headers are used to detect and block requests from ``requests``. But I understand that ``requests`` sticks to the specification and the feature freeze means there should always be the workaround with sessions that can be used.\r\n\r\nI'm sorry for the useless issue.\r\n\r\nMy confusion stems from the usage of ``OrderedDict``, which implies that the header should be sorted. There is even a [test case](https://github.com/psf/requests/blob/f6d43b03fbb9a1e75ed63a9aa15738a8fce99b50/tests/test_requests.py#L449) ``test_headers_preserve_order(self, httpbin)`` with docstring \r\n\r\n> Preserve order when headers provided as OrderedDict.\r\n\r\nThe *english* documentation explains header orderings very well and that they are not 100% guaranteed: https://docs.python-requests.org/en/master/user/advanced/#header-ordering , but I might have read the German translation, which does not yet have the section on header orderings. I will try to write a pull request for the German version.\r\n\r\nPlease close the issue\r\n\r\n\r\n\r\n", "Hm, I'm surprised we have that test case. I don't know when we changed that but it must be fairly recent. I guess that's a good reason to look into this further if I find the time nad not close it" ]
https://api.github.com/repos/psf/requests/issues/5813
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5813/labels{/name}
https://api.github.com/repos/psf/requests/issues/5813/comments
https://api.github.com/repos/psf/requests/issues/5813/events
https://github.com/psf/requests/issues/5813
885,578,958
MDU6SXNzdWU4ODU1Nzg5NTg=
5,813
EOF occurred in violation of protocol
{ "avatar_url": "https://avatars.githubusercontent.com/u/26256009?v=4", "events_url": "https://api.github.com/users/suvratd/events{/privacy}", "followers_url": "https://api.github.com/users/suvratd/followers", "following_url": "https://api.github.com/users/suvratd/following{/other_user}", "gists_url": "https://api.github.com/users/suvratd/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/suvratd", "id": 26256009, "login": "suvratd", "node_id": "MDQ6VXNlcjI2MjU2MDA5", "organizations_url": "https://api.github.com/users/suvratd/orgs", "received_events_url": "https://api.github.com/users/suvratd/received_events", "repos_url": "https://api.github.com/users/suvratd/repos", "site_admin": false, "starred_url": "https://api.github.com/users/suvratd/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/suvratd/subscriptions", "type": "User", "url": "https://api.github.com/users/suvratd", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-05-11T01:32:00Z
2021-08-27T00:08:22Z
2021-05-11T11:13:51Z
NONE
resolved
Hi Team, I am getting this error a lot. ``` return session.request('GET', url, **kwargs) File "/var/python/lib/python2.7/site-packages/requests-2.21.0-py2.7.egg/requests/sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "/var/python/lib/python2.7/site-packages/requests-2.21.0-py2.7.egg/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/var/python/lib/python2.7/site-packages/requests-2.21.0-py2.7.egg/requests/adapters.py", line 514, in send raise SSLError(e, request=request) SSLError: HTTPSConnectionPool(host='myservce.company.com', port=443): Max retries exceeded with url: /some/url/(Caused by SSLError(SSLEOFError(8, u'EOF occurred in violation of protocol (_ssl.c:661)'),)) ``` currently using: 2.7.14 When I took traces, server is abruptly closing connection instead of sending server hello. Please help thank you in Advance. Below we are setting poolmanager ``` def init_poolmanager(self, *pool_args, **pool_kwargs): ctx = ssl_.create_urllib3_context(ciphers=CIPHERS, cert_reqs=ssl.CERT_REQUIRED, options=self.ssl_options) #import pdb; pdb.set_trace() self.poolmanager = PoolManager(*pool_args, ssl_context=ctx, **pool_kwargs) ``` And the way I am getting request ``` def get_request(self, url, **kwargs): kwargs.setdefault('allow_redirects', True) adapter = HTTPService(ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1) session = requests.session() session.mount(HTTPS, adapter) return session.request('GET', url, **kwargs) ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5813/reactions" }
https://api.github.com/repos/psf/requests/issues/5813/timeline
null
completed
null
null
false
[ "> When I took traces, server is abruptly closing connection instead of sending server hello.\r\n\r\nThis is the problem. There's nothing for Requests to do here as it's not a bug in requests but the nature of network programming." ]
https://api.github.com/repos/psf/requests/issues/5812
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5812/labels{/name}
https://api.github.com/repos/psf/requests/issues/5812/comments
https://api.github.com/repos/psf/requests/issues/5812/events
https://github.com/psf/requests/issues/5812
879,216,732
MDU6SXNzdWU4NzkyMTY3MzI=
5,812
SSL error with verify=False and mitmproxy
{ "avatar_url": "https://avatars.githubusercontent.com/u/57026130?v=4", "events_url": "https://api.github.com/users/marmaladeseismic/events{/privacy}", "followers_url": "https://api.github.com/users/marmaladeseismic/followers", "following_url": "https://api.github.com/users/marmaladeseismic/following{/other_user}", "gists_url": "https://api.github.com/users/marmaladeseismic/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/marmaladeseismic", "id": 57026130, "login": "marmaladeseismic", "node_id": "MDQ6VXNlcjU3MDI2MTMw", "organizations_url": "https://api.github.com/users/marmaladeseismic/orgs", "received_events_url": "https://api.github.com/users/marmaladeseismic/received_events", "repos_url": "https://api.github.com/users/marmaladeseismic/repos", "site_admin": false, "starred_url": "https://api.github.com/users/marmaladeseismic/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/marmaladeseismic/subscriptions", "type": "User", "url": "https://api.github.com/users/marmaladeseismic", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2021-05-07T15:29:45Z
2021-08-27T00:08:22Z
2021-05-10T13:13:32Z
NONE
resolved
Running mitmdump and trying to `requests.get` with mitmdump set as proxy and `verify=False`, I receive `SSL: CERTIFICATE_VERIFY_FAILED`. Problem on linux/macOS, **not a problem on Windows**. If I set the path to `http://...` instead of `https://...` then it does work, but I don't think I should have to do this and it's not a great solution in the actual client I'm writing. ## Expected Result Valid response in Python, no exceptions. mitmdump output: ``` % mitmdump Proxy server listening at http://*:8080 [::1]:57986: clientconnect [::1]:57986: GET https://example.com/ << 200 OK 648b [::1]:57986: clientdisconnect ``` ## Actual Result Python exception: `requests.exceptions.SSLError: HTTPSConnectionPool(host='example.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)')))` mitmdump output: ``` % mitmdump Proxy server listening at http://*:8080 [::1]:55825: clientconnect [::1]:55825: Cannot connect to server, no server address given. [::1]:55825: clientdisconnect ``` ## Reproduction Steps Run `mitmdump` and then run the following python: ```python import requests import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) verify = False #verify = '/path/to/mitmproxy/cert' # this gives a 502 but anyway shouldn't be necessary? requests.get( 'https://example.com', proxies = { 'http' : 'http://localhost:8080', 'https' : 'https://localhost:8080' }, verify = verify ) ``` ## System Information macOS (fails) ``` { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "3.3.2" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.4" }, "platform": { "release": "20.3.0", "system": "Darwin" }, "pyOpenSSL": { "openssl_version": "1010109f", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.4" }, "using_pyopenssl": true } ``` linux (fails) ``` { "chardet": { "version": "3.0.4" }, "cryptography": { "version": "2.8" }, "idna": { "version": "2.8" }, "implementation": { "name": "CPython", "version": "3.8.7" }, "platform": { "release": "5.11.14-100.fc32.x86_64", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "1010104f", "version": "19.0.0" }, "requests": { "version": "2.22.0" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.25.7" }, "using_pyopenssl": true } ``` Windows (works) ``` { "chardet": { "version": "3.0.4" }, "cryptography": { "version": "3.3.2" }, "idna": { "version": "2.8" }, "implementation": { "name": "CPython", "version": "3.8.2" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "1010109f", "version": "20.0.1" }, "requests": { "version": "2.22.0" }, "system_ssl": { "version": "1010104f" }, "urllib3": { "version": "1.25.8" }, "using_pyopenssl": true } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/57026130?v=4", "events_url": "https://api.github.com/users/marmaladeseismic/events{/privacy}", "followers_url": "https://api.github.com/users/marmaladeseismic/followers", "following_url": "https://api.github.com/users/marmaladeseismic/following{/other_user}", "gists_url": "https://api.github.com/users/marmaladeseismic/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/marmaladeseismic", "id": 57026130, "login": "marmaladeseismic", "node_id": "MDQ6VXNlcjU3MDI2MTMw", "organizations_url": "https://api.github.com/users/marmaladeseismic/orgs", "received_events_url": "https://api.github.com/users/marmaladeseismic/received_events", "repos_url": "https://api.github.com/users/marmaladeseismic/repos", "site_admin": false, "starred_url": "https://api.github.com/users/marmaladeseismic/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/marmaladeseismic/subscriptions", "type": "User", "url": "https://api.github.com/users/marmaladeseismic", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5812/reactions" }
https://api.github.com/repos/psf/requests/issues/5812/timeline
null
completed
null
null
false
[ "Is mitmproxy even listening on `https://`?", "Honestly that confuses me given the first line of the mitmdump output, but `curl --proxy localhost:8080 https://example.com` is fine and it works on Windows again with the same run params and request from Python. curl works on all of linux/mac/windows.", "> Honestly that confuses me given the first line of the mitmdump output\r\n\r\nInstead of guessing at what other things are doing, can you use a tool like `ss` to determine if it is listening to `https://` on the same port? You seem to be asking me to do all the heavy lifting and I just don't have time for that and in the past I haven't had an issue with mitmproxy and `verify=False` (and the code through that path hasn't changed very much in _years_ on our end).", "My intention was not to guess or ask you to do heavy lifting, I was hoping for pointers on what to do next.\r\n\r\nI tried `httpx` and it \"just works\" so I'm closing this." ]
https://api.github.com/repos/psf/requests/issues/5811
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5811/labels{/name}
https://api.github.com/repos/psf/requests/issues/5811/comments
https://api.github.com/repos/psf/requests/issues/5811/events
https://github.com/psf/requests/pull/5811
877,927,054
MDExOlB1bGxSZXF1ZXN0NjMxODA5NzY1
5,811
Updated to new be-cordial-or-be-on-your-way URL and CoC now references Python Community CoC
{ "avatar_url": "https://avatars.githubusercontent.com/u/9110632?v=4", "events_url": "https://api.github.com/users/MarkCBell/events{/privacy}", "followers_url": "https://api.github.com/users/MarkCBell/followers", "following_url": "https://api.github.com/users/MarkCBell/following{/other_user}", "gists_url": "https://api.github.com/users/MarkCBell/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/MarkCBell", "id": 9110632, "login": "MarkCBell", "node_id": "MDQ6VXNlcjkxMTA2MzI=", "organizations_url": "https://api.github.com/users/MarkCBell/orgs", "received_events_url": "https://api.github.com/users/MarkCBell/received_events", "repos_url": "https://api.github.com/users/MarkCBell/repos", "site_admin": false, "starred_url": "https://api.github.com/users/MarkCBell/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/MarkCBell/subscriptions", "type": "User", "url": "https://api.github.com/users/MarkCBell", "user_view_type": "public" }
[]
closed
true
null
[]
null
6
2021-05-06T19:37:35Z
2021-08-27T00:08:40Z
2021-05-07T16:54:38Z
CONTRIBUTOR
resolved
The current documentation contains two references to Kenneth Reitz's "Be Cordial or Be on Your Way" but the URL for this has now changed. The PR replaces these with the current URL.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5811/reactions" }
https://api.github.com/repos/psf/requests/issues/5811/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5811.diff", "html_url": "https://github.com/psf/requests/pull/5811", "merged_at": "2021-05-07T16:54:38Z", "patch_url": "https://github.com/psf/requests/pull/5811.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5811" }
true
[ "@nateprewitt I think we should switch to a _real_ CoC, i.e., the PSF CoC. I didn't realize this was still listed as our CoC since we're in the PSF's org", "Yep, totally fine by me, let's do it.", "@MarkCBell would you be willing to do that? You might look at how other github.com/psf repositories are linking to the PSF Code of Conduct to see how that works for those projects", "@sigmavirus24 Yes, that sounds like a sensible idea and something I can do. I'll update this PR in a couple of hours with a new candidate CoC.", "@sigmavirus24 I've now updated this PR to include a CoC which references the Python Community Code of Conduct. I based this on black's CoC (it was the only repositories in github.com/psf with a CoC). Let me know if you have any suggestions for changes to this initial version.", "Thanks @MarkCBell " ]
https://api.github.com/repos/psf/requests/issues/5810
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5810/labels{/name}
https://api.github.com/repos/psf/requests/issues/5810/comments
https://api.github.com/repos/psf/requests/issues/5810/events
https://github.com/psf/requests/pull/5810
875,330,708
MDExOlB1bGxSZXF1ZXN0NjI5Njk0ODQ2
5,810
Throw value error when serializing JSON object with NaN value
{ "avatar_url": "https://avatars.githubusercontent.com/u/47358379?v=4", "events_url": "https://api.github.com/users/tallalnparis4ev/events{/privacy}", "followers_url": "https://api.github.com/users/tallalnparis4ev/followers", "following_url": "https://api.github.com/users/tallalnparis4ev/following{/other_user}", "gists_url": "https://api.github.com/users/tallalnparis4ev/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/tallalnparis4ev", "id": 47358379, "login": "tallalnparis4ev", "node_id": "MDQ6VXNlcjQ3MzU4Mzc5", "organizations_url": "https://api.github.com/users/tallalnparis4ev/orgs", "received_events_url": "https://api.github.com/users/tallalnparis4ev/received_events", "repos_url": "https://api.github.com/users/tallalnparis4ev/repos", "site_admin": false, "starred_url": "https://api.github.com/users/tallalnparis4ev/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tallalnparis4ev/subscriptions", "type": "User", "url": "https://api.github.com/users/tallalnparis4ev", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2021-05-04T10:37:03Z
2021-08-27T00:08:40Z
2021-05-06T18:18:58Z
CONTRIBUTOR
resolved
I am attempting to fix #5767 with this PR. Feedback is really appreciated.
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5810/reactions" }
https://api.github.com/repos/psf/requests/issues/5810/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5810.diff", "html_url": "https://github.com/psf/requests/pull/5810", "merged_at": "2021-05-06T18:18:58Z", "patch_url": "https://github.com/psf/requests/pull/5810.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5810" }
true
[]
https://api.github.com/repos/psf/requests/issues/5809
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5809/labels{/name}
https://api.github.com/repos/psf/requests/issues/5809/comments
https://api.github.com/repos/psf/requests/issues/5809/events
https://github.com/psf/requests/issues/5809
875,133,993
MDU6SXNzdWU4NzUxMzM5OTM=
5,809
Chardet Licence
{ "avatar_url": "https://avatars.githubusercontent.com/u/20928617?v=4", "events_url": "https://api.github.com/users/pokecheater/events{/privacy}", "followers_url": "https://api.github.com/users/pokecheater/followers", "following_url": "https://api.github.com/users/pokecheater/following{/other_user}", "gists_url": "https://api.github.com/users/pokecheater/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pokecheater", "id": 20928617, "login": "pokecheater", "node_id": "MDQ6VXNlcjIwOTI4NjE3", "organizations_url": "https://api.github.com/users/pokecheater/orgs", "received_events_url": "https://api.github.com/users/pokecheater/received_events", "repos_url": "https://api.github.com/users/pokecheater/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pokecheater/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pokecheater/subscriptions", "type": "User", "url": "https://api.github.com/users/pokecheater", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-05-04T06:04:18Z
2021-05-20T11:19:25Z
2021-05-04T09:42:39Z
NONE
resolved
Hey :), I have an question regarding the licensing and a sub module you are using. As builded our application which uses flask (and flask uses requests) I noticed that a tiny package with the name chardet appeared in our installation that is licenced under GNU. As far as I understand has GNU a copyleft. Since your package uses the chardet lib and builds up on the top of it's coding source I am confused that the requests lib is licenced under Apache 2.0 and not GNU. As far as I understand has GNU a strict copyleft which means that even if only library calls are used the whole software that is using it should be licenced under gpl. Maybe it is just me that misinterpret the rights and duties that come along with GNU. Just want to be sure I do not redistribute our closed source software when I have to put it under GNU. Thanks in advance :).
{ "avatar_url": "https://avatars.githubusercontent.com/u/20928617?v=4", "events_url": "https://api.github.com/users/pokecheater/events{/privacy}", "followers_url": "https://api.github.com/users/pokecheater/followers", "following_url": "https://api.github.com/users/pokecheater/following{/other_user}", "gists_url": "https://api.github.com/users/pokecheater/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pokecheater", "id": 20928617, "login": "pokecheater", "node_id": "MDQ6VXNlcjIwOTI4NjE3", "organizations_url": "https://api.github.com/users/pokecheater/orgs", "received_events_url": "https://api.github.com/users/pokecheater/received_events", "repos_url": "https://api.github.com/users/pokecheater/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pokecheater/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pokecheater/subscriptions", "type": "User", "url": "https://api.github.com/users/pokecheater", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5809/reactions" }
https://api.github.com/repos/psf/requests/issues/5809/timeline
null
completed
null
null
false
[ "Okay forget about it just found out that it is fine with Lesser GPL and chardet is licensed under this terms. ", "Hey I have the same question. Chardet is using LGPL 2.1 licensing. Isn't it a copyleft license?" ]
https://api.github.com/repos/psf/requests/issues/5808
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5808/labels{/name}
https://api.github.com/repos/psf/requests/issues/5808/comments
https://api.github.com/repos/psf/requests/issues/5808/events
https://github.com/psf/requests/pull/5808
873,678,146
MDExOlB1bGxSZXF1ZXN0NjI4NDM2NDA0
5,808
Make use of the 'yield from' keyword whenever possible for a better pythonic look!
{ "avatar_url": "https://avatars.githubusercontent.com/u/62179149?v=4", "events_url": "https://api.github.com/users/wiseaidev/events{/privacy}", "followers_url": "https://api.github.com/users/wiseaidev/followers", "following_url": "https://api.github.com/users/wiseaidev/following{/other_user}", "gists_url": "https://api.github.com/users/wiseaidev/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/wiseaidev", "id": 62179149, "login": "wiseaidev", "node_id": "MDQ6VXNlcjYyMTc5MTQ5", "organizations_url": "https://api.github.com/users/wiseaidev/orgs", "received_events_url": "https://api.github.com/users/wiseaidev/received_events", "repos_url": "https://api.github.com/users/wiseaidev/repos", "site_admin": false, "starred_url": "https://api.github.com/users/wiseaidev/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/wiseaidev/subscriptions", "type": "User", "url": "https://api.github.com/users/wiseaidev", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-05-01T13:48:59Z
2021-08-27T00:08:41Z
2021-05-01T15:44:11Z
NONE
resolved
Signed-off-by: Harmouch101 <[email protected]>
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5808/reactions" }
https://api.github.com/repos/psf/requests/issues/5808/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5808.diff", "html_url": "https://github.com/psf/requests/pull/5808", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5808.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5808" }
true
[ "We're not accepting cosmetic changes or changes which break compatibility with Python 2.7", "Oh! I didn't notice it supports python 2.7. However, I think the project needs to be updated to support only versions > 3.5 of python since other versions have reached the [end of life](https://endoflife.date/python) in terms of security support." ]
https://api.github.com/repos/psf/requests/issues/5807
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5807/labels{/name}
https://api.github.com/repos/psf/requests/issues/5807/comments
https://api.github.com/repos/psf/requests/issues/5807/events
https://github.com/psf/requests/issues/5807
873,028,335
MDU6SXNzdWU4NzMwMjgzMzU=
5,807
2.25.1: requests requires idna < 3
{ "avatar_url": "https://avatars.githubusercontent.com/u/31284574?v=4", "events_url": "https://api.github.com/users/kloczek/events{/privacy}", "followers_url": "https://api.github.com/users/kloczek/followers", "following_url": "https://api.github.com/users/kloczek/following{/other_user}", "gists_url": "https://api.github.com/users/kloczek/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kloczek", "id": 31284574, "login": "kloczek", "node_id": "MDQ6VXNlcjMxMjg0NTc0", "organizations_url": "https://api.github.com/users/kloczek/orgs", "received_events_url": "https://api.github.com/users/kloczek/received_events", "repos_url": "https://api.github.com/users/kloczek/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kloczek/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kloczek/subscriptions", "type": "User", "url": "https://api.github.com/users/kloczek", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-04-30T18:21:02Z
2021-08-27T00:08:23Z
2021-04-30T19:20:31Z
NONE
resolved
Looks like requests modulehas hardcoded dependency to require `idna >= 2.5 and idna< 3` and latest idna is 3.1. Is it any reason why it cannot be idna is 3.1? amd/or if it is could requests module can be adjusted to be able use it with latest idna?
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5807/reactions" }
https://api.github.com/repos/psf/requests/issues/5807/timeline
null
completed
null
null
false
[ "Hi @kloczek, there are a number of issues around this including very recent ones like #5804. Please make sure to check open and closed issues before opening new ones in the future. Thanks!", "> Hi @kloczek, there are a number of issues around this including very recent ones like #5804. Please make sure to check open and closed issues before opening new ones in the future. Thanks!\r\n\r\nHmm .. you've just closed the ticket without provide answers on any of my questions :(\r\n" ]
https://api.github.com/repos/psf/requests/issues/5806
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5806/labels{/name}
https://api.github.com/repos/psf/requests/issues/5806/comments
https://api.github.com/repos/psf/requests/issues/5806/events
https://github.com/psf/requests/issues/5806
871,284,409
MDU6SXNzdWU4NzEyODQ0MDk=
5,806
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 1 (char 2)
{ "avatar_url": "https://avatars.githubusercontent.com/u/76562306?v=4", "events_url": "https://api.github.com/users/aymenbnl/events{/privacy}", "followers_url": "https://api.github.com/users/aymenbnl/followers", "following_url": "https://api.github.com/users/aymenbnl/following{/other_user}", "gists_url": "https://api.github.com/users/aymenbnl/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/aymenbnl", "id": 76562306, "login": "aymenbnl", "node_id": "MDQ6VXNlcjc2NTYyMzA2", "organizations_url": "https://api.github.com/users/aymenbnl/orgs", "received_events_url": "https://api.github.com/users/aymenbnl/received_events", "repos_url": "https://api.github.com/users/aymenbnl/repos", "site_admin": false, "starred_url": "https://api.github.com/users/aymenbnl/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/aymenbnl/subscriptions", "type": "User", "url": "https://api.github.com/users/aymenbnl", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-04-29T17:49:38Z
2021-04-30T00:36:29Z
2021-04-29T18:39:23Z
NONE
spam
Summary. Cant import json data into Mysql Database because of this issue What you expected. A proper import of course. What happened instead. json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 1 (char 2) ## Reproduction Steps ``` if args.input: with open(args.input, 'r') as f: for e in f: event = json.loads(e) misp.add_event(event) ``` ## System Information { "response":[ { "Event":{ "id":"1", "orgc_id":"1", "org_id":"1", "date":"2017-09-27", "threat_level_id":"4", "info":"ZeuS IP blocklist (Standard) feed", "published":true, "uuid":"59cb4f10-4190-4f76-988e-66a239b59801", "attribute_count":"108", "analysis":"2", "timestamp":"1506496272", "distribution":"3", "proposal_email_lock":false, "locked":false, "publish_timestamp":"1533556422", "sharing_group_id":"0", "disable_correlation":false, "extends_uuid":"" }}]} This is running on up-to-date Ubuntu 20.04 and Python 3.8.5
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5806/reactions" }
https://api.github.com/repos/psf/requests/issues/5806/timeline
null
completed
null
null
false
[ "Hi @aymenbnl,\r\n\r\nThis doesn't appear to be related to Requests from the info provided. We'd recommend posting general Python questions on [StackOverflow](https://stackoverflow.com/)." ]
https://api.github.com/repos/psf/requests/issues/5805
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5805/labels{/name}
https://api.github.com/repos/psf/requests/issues/5805/comments
https://api.github.com/repos/psf/requests/issues/5805/events
https://github.com/psf/requests/issues/5805
871,106,048
MDU6SXNzdWU4NzExMDYwNDg=
5,805
POST request is resent as GET when the status code is 301
{ "avatar_url": "https://avatars.githubusercontent.com/u/33695680?v=4", "events_url": "https://api.github.com/users/Maelstro/events{/privacy}", "followers_url": "https://api.github.com/users/Maelstro/followers", "following_url": "https://api.github.com/users/Maelstro/following{/other_user}", "gists_url": "https://api.github.com/users/Maelstro/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Maelstro", "id": 33695680, "login": "Maelstro", "node_id": "MDQ6VXNlcjMzNjk1Njgw", "organizations_url": "https://api.github.com/users/Maelstro/orgs", "received_events_url": "https://api.github.com/users/Maelstro/received_events", "repos_url": "https://api.github.com/users/Maelstro/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Maelstro/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Maelstro/subscriptions", "type": "User", "url": "https://api.github.com/users/Maelstro", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-04-29T14:56:20Z
2021-08-27T00:08:23Z
2021-04-29T15:29:59Z
NONE
resolved
Hello, I'd like to report a bug with `requests` behavior towards processing a 301 response. The 301 response to a POST request causes the user agent to automatically redirect the request to a given address, but it also changes the request type from POST to GET. The RFC 2616 mentions such behavior as shown below: ``` Note: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request. ``` Therefore, I think that `requests` isn't compliant with the RFC [(10.3.2 301 Moved Permanently)](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) in this matter. ## Expected Result When the response to a POST request has a status code 301, the automatic redirect should also be a POST request. ## Actual Result Having sent a POST request to a given endpoint and receiving a response with a status code 301, the automatic redirect request becomes a GET request. Example shown below: ``` * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 127.0.0.1 - - [29/Apr/2021 16:43:03] "POST /test_route HTTP/1.1" 301 - 127.0.0.1 - - [29/Apr/2021 16:43:03] "GET /test_route HTTP/1.1" 405 - ``` ## Reproduction Steps Create two scripts - a server and a client. `test_server.py` ``` import flask app = flask.Flask(__name__) @app.route("/test_route", methods=["POST"]) def test_response(): return flask.redirect("http://localhost:5000/test_route", code=301) if __name__ == "__main__": app.run() ``` `test_request.py`: ``` import requests if __name__ == "__main__": print(requests.request("POST", "http://localhost:5000/test_route")) ``` After creating them, start the `test_server.py`. When the server starts, run the `test_request.py`. In the server logs you'll see the aforementioned base request and the redirected request. ## System Information The library is system-independent, the behavior occurs on any device, from Raspberry Pi with Raspbian Buster, to x64 Debian Bullseye (testing).
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5805/reactions" }
https://api.github.com/repos/psf/requests/issues/5805/timeline
null
completed
null
null
false
[ "Hi @Maelstro,\r\n\r\nThis is expected behavior, the RFC you’re referencing has been obsolete for several years now.\r\n\r\nPlease make sure to search open and closed issues as we’ve requested before opening new ones in the future. You’ll be able to find this [answered](https://github.com/psf/requests/issues/5494#issuecomment-644314490) and the link to the relevant RFC there. Thanks!" ]
https://api.github.com/repos/psf/requests/issues/5804
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5804/labels{/name}
https://api.github.com/repos/psf/requests/issues/5804/comments
https://api.github.com/repos/psf/requests/issues/5804/events
https://github.com/psf/requests/issues/5804
870,467,550
MDU6SXNzdWU4NzA0Njc1NTA=
5,804
idna-3 is not supported
{ "avatar_url": "https://avatars.githubusercontent.com/u/110765?v=4", "events_url": "https://api.github.com/users/mgorny/events{/privacy}", "followers_url": "https://api.github.com/users/mgorny/followers", "following_url": "https://api.github.com/users/mgorny/following{/other_user}", "gists_url": "https://api.github.com/users/mgorny/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/mgorny", "id": 110765, "login": "mgorny", "node_id": "MDQ6VXNlcjExMDc2NQ==", "organizations_url": "https://api.github.com/users/mgorny/orgs", "received_events_url": "https://api.github.com/users/mgorny/received_events", "repos_url": "https://api.github.com/users/mgorny/repos", "site_admin": false, "starred_url": "https://api.github.com/users/mgorny/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mgorny/subscriptions", "type": "User", "url": "https://api.github.com/users/mgorny", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-04-28T22:58:53Z
2021-08-27T00:08:24Z
2021-04-28T23:01:56Z
CONTRIBUTOR
resolved
idna-3 has been released on Jan 1st. However, requests still requires idna<3 preventing a lot of projects from upgrading. ## Expected Result requests supporting idna-3.1 ## Actual Result requests force idna<3 ## Reproduction Steps Errr, install requests? ;-) ## System Information ``` $ python -m requests.help { "chardet": { "version": "4.0.0" }, "cryptography": { "version": "3.4.7" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.4" }, "platform": { "release": "5.11.16-gentoo-dist", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "101010bf", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.26.4" }, "using_pyopenssl": true } ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/5271761?v=4", "events_url": "https://api.github.com/users/nateprewitt/events{/privacy}", "followers_url": "https://api.github.com/users/nateprewitt/followers", "following_url": "https://api.github.com/users/nateprewitt/following{/other_user}", "gists_url": "https://api.github.com/users/nateprewitt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/nateprewitt", "id": 5271761, "login": "nateprewitt", "node_id": "MDQ6VXNlcjUyNzE3NjE=", "organizations_url": "https://api.github.com/users/nateprewitt/orgs", "received_events_url": "https://api.github.com/users/nateprewitt/received_events", "repos_url": "https://api.github.com/users/nateprewitt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/nateprewitt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nateprewitt/subscriptions", "type": "User", "url": "https://api.github.com/users/nateprewitt", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5804/reactions" }
https://api.github.com/repos/psf/requests/issues/5804/timeline
null
completed
null
null
false
[ "Hi @mgorny, this is a duplicate of #5710. Please be sure to check open issues before posting new ones. Thanks!" ]
https://api.github.com/repos/psf/requests/issues/5803
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5803/labels{/name}
https://api.github.com/repos/psf/requests/issues/5803/comments
https://api.github.com/repos/psf/requests/issues/5803/events
https://github.com/psf/requests/issues/5803
870,394,738
MDU6SXNzdWU4NzAzOTQ3Mzg=
5,803
Gzip decompression corrupts file
{ "avatar_url": "https://avatars.githubusercontent.com/u/37975547?v=4", "events_url": "https://api.github.com/users/eloparco/events{/privacy}", "followers_url": "https://api.github.com/users/eloparco/followers", "following_url": "https://api.github.com/users/eloparco/following{/other_user}", "gists_url": "https://api.github.com/users/eloparco/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/eloparco", "id": 37975547, "login": "eloparco", "node_id": "MDQ6VXNlcjM3OTc1NTQ3", "organizations_url": "https://api.github.com/users/eloparco/orgs", "received_events_url": "https://api.github.com/users/eloparco/received_events", "repos_url": "https://api.github.com/users/eloparco/repos", "site_admin": false, "starred_url": "https://api.github.com/users/eloparco/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/eloparco/subscriptions", "type": "User", "url": "https://api.github.com/users/eloparco", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-04-28T21:23:36Z
2021-08-27T00:08:24Z
2021-04-28T21:53:13Z
NONE
resolved
## Summary I want to download a gzip file (`https://iptoasn.com/data/ip2asn-v4.tsv.gz`) and save it locally already decompressed. According to the [docs](https://docs.python-requests.org/en/master/user/quickstart/#raw-response-content), downloading a compressed file should automatically decompress it. ## Expected Result The `ip2asn-v4.tsv` file correctly decompressed. ## Actual Result The `ip2asn-v4.tsv` generated is corrupted. Below the content after opening it with excel: ![image](https://user-images.githubusercontent.com/37975547/116474115-60e38f00-a878-11eb-8a1b-816ff9b89e54.png) ## Reproduction Steps This is the minimal code snippet to reproduce my use case: ```python import requests r = requests.get('https://iptoasn.com/data/ip2asn-v4.tsv.gz', stream=True) with open('ip2asn-v4.tsv', 'wb') as fd: for chunk in r.iter_content(chunk_size=None): fd.write(chunk) ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5803/reactions" }
https://api.github.com/repos/psf/requests/issues/5803/timeline
null
completed
null
null
false
[ "If you look at the headers on your response you'll see that there is no `Content-Encoding: gzip` which you seem to be expecting. Even if you forcibly send `Accept-Encoding: gzip` the URL doesn't reply with a `Content-Encoding`, so Requests won't automatically decode the gzipped file because the endpoint hasn't declared it (and it wouldn't make much sense for the endpoint to do so, it's already gzipped and gzipping again will make the file even larger!)\r\n\r\nInstead you need to gzip-decompress the file contents yourself, I recommend `gzip.decompress()` or `gzip.GzipFile` for streaming.\r\n\r\nIn the future, this isn't the place for asking questions about how to use Requests, this is for tracking defects in Requests (which this is not). Try Stack Overflow next time.", "You're right, thanks for the answer :)" ]
https://api.github.com/repos/psf/requests/issues/5802
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5802/labels{/name}
https://api.github.com/repos/psf/requests/issues/5802/comments
https://api.github.com/repos/psf/requests/issues/5802/events
https://github.com/psf/requests/pull/5802
870,250,619
MDExOlB1bGxSZXF1ZXN0NjI1NDc2Njc4
5,802
mini update and badges
{ "avatar_url": "https://avatars.githubusercontent.com/u/66271043?v=4", "events_url": "https://api.github.com/users/Yourun-proger/events{/privacy}", "followers_url": "https://api.github.com/users/Yourun-proger/followers", "following_url": "https://api.github.com/users/Yourun-proger/following{/other_user}", "gists_url": "https://api.github.com/users/Yourun-proger/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Yourun-proger", "id": 66271043, "login": "Yourun-proger", "node_id": "MDQ6VXNlcjY2MjcxMDQz", "organizations_url": "https://api.github.com/users/Yourun-proger/orgs", "received_events_url": "https://api.github.com/users/Yourun-proger/received_events", "repos_url": "https://api.github.com/users/Yourun-proger/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Yourun-proger/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Yourun-proger/subscriptions", "type": "User", "url": "https://api.github.com/users/Yourun-proger", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2021-04-28T18:54:53Z
2021-08-27T00:08:42Z
2021-04-28T19:06:56Z
NONE
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5802/reactions" }
https://api.github.com/repos/psf/requests/issues/5802/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5802.diff", "html_url": "https://github.com/psf/requests/pull/5802", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5802.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5802" }
true
[ "Sorry, we're not accepting PRs that rearrange things.", "Sorry... Ok)" ]
https://api.github.com/repos/psf/requests/issues/5801
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5801/labels{/name}
https://api.github.com/repos/psf/requests/issues/5801/comments
https://api.github.com/repos/psf/requests/issues/5801/events
https://github.com/psf/requests/issues/5801
867,113,591
MDU6SXNzdWU4NjcxMTM1OTE=
5,801
403 error while using github API
{ "avatar_url": "https://avatars.githubusercontent.com/u/7804791?v=4", "events_url": "https://api.github.com/users/purarue/events{/privacy}", "followers_url": "https://api.github.com/users/purarue/followers", "following_url": "https://api.github.com/users/purarue/following{/other_user}", "gists_url": "https://api.github.com/users/purarue/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/purarue", "id": 7804791, "login": "purarue", "node_id": "MDQ6VXNlcjc4MDQ3OTE=", "organizations_url": "https://api.github.com/users/purarue/orgs", "received_events_url": "https://api.github.com/users/purarue/received_events", "repos_url": "https://api.github.com/users/purarue/repos", "site_admin": false, "starred_url": "https://api.github.com/users/purarue/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/purarue/subscriptions", "type": "User", "url": "https://api.github.com/users/purarue", "user_view_type": "public" }
[]
closed
true
null
[]
null
14
2021-04-25T21:03:16Z
2021-11-18T12:00:43Z
2021-08-20T07:01:06Z
NONE
resolved
## Summary TL;DR: `requests` raises a 403 while requesting an authenticated Github API route, which otherwise succeeds while using `curl`/another python library like `httpx` Was initially discovered [in the 'ghexport' project](https://github.com/karlicoss/ghexport/issues/4); I did a reasonable amount of debugging [and created this repo](https://github.com/seanbreckenridge/pygithub_requests_error) before submitting [this issue](https://github.com/PyGithub/PyGithub/issues/1700) to PyGithub, but thats a lot to look through, just leaving it here as context. It's been hard to reproduce, the creator of [ghexport](https://github.com/karlicoss/ghexport/issues/4) (where this was initially discovered) didn't have the same issue, so I'm unsure of the exact reason ## Expected Result `requests` succeeds for the authenticated request ## Actual Result Request fails, with: ``` {'message': 'Must have push access to repository', 'documentation_url': 'https://docs.github.com/rest/reference/repos#get-repository-clones'} failed Traceback (most recent call last): File "/home/sean/Repos/pygithub_requests_error/minimal.py", line 47, in <module> main() File "/home/sean/Repos/pygithub_requests_error/minimal.py", line 44, in main make_request(requests.get, url, headers) File "/home/sean/Repos/pygithub_requests_error/minimal.py", line 31, in make_request resp.raise_for_status() File "/home/sean/.local/lib/python3.9/site-packages/requests/models.py", line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/seanbreckenridge/albums/traffic/clones ``` ## Reproduction Steps Apologies if this is a bit too specific, but otherwise `requests` works great on my system and I can't find any other way to reproduce this -- Is a bit long as it requires an auth token Go [here](https://github.com/settings/tokens) and create a token with scopes like: ![](https://camo.githubusercontent.com/26e2554ac4c840294f60e225242849c98c20dfb89470f493e89be4824f1218f9/68747470733a2f2f692e696d6775722e636f6d2f4f4d46724e6e4b2e706e67) I've compared this to httpx, where it doesn't fail: ```python #!/usr/bin/env python3 from typing import Callable, Any import requests import httpx # extract status/status_code from the requests/httpx item def extract_status(obj: Any) -> int: if hasattr(obj, "status"): return obj.status if hasattr(obj, "status_code"): return obj.status_code raise TypeError("unsupported request object") def make_request(using_verb: Callable[..., Any], url: str, headers: Any) -> None: print("using", using_verb.__module__, using_verb.__qualname__, url) resp = using_verb(url, headers=headers) status = extract_status(resp) print(str(resp.json())) if status == 200: print("succeeded") else: print("failed") resp.raise_for_status() def main(): # see https://github.com/seanbreckenridge/pygithub_requests_error for token scopes auth_token = "put your auth token here" headers = { "Authorization": "token {}".format(auth_token), "User-Agent": "requests_error", "Accept": "application/vnd.github.v3+json", } # replace this with a URL you have access to url = "https://api.github.com/repos/seanbreckenridge/albums/traffic/clones" make_request(httpx.get, url, headers) make_request(requests.get, url, headers) if __name__ == "__main__": main() ``` That outputs: ``` using httpx get https://api.github.com/repos/seanbreckenridge/albums/traffic/clones {'count': 15, 'uniques': 10, 'clones': [{'timestamp': '2021-04-12T00:00:00Z', 'count': 1, 'uniques': 1}, {'timestamp': '2021-04-14T00:00:00Z', 'count': 1, 'uniques': 1}, {'timestamp': '2021-04-17T00:00:00Z', 'count': 1, 'uniques': 1}, {'timestamp': '2021-04-18T00:00:00Z', 'count': 2, 'uniques': 2}, {'timestamp': '2021-04-23T00:00:00Z', 'count': 9, 'uniques': 5}, {'timestamp': '2021-04-25T00:00:00Z', 'count': 1, 'uniques': 1}]} succeeded using requests.api get https://api.github.com/repos/seanbreckenridge/albums/traffic/clones {'message': 'Must have push access to repository', 'documentation_url': 'https://docs.github.com/rest/reference/repos#get-repository-clones'} failed Traceback (most recent call last): File "/home/sean/Repos/pygithub_requests_error/minimal.py", line 48, in <module> main() File "/home/sean/Repos/pygithub_requests_error/minimal.py", line 45, in main make_request(requests.get, url, headers) File "/home/sean/Repos/pygithub_requests_error/minimal.py", line 32, in make_request resp.raise_for_status() File "/home/sean/.local/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/seanbreckenridge/albums/traffic/clones ``` Another thing that may be useful as context is the [`pdb` trace I did here](https://github.com/karlicoss/ghexport/issues/4#issuecomment-693694338), which was me stepping into where the request was made in `PyGithub`, and making all the requests manually using the computed `url`/`headers`. Fails when I use `requests.get` but `httpx.get` works fine: ``` > /home/sean/.local/lib/python3.8/site-packages/github/Requester.py(484)__requestEncode() -> self.NEW_DEBUG_FRAME(requestHeaders) (Pdb) n > /home/sean/.local/lib/python3.8/site-packages/github/Requester.py(486)__requestEncode() -> status, responseHeaders, output = self.__requestRaw( (Pdb) w /home/sean/Repos/ghexport/export.py(109)<module>() -> main() /home/sean/Repos/ghexport/export.py(84)main() -> j = get_json(**params) /home/sean/Repos/ghexport/export.py(74)get_json() -> return Exporter(**params).export_json() /home/sean/Repos/ghexport/export.py(60)export_json() -> repo._requester.requestJsonAndCheck('GET', repo.url + '/traffic/' + f) /home/sean/.local/lib/python3.8/site-packages/github/Requester.py(318)requestJsonAndCheck() -> *self.requestJson( /home/sean/.local/lib/python3.8/site-packages/github/Requester.py(410)requestJson() -> return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode) > /home/sean/.local/lib/python3.8/site-packages/github/Requester.py(486)__requestEncode() -> status, responseHeaders, output = self.__requestRaw( (Pdb) url '/repos/seanbreckenridge/advent-of-code-2019/traffic/views' (Pdb) requestHeaders {'Authorization': 'token <MY TOKEN HERE>', 'User-Agent': 'PyGithub/Python'} (Pdb) import requests (Pdb) requests.get("https://api.github.com" + url, headers=requestHeaders).json() {'message': 'Must have push access to repository', 'documentation_url': 'https://docs.github.com/rest/reference/repos#get-page-views'} (Pdb) httpx.get("https://api.github.com" + url, headers=requestHeaders).json() {'count': 0, 'uniques': 0, 'views': []} (Pdb) httpx succeeded?? ``` ## System Information $ python -m requests.help ``` { "chardet": { "version": "3.0.4" }, "cryptography": { "version": "3.4.7" }, "idna": { "version": "2.10" }, "implementation": { "name": "CPython", "version": "3.9.3" }, "platform": { "release": "5.11.16-arch1-1", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "101010bf", "version": "20.0.1" }, "requests": { "version": "2.25.1" }, "system_ssl": { "version": "101010bf" }, "urllib3": { "version": "1.25.9" }, "using_pyopenssl": true } ``` ``` $ pip freeze | grep -E 'requests|httpx' httpx==0.16.1 requests==2.25.1 ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/7804791?v=4", "events_url": "https://api.github.com/users/purarue/events{/privacy}", "followers_url": "https://api.github.com/users/purarue/followers", "following_url": "https://api.github.com/users/purarue/following{/other_user}", "gists_url": "https://api.github.com/users/purarue/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/purarue", "id": 7804791, "login": "purarue", "node_id": "MDQ6VXNlcjc4MDQ3OTE=", "organizations_url": "https://api.github.com/users/purarue/orgs", "received_events_url": "https://api.github.com/users/purarue/received_events", "repos_url": "https://api.github.com/users/purarue/repos", "site_admin": false, "starred_url": "https://api.github.com/users/purarue/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/purarue/subscriptions", "type": "User", "url": "https://api.github.com/users/purarue", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5801/reactions" }
https://api.github.com/repos/psf/requests/issues/5801/timeline
null
completed
null
null
false
[ "I can't reproduce this\r\n\r\n```\r\n>>> import requests\r\n>>> token = 'ghp_mytotallyrealtokenwithonlyreposcope'\r\n>>> headers = {'Authorization': f'token {token}', \"User-Agent\": \"testing-requests-5801\", \"Accept\": \"application/vnd.github.v3+json\"}\r\n>>> url = \"https://api.github.com/repos/sigmavirus24/github3.py/traffic/clones\"\r\n>>> requests.get(url, headers=headers)\r\n<Response [200]>\r\n>>> r = _\r\n>>> r.request\r\n<PreparedRequest [GET]>\r\n>>> r.request.headers\r\n{'User-Agent': 'testing-requests-5801', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/vnd.github.v3+json', 'Connection': 'keep-alive', 'Authorization': 'token ghp_mytotallyrealtokenwithonlyreposcope'}\r\n>>> r.json()\r\n{'count': 1656, 'uniques': 1532, 'clones': [{'timestamp': '2021-04-12T00:00:00Z', 'count': 174, 'uniques': 168}, {'timestamp': '2021-04-13T00:00:00Z', 'count': 248, 'uniques': 228}, {'timestamp': '2021-04-14T00:00:00Z', 'count': 209, 'uniques': 206}, {'timestamp': '2021-04-15T00:00:00Z', 'count': 153, 'uniques': 146}, {'timestamp': '2021-04-16T00:00:00Z', 'count': 137, 'uniques': 131}, {'timestamp': '2021-04-17T00:00:00Z', 'count': 13, 'uniques': 13}, {'timestamp': '2021-04-18T00:00:00Z', 'count': 9, 'uniques': 9}, {'timestamp': '2021-04-19T00:00:00Z', 'count': 96, 'uniques': 92}, {'timestamp': '2021-04-20T00:00:00Z', 'count': 172, 'uniques': 139}, {'timestamp': '2021-04-21T00:00:00Z', 'count': 129, 'uniques': 124}, {'timestamp': '2021-04-22T00:00:00Z', 'count': 137, 'uniques': 132}, {'timestamp': '2021-04-23T00:00:00Z', 'count': 154, 'uniques': 148}, {'timestamp': '2021-04-24T00:00:00Z', 'count': 11, 'uniques': 11}, {'timestamp': '2021-04-25T00:00:00Z', 'count': 14, 'uniques': 14}]}\r\n>>>\r\n```", "Yeah, I was expecting that might be the problem with reporting the issue, is there anything else I can do to diagnose this further?", "You could look at what's present in your `response.request` object. I printed the headers as there shouldn't be anything else differing. You may also look into whether you have any proxies or other intermediaries that Requests might be detecting and using for your traffic - which httpx might not be using.", "I don't want to hijack this issue, and will happily file my own if my issue is unrelated, but I'm having a problem with making an `OPTIONS` request. If I run the following code in `python 2.7` with `requests 2.7.0` it works fine and I get a `204` back. If I run it with `python 3.8.5` I get a `403`:\r\n```\r\nimport requests\r\nfrom requests_toolbelt.utils import dump\r\n\r\ndef print_raw_http(response):\r\n data = dump.dump_all(response, request_prefix=b'', response_prefix=b'')\r\n print('\\n' * 2 + data.decode('utf-8'))\r\n\r\nheaders = {\r\n 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)',\r\n}\r\nsession = requests.Session()\r\nr = session.options('https://ocapi-app.arlo.com/api/auth', headers=headers)\r\nprint_raw_http(r)\r\nr.raise_for_status()\r\n```\r\n\r\n```\r\n$ python -V\r\nPython 2.7.16\r\n\r\n$ python3 -V\r\nPython 3.8.5\r\n\r\n$ pip freeze | grep requests\r\nrequests==2.7.0\r\n\r\n$ pip3 freeze | grep requests\r\nrequests==2.7.0\r\n```\r\n\r\n`python 2.7`:\r\n```\r\n$ python blah.py \r\n\r\n\r\nOPTIONS /api/auth HTTP/1.1\r\nHost: ocapi-app.arlo.com\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)\r\nContent-Length: 0\r\n\r\n\r\nHTTP/1.1 204 No Content\r\n```\r\n\r\n`python 3.8.5`:\r\n```\r\n$ python3 blah.py \r\n\r\n\r\nOPTIONS /api/auth HTTP/1.1\r\nHost: ocapi-app.arlo.com\r\nUser-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-Length: 0\r\n\r\n\r\nHTTP/1.1 403 Forbidden\r\n```\r\n\r\nWorks fine with cURL too:\r\n```\r\ncurl -vvvv -X OPTIONS \"https://ocapi-app.arlo.com/api/auth\" --output --http1.1 --no-alpn --no-npn -H \"Host: ocapi-app.arlo.com\" -H \"Connection: keep-alive\" -H \"Accept-Encoding: gzip, deflate\" -H \"Accept: */*\" -H \"User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)\" -H \"Content-length: 0\"\r\n```\r\n```\r\n> OPTIONS /api/auth HTTP/1.1\r\n> Host: ocapi-app.arlo.com\r\n> Connection: keep-alive\r\n> Accept-Encoding: gzip, deflate\r\n> Accept: */*\r\n> User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)\r\n> Content-length: 0\r\n> \r\n< HTTP/1.1 204 No Content\r\n```", "Will see if I can try and find similarities/switch to python2.7 and see if that makes any difference when I debug this further, probably this weekend", "Any luck?", "Cant tell if an immediate switch to python2.7 does anything -- cant test with httpx since that requires 3.6. But running on 2.7 I get the same error as on 3.9.4\r\n\r\nModified the script to work on both versions:\r\n\r\n```python\r\n#!/usr/bin/env python3\r\n\r\nfrom __future__ import print_function\r\nimport sys\r\n\r\nimport requests\r\n\r\nif sys.version_info.major == 3:\r\n import httpx\r\n\r\n\r\ndef extract_status(obj):\r\n if hasattr(obj, \"status\"):\r\n return obj.status\r\n if hasattr(obj, \"status_code\"):\r\n return obj.status_code\r\n raise TypeError(\"unsupported request object\")\r\n\r\n\r\ndef make_request(using_verb, url, headers):\r\n\r\n resp = using_verb(url, headers=headers)\r\n status = extract_status(resp)\r\n\r\n print(str(resp.json()))\r\n\r\n if status == 200:\r\n print(\"succeeded\")\r\n else:\r\n print(\"failed\")\r\n resp.raise_for_status()\r\n\r\n\r\ndef main():\r\n # see https://github.com/seanbreckenridge/pygithub_requests_error for token scopes\r\n\r\n auth_token = \"token here\"\r\n\r\n headers = {\r\n \"Authorization\": \"token {}\".format(auth_token),\r\n \"User-Agent\": \"requests_error\",\r\n \"Accept\": \"application/vnd.github.v3+json\",\r\n }\r\n\r\n # replace this with a URL you have access to\r\n\r\n\r\n url = \"https://api.github.com/repos/seanbreckenridge/albums/traffic/clones\"\r\n\r\n if sys.version_info.major == 3:\r\n make_request(httpx.get, url, headers)\r\n make_request(requests.get, url, headers)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n\r\nOn 2.7, installed using the [AUR requests package](https://archlinux.org/packages/extra/any/python2-requests/):\r\n\r\n```\r\npython2.7 -m requests.help\r\n{\r\n \"chardet\": {\r\n \"version\": \"4.0.0\"\r\n },\r\n \"cryptography\": {\r\n \"version\": \"\"\r\n },\r\n \"idna\": {\r\n \"version\": \"2.10\"\r\n },\r\n \"implementation\": {\r\n \"name\": \"CPython\",\r\n \"version\": \"2.7.18\"\r\n },\r\n \"platform\": {\r\n \"release\": \"5.12.1-arch1-1\",\r\n \"system\": \"Linux\"\r\n },\r\n \"pyOpenSSL\": {\r\n \"openssl_version\": \"\",\r\n \"version\": null\r\n },\r\n \"requests\": {\r\n \"version\": \"2.25.1\"\r\n },\r\n \"system_ssl\": {\r\n \"version\": \"101010bf\"\r\n },\r\n \"urllib3\": {\r\n \"version\": \"1.26.4\"\r\n },\r\n \"using_pyopenssl\": false\r\n}\r\n```\r\n\r\n```\r\n$ python2.7 main.py\r\n{u'documentation_url': u'https://docs.github.com/rest/reference/repos#get-repository-clones', u'message': u'Must have push access to repository'}\r\nfailed\r\nTraceback (most recent call last):\r\n File \"main.py\", line 56, in <module>\r\n main()\r\n File \"main.py\", line 52, in main\r\n make_request(requests.get, url, headers)\r\n File \"main.py\", line 31, in make_request\r\n resp.raise_for_status()\r\n File \"/usr/lib/python2.7/site-packages/requests/models.py\", line 943, in raise_for_status\r\n raise HTTPError(http_error_msg, response=self)\r\nrequests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/seanbreckenridge/albums/traffic/clones\r\n```\r\n\r\nOn 3.9:\r\n\r\n```\r\n$ python3 main.py\r\n{'count': 2, 'uniques': 2, 'clones': [{'timestamp': '2021-05-06T00:00:00Z', 'count': 1, 'uniques': 1}, {'timestamp': '2021-05-07T00:00:00Z', 'count': 1, 'uniques': 1}]}\r\nsucceeded\r\n{'message': 'Must have push access to repository', 'documentation_url': 'https://docs.github.com/rest/reference/repos#get-repository-clones'}\r\nfailed\r\nTraceback (most recent call last):\r\n File \"/home/sean/Repos/requests_test/main.py\", line 56, in <module>\r\n main()\r\n File \"/home/sean/Repos/requests_test/main.py\", line 52, in main\r\n make_request(requests.get, url, headers)\r\n File \"/home/sean/Repos/requests_test/main.py\", line 31, in make_request\r\n resp.raise_for_status()\r\n File \"/usr/lib/python3.9/site-packages/requests/models.py\", line 943, in raise_for_status\r\n raise HTTPError(http_error_msg, response=self)\r\nrequests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/seanbreckenridge/albums/traffic/clones\r\n```\r\n\r\nSo I'd guess your error is something different?\r\n\r\nWill try and inspect the request info to see if theres anything different there...", "@seanbreckenridge try downgrading your urllib to 1.24. I was able to work around my 403 issue using Python 3.x that way.", "```\r\n[[source]]\r\nurl = \"https://pypi.org/simple\"\r\nverify_ssl = true\r\nname = \"pypi\"\r\n\r\n[packages]\r\nhttpx = \"*\"\r\nrequests = \"*\"\r\nurllib3 = \"==1.24\"\r\n\r\n[dev-packages]\r\n\r\n[requires]\r\npython_version = \"3.9\"\r\n```\r\n\r\n```\r\nhttpx==0.18.1\r\n - certifi [required: Any, installed: 2021.5.30]\r\n - httpcore [required: >=0.13.0,<0.14.0, installed: 0.13.3]\r\n - h11 [required: >=0.11,<0.13, installed: 0.12.0]\r\n - sniffio [required: ==1.*, installed: 1.2.0]\r\n - rfc3986 [required: >=1.3,<2, installed: 1.5.0]\r\n - sniffio [required: Any, installed: 1.2.0]\r\nrequests==2.25.1\r\n - certifi [required: >=2017.4.17, installed: 2021.5.30]\r\n - chardet [required: >=3.0.2,<5, installed: 4.0.0]\r\n - idna [required: >=2.5,<3, installed: 2.10]\r\n - urllib3 [required: >=1.21.1,<1.27, installed: 1.24]\r\n```\r\n\r\nCreated a pipenv with 1.24; ran the same script above, doesn't seem to fix my issue. So the issues we had were probably separate\r\n\r\n```\r\n$ pipenv run python3 main.py\r\n{'count': 12, 'uniques': 12, 'clones': [{'timestamp': '2021-05-21T00:00:00Z', 'count': 7, 'uniques': 7}, {'timestamp': '2021-05-23T00:00:00Z', 'count': 1, 'uniques': 1}, {'timestamp': '2021-05-30T00:00:00Z', 'count': 1, 'uniques': 1}, {'timestamp': '2021-06-01T00:00:00Z', 'count': 1, 'uniques': 1}, {'timestamp': '2021-06-02T00:00:00Z', 'count': 2, 'uniques': 2}]}\r\nsucceeded\r\n{'message': 'Must have push access to repository', 'documentation_url': 'https://docs.github.com/rest/reference/repos#get-repository-clones'}\r\nfailed\r\nTraceback (most recent call last):\r\n File \"/home/sean/Repos/requests_test/main.py\", line 56, in <module>\r\n main()\r\n File \"/home/sean/Repos/requests_test/main.py\", line 52, in main\r\n make_request(requests.get, url, headers)\r\n File \"/home/sean/Repos/requests_test/main.py\", line 31, in make_request\r\n resp.raise_for_status()\r\n File \"/home/sean/.local/share/virtualenvs/requests_test-YPmFob8P-python/lib/python3.9/site-packages/requests/models.py\", line 943, in raise_for_status\r\n raise HTTPError(http_error_msg, response=self)\r\nrequests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/seanbreckenridge/albums/traffic/clones\r\n```", "I had the same issue in the gpodder app which uses requests, in this case a podcast CDN was issuing 403 for some HTTP requests, which are normally CDN redirects. I am not sure why, but as a workaround I found that using the underlying PreparedRequest object and session send() it works. \r\n\r\nI'm on version: 2.24.0-lp152.3.3.1\r\n\r\nTo reproduce (at least for a week or two while this podcast URL is valid):\r\n\r\n```\r\nPython 3.6.12 (default, Dec 02 2020, 09:44:23) [GCC] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import requests\r\n>>> url = 'https://open.live.bbc.co.uk/mediaselector/6/redir/version/2.0/mediaset/audio-nondrm-download-low/proto/http/vpid/p09s18sm.mp3'\r\n>>> s = requests.Session()\r\n>>> r = s.get(url)\r\n>>> r\r\n<Response [403]>\r\n>>> r.request.headers\r\n{'User-Agent': 'python-requests/2.24.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Authorization': 'Basic YW5vbnltb3VzOmRlYXZlbkBkZWF2ZW4ubmV0'}\r\n\r\n>>> req = requests.Request('GET', url)\r\n>>> prep_req = req.prepare()\r\n>>> resp = s.send(prep_req)\r\n>>> resp\r\n<Response [200]>\r\n>>> resp.request.headers\r\n{'Authorization': 'Basic YW5vbnltb3VzOmRlYXZlbkBkZWF2ZW4ubmV0'}\r\n>>> s.headers\r\n{'User-Agent': 'python-requests/2.24.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}\r\n\r\n```\r\n", "```\r\nPython 3.6.12 (default, Dec 24 2020, 11:04:11)\r\n[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import requests\r\n>>> url = 'https://open.live.bbc.co.uk/mediaselector/6/redir/version/2.0/mediaset/audio-nondrm-download-low/proto/http/vpid/p09s18sm.mp3'\r\n>>> s = requests.Session()\r\n>>> r = s.get(url)\r\n>>> r\r\n<Response [200]>\r\n>>> r.request.headers\r\n{'User-Agent': 'python-requests/2.26.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}\r\n>>> s.headers\r\n{'User-Agent': 'python-requests/2.26.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}\r\n>>> req = requests.Request('GET', url)\r\n>>> prep_req = req.prepare()\r\n>>> resp = s.send(prep_req)\r\n>>> resp\r\n<Response [200]>\r\n>>> resp.request.headers\r\n{}\r\n>>> s.headers\r\n{'User-Agent': 'python-requests/2.26.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}\r\n>>>\r\n```\r\n\r\nOnce again, this is not reproducible for me.\r\n\r\n@davedeaven you did make me wonder though, what happens if you do `s.trust_env = False` first? Also do you have a `.netrc` that's supplying your authorization headers here or did you leave out code? Finally, when you see the 403, what does `r.history` show you?", "@sigmavirus24, I tried the s.trust_env, it works.\r\n\r\n```\r\n>>> import requests\r\n>>> url = 'https://open.live.bbc.co.uk/mediaselector/6/redir/version/2.0/mediaset/audio-nondrm-download-low/proto/http/vpid/p09s18sm.mp3'\r\n>>> s = requests.Session()\r\n>>> s.trust_env = False\r\n>>> r = s.get(url)\r\n>>> r\r\n<Response [200]>\r\n>>> r.history\r\n[<Response [302]>, <Response [302]>]\r\n>>> s.trust_env = True\r\n>>> r = s.get(url)\r\n>>> r\r\n<Response [403]>\r\n>>> r.history\r\n[]\r\n```\r\n\r\nAnd you are correct, I do have a ~/.netrc of the form\r\n`default login anonymous password [email protected]`\r\nIf I remove this, then the request is successful even without the s.trust_env setting. So _that_ is the cause... this solves my issue because I do not need the ~/.netrc file, it was left over from an earlier era. Although it does seem to be somewhat unexpected behavior that the prepared request works differently, and I will note that in the same environment, tools like wget (and browsers) work fine to retrieve this URL\r\n\r\nReally appreciate the fast response on this, thank you!", "Seems to be the same issue I had - I also had a `.netrc` file which had information to login to github like\r\n\r\n```\r\nmachine api.github.com\r\n login seanbreckenridge\r\n password something_here\r\n```\r\n\r\nRemoving that file or setting the `trust_env` fixes my issue", "Yeah, I'll be completely transparent, I hate that we use as much of the environment as we do (`.netrc`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE`, etc.)" ]
https://api.github.com/repos/psf/requests/issues/5800
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5800/labels{/name}
https://api.github.com/repos/psf/requests/issues/5800/comments
https://api.github.com/repos/psf/requests/issues/5800/events
https://github.com/psf/requests/pull/5800
867,099,261
MDExOlB1bGxSZXF1ZXN0NjIyODI5MzM3
5,800
Custom HTTP adapters via Session constructor
{ "avatar_url": "https://avatars.githubusercontent.com/u/2834892?v=4", "events_url": "https://api.github.com/users/rupertcw/events{/privacy}", "followers_url": "https://api.github.com/users/rupertcw/followers", "following_url": "https://api.github.com/users/rupertcw/following{/other_user}", "gists_url": "https://api.github.com/users/rupertcw/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/rupertcw", "id": 2834892, "login": "rupertcw", "node_id": "MDQ6VXNlcjI4MzQ4OTI=", "organizations_url": "https://api.github.com/users/rupertcw/orgs", "received_events_url": "https://api.github.com/users/rupertcw/received_events", "repos_url": "https://api.github.com/users/rupertcw/repos", "site_admin": false, "starred_url": "https://api.github.com/users/rupertcw/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/rupertcw/subscriptions", "type": "User", "url": "https://api.github.com/users/rupertcw", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2021-04-25T19:54:52Z
2021-08-27T00:08:42Z
2021-04-26T11:10:46Z
NONE
resolved
I often find myself having to do the following when using `Session` with custom retrying logic: ``` retry = Retry(3, backoff_factor=1.) http_adapter = requests.adapters.HTTPAdapter(pool_connections=4, max_retries=retry) session = requests.Session() session.mount('https://', http_adapter) session.mount('http://', http_adapter) ``` Having to mount the adapter myself for such a simple use-case seems superfluous, error-prone and not very user-friendly so I'm suggesting we open up the Session constructor a little bit: ``` retry = Retry(3, backoff_factor=1.) http_adapter = requests.adapters.HTTPAdapter(pool_connections=4, max_retries=retry) session = requests.Session(http_adapter=http_adapter) ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/240830?v=4", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "followers_url": "https://api.github.com/users/sigmavirus24/followers", "following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sigmavirus24", "id": 240830, "login": "sigmavirus24", "node_id": "MDQ6VXNlcjI0MDgzMA==", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "type": "User", "url": "https://api.github.com/users/sigmavirus24", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5800/reactions" }
https://api.github.com/repos/psf/requests/issues/5800/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5800.diff", "html_url": "https://github.com/psf/requests/pull/5800", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5800.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5800" }
true
[ "This project is under a feature-freeze which means we're not accepting any changes to the API at this time.\r\n\r\nThanks for submitting this but we will not be accepting it" ]
https://api.github.com/repos/psf/requests/issues/5799
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/5799/labels{/name}
https://api.github.com/repos/psf/requests/issues/5799/comments
https://api.github.com/repos/psf/requests/issues/5799/events
https://github.com/psf/requests/pull/5799
866,900,674
MDExOlB1bGxSZXF1ZXN0NjIyNjg3MTU2
5,799
Add PATCH example to the Quickstart of documentation
{ "avatar_url": "https://avatars.githubusercontent.com/u/9413601?v=4", "events_url": "https://api.github.com/users/jeffreytse/events{/privacy}", "followers_url": "https://api.github.com/users/jeffreytse/followers", "following_url": "https://api.github.com/users/jeffreytse/following{/other_user}", "gists_url": "https://api.github.com/users/jeffreytse/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jeffreytse", "id": 9413601, "login": "jeffreytse", "node_id": "MDQ6VXNlcjk0MTM2MDE=", "organizations_url": "https://api.github.com/users/jeffreytse/orgs", "received_events_url": "https://api.github.com/users/jeffreytse/received_events", "repos_url": "https://api.github.com/users/jeffreytse/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jeffreytse/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jeffreytse/subscriptions", "type": "User", "url": "https://api.github.com/users/jeffreytse", "user_view_type": "public" }
[]
closed
true
null
[]
null
5
2021-04-25T03:32:04Z
2021-08-27T00:08:42Z
2021-04-30T02:48:50Z
NONE
resolved
This PR mades users understand that the library supports the patch method and the simple use of it quickly.
{ "avatar_url": "https://avatars.githubusercontent.com/u/18519037?v=4", "events_url": "https://api.github.com/users/sethmlarson/events{/privacy}", "followers_url": "https://api.github.com/users/sethmlarson/followers", "following_url": "https://api.github.com/users/sethmlarson/following{/other_user}", "gists_url": "https://api.github.com/users/sethmlarson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sethmlarson", "id": 18519037, "login": "sethmlarson", "node_id": "MDQ6VXNlcjE4NTE5MDM3", "organizations_url": "https://api.github.com/users/sethmlarson/orgs", "received_events_url": "https://api.github.com/users/sethmlarson/received_events", "repos_url": "https://api.github.com/users/sethmlarson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sethmlarson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sethmlarson/subscriptions", "type": "User", "url": "https://api.github.com/users/sethmlarson", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 0, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 0, "url": "https://api.github.com/repos/psf/requests/issues/5799/reactions" }
https://api.github.com/repos/psf/requests/issues/5799/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/5799.diff", "html_url": "https://github.com/psf/requests/pull/5799", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/5799.patch", "url": "https://api.github.com/repos/psf/requests/pulls/5799" }
true
[ "Hi @nateprewitt, this simple change will mean a whole lot for many new users to quickly use this library. I hope you have a good day! Thanks and regards. : D", "We aren't accepting small changes to the README.", "Hi @sethmlarson, it's not the README, it's the document, so I need to open another PR just for the document change?", "Either way, we're not accepting small changes to any documentation, we don't have the reviewer time to review and merge them all.", "But this very samll change on the quicklystart page makes the document completed and greatly improve people's time. Thanks and regards.\r\n![image](https://user-images.githubusercontent.com/9413601/116642940-82409a00-a9a2-11eb-8f97-14eb8c41e6e1.png)\r\n" ]