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/3529
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3529/labels{/name}
https://api.github.com/repos/psf/requests/issues/3529/comments
https://api.github.com/repos/psf/requests/issues/3529/events
https://github.com/psf/requests/issues/3529
172,528,973
MDU6SXNzdWUxNzI1Mjg5NzM=
3,529
Timeout After 301 Redirect Works Strangely
{ "avatar_url": "https://avatars.githubusercontent.com/u/1082756?v=4", "events_url": "https://api.github.com/users/haydenth/events{/privacy}", "followers_url": "https://api.github.com/users/haydenth/followers", "following_url": "https://api.github.com/users/haydenth/following{/other_user}", "gists_url": "https://api.github.com/users/haydenth/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/haydenth", "id": 1082756, "login": "haydenth", "node_id": "MDQ6VXNlcjEwODI3NTY=", "organizations_url": "https://api.github.com/users/haydenth/orgs", "received_events_url": "https://api.github.com/users/haydenth/received_events", "repos_url": "https://api.github.com/users/haydenth/repos", "site_admin": false, "starred_url": "https://api.github.com/users/haydenth/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/haydenth/subscriptions", "type": "User", "url": "https://api.github.com/users/haydenth", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-22T19:03:29Z
2021-09-08T16:00:27Z
2016-08-22T22:15:47Z
NONE
resolved
Hello friends! Having a small issue with timeouts from URLs after they throw us an HTTP 301 to a bad address. Here's an example script and what happens when I run it (hopefully the offending URL remains offending for you to test, I do not own the domain) ``` import requests import logging logging.basicConfig(level=logging.INFO) url = 'https://blog.uplabs.com/feed' req = requests.get(url, timeout=1) ``` Then I run this: ``` Thomass-MacBook-Air ~/bug $ time python test.py INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): blog.uplabs.com INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): blog.uplabs.com Traceback (most recent call last): File "test.py", line 7, in <module> req = requests.get(url, timeout=1) File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 70, in get return request('get', url, params=params, **kwargs) File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 56, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 617, in send history = [resp for resp in gen] if allow_redirects else [] File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 177, in resolve_redirects **adapter_kwargs File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 596, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 479, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='blog.uplabs.com', port=3001): Max retries exceeded with url: /feed/ (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.HTTPConnection object at 0x10bcb43d0>, 'Connection to blog.uplabs.com timed out. (connect timeout=1)')) real 0m13.104s user 0m0.149s sys 0m0.098s ``` My question - it does appear to be timing out, but shouldn't it be timing out much quicker? I'm giving a timeout of 1 but it appears to be taking 13 seconds for the entire script to run. It appears the original host is 301ing me to a weird port number but I think the timeout behavior should continue to apply. If I increase timeout to 2 seconds, it takes 24 seconds: ``` real 0m24.626s user 0m0.155s sys 0m0.099s ``` and 3 second timeout takes 36 seconds. So it appears to be compounding? ``` real 0m37.152s user 0m0.156s sys 0m0.108s ``` Is there an additional setting I am missing or case I should deal with? Using requests 2.11 ``` >>> import requests >>> requests.__version__ '2.11.1' ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3529/reactions" }
https://api.github.com/repos/psf/requests/issues/3529/timeline
null
completed
null
null
false
[ "I should add, when I change log level to debug, you can see the 301\n\n```\nINFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): blog.uplabs.com\nDEBUG:requests.packages.urllib3.connectionpool:\"GET /feed HTTP/1.1\" 301 178\nINFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): blog.uplabs.com\n```\n", "So it should be noted that the timeout is _not_ a total timeout, it is instead a _per socket event_ timeout. In particular, as we're attempting to connect, it is a _per connection attempt_ timeout. The reason I phrase it this way is that, when we attempt to connect to a host, we will perform the DNS look up and then attempt to connect to _every_ host returned. Only if all of those fail will we report failure as a `ConnectionError`. I suspect that's what is happening in this case.\n", "OK, Thanks @Lukasa - in my case, I ended up using eventlet module to wrap the entire thing in a more \"global\" timeout.\n" ]
https://api.github.com/repos/psf/requests/issues/3528
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3528/labels{/name}
https://api.github.com/repos/psf/requests/issues/3528/comments
https://api.github.com/repos/psf/requests/issues/3528/events
https://github.com/psf/requests/issues/3528
172,512,777
MDU6SXNzdWUxNzI1MTI3Nzc=
3,528
Stuck on request when changing proxy while inside a session
{ "avatar_url": "https://avatars.githubusercontent.com/u/14364371?v=4", "events_url": "https://api.github.com/users/Metasploitable/events{/privacy}", "followers_url": "https://api.github.com/users/Metasploitable/followers", "following_url": "https://api.github.com/users/Metasploitable/following{/other_user}", "gists_url": "https://api.github.com/users/Metasploitable/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Metasploitable", "id": 14364371, "login": "Metasploitable", "node_id": "MDQ6VXNlcjE0MzY0Mzcx", "organizations_url": "https://api.github.com/users/Metasploitable/orgs", "received_events_url": "https://api.github.com/users/Metasploitable/received_events", "repos_url": "https://api.github.com/users/Metasploitable/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Metasploitable/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Metasploitable/subscriptions", "type": "User", "url": "https://api.github.com/users/Metasploitable", "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" }, { "color": "fef2c0", "default": false, "description": null, "id": 298537994, "name": "Needs More Information", "node_id": "MDU6TGFiZWwyOTg1Mzc5OTQ=", "url": "https://api.github.com/repos/psf/requests/labels/Needs%20More%20Information" } ]
closed
true
null
[]
null
7
2016-08-22T17:47:40Z
2021-09-08T08:00:29Z
2017-07-30T00:15:08Z
NONE
resolved
Hi, I've been tinkering with the following issue for the last couple of days and boy it was frustrating.. The issue is not being able to sent requests after you've changed your external IP adress while inside a sesison. It took me a while to figure this out. Like I said the problem only excist if you're inside a session for some reason the requests are just stuck, for ever. I tested the same thing without a session and that works just fine.
{ "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/3528/reactions" }
https://api.github.com/repos/psf/requests/issues/3528/timeline
null
completed
null
null
false
[ "When you say \"changed your external IP address\", what exactly do you mean?\n", "Hi,\n\nI've written a script which I use on my Raspberry Pi plugged with 3G modem. So I use the 3G modem to connect and make requests. I've also written a script that changes the external IP adress of the modem. It's like a proxy server basically.\n", "I'm still not entirely following. What does changing the IP address look like to your OS?\n", "Hey, I have been having the same issue.\nI stripped my code down till the bare minimum needed to reproduce this issue consistently.\n\n_test1.py_ reproduces the issue, as it will hang forever on the second request, and it will eventually timeout when we set a timeout.\n\n_test2.py_ ommits the session object and makes a regular request in the same fashion, however does not 'hang' and executes like expected.\n\n---\n\nSee here _test1.py_:\n\n```\nimport requests\nimport time\n\n\n# Create session object.\ns = requests.session()\n\n\n# Simple request using the session object.\ns.post('http://httpbin.org') # <= Makes request without issue. (!!)\n\n\n# Fetch verification token for the 3G modem\ntoken = requests.get('http://192.168.8.1/api/' + 'webserver/token').content\ntoken = lxml.html.fromstring(token).xpath('//token/text()')[0]\n\n# Change 3G session variable by logging in\nrequests.post('http://192.168.8.1/api/' + 'user/login',\n headers={'__RequestVerificationToken': token},\n data= '<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><Username>admin</Username><Password>YWRtaW4=</Password></request>'\n)\n\n# Disconnect from 3G network\nrequests.post('http://192.168.8.1/api/' + 'dialup/mobile-dataswitch',\n headers={'__RequestVerificationToken': token},\n data= '<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><dataswitch>0</dataswitch></request>'\n)\n\n# Connect to 3G network, with a new IP (hopefully)\nrequests.post('http://192.168.8.1/api/' + 'dialup/mobile-dataswitch',\n headers={'__RequestVerificationToken': token},\n data= '<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><dataswitch>1</dataswitch></request>'\n)\n\n# A small delay to make sure we are connected.\ntime.sleep(15)\n\n\n# Simple request using the session object.\ns.post('http://httpbin.org') # <= Hangs forever. (!!)\n```\n\nSee here _test2.py_:\n\n```\nimport requests\nimport time\n\n\n# Create session object.\ns = requests.session()\n\n\n# Simple request WITHOUT using the session object.\nrequests.post('http://httpbin.org') # <= Makes request without issue. (!!)\n\n\n# Fetch verification token for the 3G modem\ntoken = requests.get('http://192.168.8.1/api/' + 'webserver/token').content\ntoken = lxml.html.fromstring(token).xpath('//token/text()')[0]\n\n# Change 3G session variable by logging in\nrequests.post('http://192.168.8.1/api/' + 'user/login',\n headers={'__RequestVerificationToken': token},\n data= '<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><Username>admin</Username><Password>YWRtaW4=</Password></request>'\n)\n\n# Disconnect from 3G network\nrequests.post('http://192.168.8.1/api/' + 'dialup/mobile-dataswitch',\n headers={'__RequestVerificationToken': token},\n data= '<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><dataswitch>0</dataswitch></request>'\n)\n\n# Connect to 3G network, with a new IP (hopefully)\nrequests.post('http://192.168.8.1/api/' + 'dialup/mobile-dataswitch',\n headers={'__RequestVerificationToken': token},\n data= '<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><dataswitch>1</dataswitch></request>'\n)\n\n# A small delay to make sure we are connected.\ntime.sleep(15)\n\n\n# Simple request WITHOUT using the session object.\nrequests.post('http://httpbin.org') # <= Makes request without issue. (!!)\n```\n\nRunning without passing a timeout argument to the call there does not seem to be an error / traceback, all it does is 'hang', again passing a timeout argument in the call makes the request timeout and provides a timeout error.\n", "It should be clarified we are using python 3.5 on the Raspbian OS.\n", "Let's be clear. A `Session` object uses connection pooling; that is, it keeps hold of connections if possible to increase efficiency. That includes `socket` objects, which otherwise cause us to need to make syscalls to recreate them. \n\nIf you change your source IP, I wouldn't be at all surprised to find that those sockets no longer behave as expected. You'd need to invalidate them by closing the Session and using a new one, or at least clearing the pools. \n", "Thanks for the details, didn't know that. Seeing as a similar setup worked in the past like expected I am assuming it has to do with the logic of the code rather than the module itself.\n\nI'll keep investigating!\n" ]
https://api.github.com/repos/psf/requests/issues/3527
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3527/labels{/name}
https://api.github.com/repos/psf/requests/issues/3527/comments
https://api.github.com/repos/psf/requests/issues/3527/events
https://github.com/psf/requests/pull/3527
172,341,964
MDExOlB1bGxSZXF1ZXN0ODIxMTc0NTc=
3,527
3518 Bug Fix and Response Header to Python equivalents
{ "avatar_url": "https://avatars.githubusercontent.com/u/12104977?v=4", "events_url": "https://api.github.com/users/michelsch/events{/privacy}", "followers_url": "https://api.github.com/users/michelsch/followers", "following_url": "https://api.github.com/users/michelsch/following{/other_user}", "gists_url": "https://api.github.com/users/michelsch/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/michelsch", "id": 12104977, "login": "michelsch", "node_id": "MDQ6VXNlcjEyMTA0OTc3", "organizations_url": "https://api.github.com/users/michelsch/orgs", "received_events_url": "https://api.github.com/users/michelsch/received_events", "repos_url": "https://api.github.com/users/michelsch/repos", "site_admin": false, "starred_url": "https://api.github.com/users/michelsch/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/michelsch/subscriptions", "type": "User", "url": "https://api.github.com/users/michelsch", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-21T21:16:57Z
2021-09-08T03:00:46Z
2016-08-21T22:21:13Z
NONE
resolved
I'm fairly new to open source contributions, so any feedback is appreciated. This PR 1) Addresses issue #3518 by iterating over ALL_PROXY last. 2) Elaborates some of the most commonly used response headers into their corresponding Python equivalents for convenience, namely r.date() and r.last_modified() return datetime objects and r.content_length() and r.age() return ints when possible, None otherwise 3) Added corresponding tests for the above
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3527/reactions" }
https://api.github.com/repos/psf/requests/issues/3527/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3527.diff", "html_url": "https://github.com/psf/requests/pull/3527", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3527.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3527" }
true
[ "Thanks for this @michelsch92!\n\nSome notes. Firstly, I'm afraid to say that #3518 was already resolved by #3527. I'm sorry about that, the timing was just a bit unlucky.\n\nSecondly, the response helpers, I think we don't want to put them into the core requests library itself. Generally speaking we try to keep the surface area of the API down, because the more methods and properties that there are on the object the harder it gets to understand. However, @sigmavirus24 may be interested in having those properties in a headers helper object in the requests-toolbelt.\n\nUnfortunately, that means this patch won't be accepted at this time. This has nothing to do with the quality of your work: altogether it was high quality work, and we'd have been pleased to accept it. Please do keep looking around for ways to contribute, because you're most welcome here!\n" ]
https://api.github.com/repos/psf/requests/issues/3526
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3526/labels{/name}
https://api.github.com/repos/psf/requests/issues/3526/comments
https://api.github.com/repos/psf/requests/issues/3526/events
https://github.com/psf/requests/pull/3526
172,329,895
MDExOlB1bGxSZXF1ZXN0ODIxMTA1NzA=
3,526
Fixed bug to give scheme proxy priority over "all"
{ "avatar_url": "https://avatars.githubusercontent.com/u/1097666?v=4", "events_url": "https://api.github.com/users/sentientcucumber/events{/privacy}", "followers_url": "https://api.github.com/users/sentientcucumber/followers", "following_url": "https://api.github.com/users/sentientcucumber/following{/other_user}", "gists_url": "https://api.github.com/users/sentientcucumber/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/sentientcucumber", "id": 1097666, "login": "sentientcucumber", "node_id": "MDQ6VXNlcjEwOTc2NjY=", "organizations_url": "https://api.github.com/users/sentientcucumber/orgs", "received_events_url": "https://api.github.com/users/sentientcucumber/received_events", "repos_url": "https://api.github.com/users/sentientcucumber/repos", "site_admin": false, "starred_url": "https://api.github.com/users/sentientcucumber/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/sentientcucumber/subscriptions", "type": "User", "url": "https://api.github.com/users/sentientcucumber", "user_view_type": "public" }
[]
closed
true
null
[]
null
6
2016-08-21T16:59:04Z
2021-09-08T03:00:46Z
2016-08-21T22:17:31Z
NONE
resolved
Addresses bug called out in issue #3518.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3526/reactions" }
https://api.github.com/repos/psf/requests/issues/3526/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3526.diff", "html_url": "https://github.com/psf/requests/pull/3526", "merged_at": "2016-08-21T22:17:31Z", "patch_url": "https://github.com/psf/requests/pull/3526.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3526" }
true
[ "This seems reasonable to me. @Lukasa thoughts?\n", "This looks really good to me, I'm totally happy with it! Thanks so much @shellhead! :sparkles: :cake: :sparkles:\n", "Shouldn't this line also be swapped to close out this issue? https://github.com/kennethreitz/requests/blob/master/requests/sessions.py#L229\n", "Yup, looks like!\n", "Thanks for pointing this out.\n\nI'm also thinking I missed this as well https://github.com/kennethreitz/requests/blob/master/requests/utils.py#L620\n\nIs there any reason to not use `select_proxy` in sessions? It seems strange to have two different ways of selecting the proxy.\n", "`select_proxy` does something subtly different. In this case in the session we are trying to recompute the proxies from the environment, but otherwise not to do anything.\n" ]
https://api.github.com/repos/psf/requests/issues/3525
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3525/labels{/name}
https://api.github.com/repos/psf/requests/issues/3525/comments
https://api.github.com/repos/psf/requests/issues/3525/events
https://github.com/psf/requests/issues/3525
172,265,800
MDU6SXNzdWUxNzIyNjU4MDA=
3,525
Can I change the default headers?
{ "avatar_url": "https://avatars.githubusercontent.com/u/553215?v=4", "events_url": "https://api.github.com/users/KiritoStudio/events{/privacy}", "followers_url": "https://api.github.com/users/KiritoStudio/followers", "following_url": "https://api.github.com/users/KiritoStudio/following{/other_user}", "gists_url": "https://api.github.com/users/KiritoStudio/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/KiritoStudio", "id": 553215, "login": "KiritoStudio", "node_id": "MDQ6VXNlcjU1MzIxNQ==", "organizations_url": "https://api.github.com/users/KiritoStudio/orgs", "received_events_url": "https://api.github.com/users/KiritoStudio/received_events", "repos_url": "https://api.github.com/users/KiritoStudio/repos", "site_admin": false, "starred_url": "https://api.github.com/users/KiritoStudio/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/KiritoStudio/subscriptions", "type": "User", "url": "https://api.github.com/users/KiritoStudio", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-20T10:58:33Z
2021-09-08T16:00:27Z
2016-08-20T11:07:33Z
NONE
resolved
I want to remove the user-agent from my request, but I can't find a way after I check the requests source code. Need help!
{ "avatar_url": "https://avatars.githubusercontent.com/u/553215?v=4", "events_url": "https://api.github.com/users/KiritoStudio/events{/privacy}", "followers_url": "https://api.github.com/users/KiritoStudio/followers", "following_url": "https://api.github.com/users/KiritoStudio/following{/other_user}", "gists_url": "https://api.github.com/users/KiritoStudio/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/KiritoStudio", "id": 553215, "login": "KiritoStudio", "node_id": "MDQ6VXNlcjU1MzIxNQ==", "organizations_url": "https://api.github.com/users/KiritoStudio/orgs", "received_events_url": "https://api.github.com/users/KiritoStudio/received_events", "repos_url": "https://api.github.com/users/KiritoStudio/repos", "site_admin": false, "starred_url": "https://api.github.com/users/KiritoStudio/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/KiritoStudio/subscriptions", "type": "User", "url": "https://api.github.com/users/KiritoStudio", "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/3525/reactions" }
https://api.github.com/repos/psf/requests/issues/3525/timeline
null
completed
null
null
false
[ "```\ns = Session()\ns.headers.pop('User-Agent')\n```\n\nAbove code would help.\n" ]
https://api.github.com/repos/psf/requests/issues/3524
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3524/labels{/name}
https://api.github.com/repos/psf/requests/issues/3524/comments
https://api.github.com/repos/psf/requests/issues/3524/events
https://github.com/psf/requests/issues/3524
171,966,791
MDU6SXNzdWUxNzE5NjY3OTE=
3,524
2.11.1: Using OrderedDict to order headers on session doesn't allow new headers to be added during later request:s
{ "avatar_url": "https://avatars.githubusercontent.com/u/10137?v=4", "events_url": "https://api.github.com/users/ghost/events{/privacy}", "followers_url": "https://api.github.com/users/ghost/followers", "following_url": "https://api.github.com/users/ghost/following{/other_user}", "gists_url": "https://api.github.com/users/ghost/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ghost", "id": 10137, "login": "ghost", "node_id": "MDQ6VXNlcjEwMTM3", "organizations_url": "https://api.github.com/users/ghost/orgs", "received_events_url": "https://api.github.com/users/ghost/received_events", "repos_url": "https://api.github.com/users/ghost/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ghost/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ghost/subscriptions", "type": "User", "url": "https://api.github.com/users/ghost", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-18T18:19:46Z
2021-09-08T16:00:24Z
2016-08-27T11:40:52Z
NONE
resolved
For kicks I decided to order my headers. According to the directions http://docs.python-requests.org/en/master/user/advanced/ here I just constructed a OrderedDict and set the session.headers value to it. Now when I use the session for requests e.g. session.get("site", headers={"Referer": "test"}) and try to add a new header is doesn't take. Only if the header value already exists can it be overriden. According to the documentation it should be merged.
{ "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/3524/reactions" }
https://api.github.com/repos/psf/requests/issues/3524/timeline
null
completed
null
null
false
[ "I can't reproduce this. Can you please provide some sample code? Here is mine:\n\n``` python\n>>> import requests\n>>> requests.__version__\n'2.11.0'\n>>> import collections\n>>> s = requests.Session()\n>>> s.headers = collections.OrderedDict()\n>>> s.headers['X-Custom-Whatever'] = 'val'\n>>> r = s.get('http://http2bin.org/get', headers={'Custom-Key': 'Custom-Value'})\n>>> print r.text\n{\n \"args\": {}, \n \"headers\": {\n \"Accept-Encoding\": \"identity\", \n \"Connection\": \"keep-alive\", \n \"Custom-Key\": \"Custom-Value\", \n \"Host\": \"http2bin.org\", \n \"Via\": \"1.1 http2bin.org\", \n \"X-Custom-Whatever\": \"val\"\n }, \n \"origin\": \"24.185.108.14\", \n \"url\": \"http://http2bin.org/get\"\n}\n>>> r.request.headers\n{'Custom-Key': 'Custom-Value', 'X-Custom-Whatever': 'val'}\n```\n", "Seems to work for me as well for what it is worth. Python 3.5.2, requests 2.11.1, OSX El Captian 10.11.6\n\n``` python\nPython 3.5.2 (default, Jul 28 2016, 21:28:00)\n[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import requests\n>>> requests.__version__\n'2.11.1'\n>>> import collections\n>>> s = requests.Session()\n>>> s.headers = collections.OrderedDict()\n>>> s.headers['X-Custom-Whatever'] = 'val'\n>>> r = s.get('http://http2bin.org/get', headers= {'Custom-Key':'Custom-Val'})\n>>> print(r.text)\n{\n \"args\": {},\n \"headers\": {\n \"Accept-Encoding\": \"identity\",\n \"Connection\": \"keep-alive\",\n \"Custom-Key\": \"Custom-Val\",\n \"Host\": \"http2bin.org\",\n \"Via\": \"1.1 http2bin.org\",\n \"X-Custom-Whatever\": \"val\"\n },\n \"origin\": \"24.107.123.117\",\n \"url\": \"http://http2bin.org/get\"\n}\n\n>>> r.request.headers\n{'X-Custom-Whatever': 'val', 'Custom-Key': 'Custom-Val'}\n```\n", "Since @phrozetime hasn't responded and we have multiple people unable to reproduce it. I'm closing this until we have more details.\n" ]
https://api.github.com/repos/psf/requests/issues/3523
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3523/labels{/name}
https://api.github.com/repos/psf/requests/issues/3523/comments
https://api.github.com/repos/psf/requests/issues/3523/events
https://github.com/psf/requests/issues/3523
171,936,407
MDU6SXNzdWUxNzE5MzY0MDc=
3,523
2.11.0: ValueError: Unable to determine SOCKS version
{ "avatar_url": "https://avatars.githubusercontent.com/u/6601563?v=4", "events_url": "https://api.github.com/users/ryanym/events{/privacy}", "followers_url": "https://api.github.com/users/ryanym/followers", "following_url": "https://api.github.com/users/ryanym/following{/other_user}", "gists_url": "https://api.github.com/users/ryanym/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ryanym", "id": 6601563, "login": "ryanym", "node_id": "MDQ6VXNlcjY2MDE1NjM=", "organizations_url": "https://api.github.com/users/ryanym/orgs", "received_events_url": "https://api.github.com/users/ryanym/received_events", "repos_url": "https://api.github.com/users/ryanym/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ryanym/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ryanym/subscriptions", "type": "User", "url": "https://api.github.com/users/ryanym", "user_view_type": "public" }
[]
closed
true
null
[]
null
24
2016-08-18T15:54:47Z
2018-02-10T13:07:08Z
2016-11-18T19:12:34Z
NONE
resolved
Hi, I recently upgrade requests to 2.11.0 on centos 7 and keep getting this error when using it in a script: ``` File "/usr/local/lib/python2.7/dist-packages/github3/session.py", line 81, in request response = super(GitHubSession, self).request(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 596, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 390, in send conn = self.get_connection(request.url, proxies) File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 290, in get_connection proxy_manager = self.proxy_manager_for(proxy) File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 184, in proxy_manager_for **proxy_kwargs File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/socks.py", line 154, in __init__ "Unable to determine SOCKS version from %s" % proxy_url ValueError: Unable to determine SOCKS version from socks://http://username:[email protected]:8080/ ``` I tried to change my system socks proxy setting to this format, but still getting the same error with the updated proxy setting... ``` username:[email protected]:8080/ ``` So I downgraded requests to 2.10.0 and everything starts to working again. I repeated the this process on ubuntu 16 and got the same result. Can someone look into this please? Thanks, Ryan
{ "avatar_url": "https://avatars.githubusercontent.com/u/6601563?v=4", "events_url": "https://api.github.com/users/ryanym/events{/privacy}", "followers_url": "https://api.github.com/users/ryanym/followers", "following_url": "https://api.github.com/users/ryanym/following{/other_user}", "gists_url": "https://api.github.com/users/ryanym/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ryanym", "id": 6601563, "login": "ryanym", "node_id": "MDQ6VXNlcjY2MDE1NjM=", "organizations_url": "https://api.github.com/users/ryanym/orgs", "received_events_url": "https://api.github.com/users/ryanym/received_events", "repos_url": "https://api.github.com/users/ryanym/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ryanym/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ryanym/subscriptions", "type": "User", "url": "https://api.github.com/users/ryanym", "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/3523/reactions" }
https://api.github.com/repos/psf/requests/issues/3523/timeline
null
completed
null
null
false
[ "Ryan,\n\nDo you have the ALL_PROXY environment variable set? If so, to what?\n", "@Lukasa ~~No i dont, i will try and let you know~~\nlooks like its been auto set to this:\n\n```\nset | grep -i all_proxy\nall_proxy=socks://http://user:[email protected]:8080/\nALL_PROXY=socks://http://user:[email protected]:8080/\n```\n", "@ryanym, does it work if you set the `all_proxy` scheme to `socks5` or `socks4`? Looking [here](https://github.com/kennethreitz/requests/blob/a2e41ba1f1ae81b2ed224030df908a1432ad435e/requests/packages/urllib3/contrib/socks.py#L153), seems like it's looking for the socks version. Unsure why you're getting different behavior between the two versions, though.\n\nEdit: Did some more digging.\n\nFWIW, it looks like part of the 2.11.0 release was to support all_proxy. So in 2.10.0, it didn't pick up the environment variable, all_proxy, and didn't bother using a proxy. In 2.11.0, it does, which causes the SOCKS version check, and the resulting error. \n\nI was able to get something to work by either setting all_proxy to `socks5://someproxy.com:someport` or sending the `proxies` dictionary (with the `all` key set to the same value as all_proxy environment variable) on the request.\n\nDisclaimer: I'm a total n00b with the code base, just trying to help out. I would defer to @Lukasa for any real, competent help with this issue though :)\n", "@shellhead, thanks for the reply, setting `all_proxy` sheme to `socks5` or `socks4` seems gives me a timeout\n\n```\nFile \"/usr/local/lib/python2.7/dist-packages/github3/github.py\", line 982, in organization\n json = self._json(self._get(url), 200)\n File \"/usr/local/lib/python2.7/dist-packages/github3/models.py\", line 130, in _get\n return self._session.get(url, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/requests/sessions.py\", line 488, in get\n return self.request('GET', url, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/github3/session.py\", line 81, in request\n response = super(GitHubSession, self).request(*args, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/requests/sessions.py\", line 475, in request\n resp = self.send(prep, **send_kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/requests/sessions.py\", line 596, in send\n r = adapter.send(request, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/requests/adapters.py\", line 423, in send\n timeout=timeout\n File \"/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py\", line 595, in urlopen\n chunked=chunked)\n File \"/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py\", line 352, in _make_request\n self._validate_conn(conn)\n File \"/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py\", line 831, in _validate_conn\n conn.connect()\n File \"/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connection.py\", line 254, in connect\n conn = self._new_conn()\n File \"/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/socks.py\", line 81, in _new_conn\n **extra_kw\n File \"/usr/local/lib/python2.7/dist-packages/socks.py\", line 195, in create_connection\n sock.connect((remote_host, remote_port))\n File \"/usr/local/lib/python2.7/dist-packages/socks.py\", line 747, in connect\n negotiate(self, dest_addr, dest_port)\n File \"/usr/local/lib/python2.7/dist-packages/socks.py\", line 598, in _negotiate_SOCKS4\n resp = self._readall(reader, 8)\n File \"/usr/local/lib/python2.7/dist-packages/socks.py\", line 268, in _readall\n d = file.read(count - len(data))\n File \"/usr/lib/python2.7/socket.py\", line 384, in read\n data = self._sock.recv(left)\nKeyboardInterrupt\n```\n", "Out of curiosity, if you use something like `curl` using the socks proxy, do you get back a successful response? I ran the following, was able to see the request hit my socks proxy before forwarding going out.\n\n``` sh\nexport all_proxy=socks5://someproxy:port\ncurl -v http://www.httpbin.org/headers\n```\n\nIs `all_proxy` set to `socks5://http://user:[email protected]:8080/`; the `http://` in the middle seems like it doesn't belong. When I tried something in the same format, I get all sorts of errors.\n", "I don't have the `http://` in the middle\n\n```\nryan@vb:~$ export | grep -i all_proxy\ndeclare -x all_proxy=\"socks5://user:[email protected]:8080/\"\n```\n\nAnd for the curl test is successful as well. I am wondering does it have anything to do with the proxy itself?\n\n```\nryan@vb:~$ curl -vvv http://www.httpbin.org/headers\n* Trying x.x.x.x....\n* Connected to someproxy.com (x.x.x.x) port 8080 (#0)\n* Proxy auth using Basic with user 'user'\n> GET http://www.httpbin.org/headers HTTP/1.1\n> Host: www.httpbin.org\n> Proxy-Authorization: Basic xxxxxxxxxxxxxxxxxxxxxx\n> User-Agent: curl/7.47.0\n> Accept: */*\n> Proxy-Connection: Keep-Alive\n> \n< HTTP/1.1 200 OK\n< Server: nginx\n< Date: Thu, 25 Aug 2016 15:31:37 GMT\n< Content-Type: application/json\n< Content-Length: 189\n< Access-Control-Allow-Origin: *\n< Access-Control-Allow-Credentials: true\n< Proxy-Connection: Keep-Alive\n< Connection: Keep-Alive\n< Age: 0\n< \n{\n \"headers\": {\n \"Accept\": \"*/*\", \n \"Cache-Control\": \"max-stale=0\", \n \"Host\": \"www.httpbin.org\", \n \"User-Agent\": \"curl/7.47.0\", \n \"X-Bluecoat-Via\": \"8e7b0bc063e3ccb8\"\n }\n}\n* Connection #0 to host someproxy.com left intact\n```\n", "Do you have a HTTP_PROXY environment variable around?\n", "@Lukasa yes, i have `HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy` set to `http://user:[email protected]:8080`\n", "Yeah, so the current version of requests prefers ALL_PROXY to HTTP_PROXY. That's a bug fixed in master. \n", "@Lukasa I don't want to use any proxy settings.\nr = requests.post(**\\* , proxies=None) does not work.\n\nIt used to work few days ago. But problem started last night, which is failing my application.\n\nWhat if I don't want to use any of the proxy configurations?\n\nI tried os.environ.pop('http_proxy') and so on for each protocol. It didn't worked.\nHowever, os.envron.pop('all_proxy') worked as it had the url : socks://***.\n\nAny workaround?\n", "Have you tried using `trust_env=False`?\n", "hi\nI am facing the same problem while using openstack keystone client . I have set the all_proxy as mentioned above. but unable to rectify the issue . i need some help .\n", "@Rahul529 Sorry, what specific problem are you encountering?\n", "@Lukasa , i have provided the error while the request is sent from python script .\nValue Error : unable to determine the version SOCKS from socks://<ip>\n", "We require that you provide the SOCKS url as either `socks4://` or `socks5://`\n", "we can set by export all_proxy=\"socks5://<ip>:<port>\"\nafter setting the request goes into the infinite. no response\n", "Wondering if this might be better handled for the \"socks://\" case (as Ubuntu defaults to setting all_proxy to socks://). Currently this just outright fails unless you munge the environment variable (either by unsetting the environment variable, or munging it into socks5://). Wondering if treating socks:// as a SOCKS5 proxy may be a better approach? (I'm unsure if it makes sense to treat it as a SOCKS4 proxy, but I'd like to be corrected if there's a case for it).\r\n\r\nThanks!", "@craigmaloney Well ultimately what's not clear to me is: what do *Ubuntu* mean with a scheme that just says `socks://`? A citation one way or the other would be really handy before we just leap in to make a call.", "Unfortunately I'm not finding any clear-cut answer to that question. However I do know that Google Chrome and Firefox are able to cope with it. I took a quick peek in the Firefox source code to see what they do with it, but I'm not proficient enough in where things are to make heads or tails out of where it pulls the environment variable and determines what proxy version to try.", "Yeah, so I'm absolutely willing to try to bring this into line with what others do, but I'd love to get some concrete citations on exactly what that is before we leap in.", "May be you fill `socks` with `username:[email protected]:8080/` in your network setting but chose `HTTPS` in shadowsocks , just leave `/etc/env` as what it is and leave socks as blank", "I wrote a shell script as a work-around because I got tired of changing things by hand:\r\n\r\n```\r\n#!/bin/bash\r\n\r\nexport all_proxy=socks5://localhost:8080/\r\nexport ALL_PROXY=socks5://localhost:8080/\r\nexport socks_proxy=socks5://localhost:8080\r\n```\r\n\r\nIt's not ideal, but it works.", "It do work for some problems, but not for all, you still can not install some component.\r\nI think it's a malfunction of proxy configuration.", "I did a `sudo aptitude safe-upgrade` on Trisquel (to get something else working, which resolved that issue) and now I am encountering this issue.\r\n\r\nWhen I run command I read in comment above, I get:\r\n```\r\n set | grep -i socks_proxy\r\nsocks_proxy=socks://127.0.0.1:9050/\r\n```\r\n\r\nI do not know where the \"set\" file is that it is searching, but am I suppose to change it?\r\n\r\nI tried simply reinstalling all the python libraries, but that did not seem to work. Any help is appreciated--thanks!" ]
https://api.github.com/repos/psf/requests/issues/3522
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3522/labels{/name}
https://api.github.com/repos/psf/requests/issues/3522/comments
https://api.github.com/repos/psf/requests/issues/3522/events
https://github.com/psf/requests/issues/3522
171,899,402
MDU6SXNzdWUxNzE4OTk0MDI=
3,522
connection: keep-alive not working with requests used in pyArango
{ "avatar_url": "https://avatars.githubusercontent.com/u/5013077?v=4", "events_url": "https://api.github.com/users/dothebart/events{/privacy}", "followers_url": "https://api.github.com/users/dothebart/followers", "following_url": "https://api.github.com/users/dothebart/following{/other_user}", "gists_url": "https://api.github.com/users/dothebart/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dothebart", "id": 5013077, "login": "dothebart", "node_id": "MDQ6VXNlcjUwMTMwNzc=", "organizations_url": "https://api.github.com/users/dothebart/orgs", "received_events_url": "https://api.github.com/users/dothebart/received_events", "repos_url": "https://api.github.com/users/dothebart/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dothebart/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dothebart/subscriptions", "type": "User", "url": "https://api.github.com/users/dothebart", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2016-08-18T13:21:53Z
2021-09-08T16:00:27Z
2016-08-22T10:46:16Z
NONE
resolved
Hi, requests is used in the connection object of pyArango: https://github.com/tariqdaouda/pyArango/blob/master/pyArango/connection.py Though I only see one instance of the connection object being created and used through out the life of https://github.com/tariqdaouda/pyArango/blob/master/examples/debiangraph.py (I've added printfs in these cases) the http connection isn't re-used. I've followed the connection between pyArango and ArangoDB with Wireshark, to find both of them sending `connection: Keep-Alive` thus the client instantly disconnecting the tcp connection after the HTTP-Requests is done. I'm a bit out of Ideas howto better debug this, is there a smart way?
{ "avatar_url": "https://avatars.githubusercontent.com/u/5013077?v=4", "events_url": "https://api.github.com/users/dothebart/events{/privacy}", "followers_url": "https://api.github.com/users/dothebart/followers", "following_url": "https://api.github.com/users/dothebart/following{/other_user}", "gists_url": "https://api.github.com/users/dothebart/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dothebart", "id": 5013077, "login": "dothebart", "node_id": "MDQ6VXNlcjUwMTMwNzc=", "organizations_url": "https://api.github.com/users/dothebart/orgs", "received_events_url": "https://api.github.com/users/dothebart/received_events", "repos_url": "https://api.github.com/users/dothebart/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dothebart/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dothebart/subscriptions", "type": "User", "url": "https://api.github.com/users/dothebart", "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/3522/reactions" }
https://api.github.com/repos/psf/requests/issues/3522/timeline
null
completed
null
null
false
[ "You're saying that wire shark shows the requests-based client sending `Connection: keep-alive`, is that right? If so, what is the server sending?\n", "yes, its sending that. The server does send that too. Then the client closes the connection, just to open a new one in subsequent requests.\n", "@dothebart It's hard to know exactly what's going on here, but the connection will be left open unless the `Session` is leaked, closed, or otherwise lost. The only other way the connection gets lost is if `Connection: close` is set.\n", "Ok, we found the issue. The bearer object keeping the session object went out of scope and thus closed the connection.\n" ]
https://api.github.com/repos/psf/requests/issues/3521
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3521/labels{/name}
https://api.github.com/repos/psf/requests/issues/3521/comments
https://api.github.com/repos/psf/requests/issues/3521/events
https://github.com/psf/requests/issues/3521
171,836,089
MDU6SXNzdWUxNzE4MzYwODk=
3,521
adding cookies with newlines breaks header
{ "avatar_url": "https://avatars.githubusercontent.com/u/12135640?v=4", "events_url": "https://api.github.com/users/KatieLucas-Grapeshot/events{/privacy}", "followers_url": "https://api.github.com/users/KatieLucas-Grapeshot/followers", "following_url": "https://api.github.com/users/KatieLucas-Grapeshot/following{/other_user}", "gists_url": "https://api.github.com/users/KatieLucas-Grapeshot/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/KatieLucas-Grapeshot", "id": 12135640, "login": "KatieLucas-Grapeshot", "node_id": "MDQ6VXNlcjEyMTM1NjQw", "organizations_url": "https://api.github.com/users/KatieLucas-Grapeshot/orgs", "received_events_url": "https://api.github.com/users/KatieLucas-Grapeshot/received_events", "repos_url": "https://api.github.com/users/KatieLucas-Grapeshot/repos", "site_admin": false, "starred_url": "https://api.github.com/users/KatieLucas-Grapeshot/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/KatieLucas-Grapeshot/subscriptions", "type": "User", "url": "https://api.github.com/users/KatieLucas-Grapeshot", "user_view_type": "public" }
[]
closed
true
null
[]
null
11
2016-08-18T07:34:46Z
2021-09-08T15:00:58Z
2016-08-29T16:09:17Z
NONE
resolved
Adding a cookie with a newline on it seems to break the header/body separation. I found this out after reading a cookie stored in a file and passing it in... The symptom I see is the body starts with header fields and then the content-length truncates the actual body before the end. A strip('\n') on the end of my string after reading fixes it for me but it might be sensible to scan input cookie strings as they're added to the internal request structure and either throw or silently strip them to prevent anyone else finding this the hard way.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3521/reactions" }
https://api.github.com/repos/psf/requests/issues/3521/timeline
null
completed
null
null
false
[ "What Requests version are you using? The most recent Requests should reject this header.\n", "Ah... it's inside a _container_. It's the latest package version for an\nelderly centos version.. all the way down at 2.6.0\n\nDo you know roughly how high a version I'd need to get to test it?\n\nOn 18 August 2016 at 09:25, Cory Benfield [email protected] wrote:\n\n> What Requests version are you using? The most recent Requests should\n> reject this header.\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/kennethreitz/requests/issues/3521#issuecomment-240656761,\n> or mute the thread\n> https://github.com/notifications/unsubscribe-auth/ALks2L_rEJhtfVdxUp7GR_7x4X8ZxbLkks5qhBcTgaJpZM4JnNhV\n> .\n", "2.11.0 fixed it. \n", "@KatieLucas-Grapeshot you should get an InvalidHeader exception from requests in 2.11+. Below is a quick example in my terminal showing the exception and then try/except with it. Hope this helps!\n\n``` python\nPython 3.5.2 (default, Jul 28 2016, 21:28:00)\n[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import requests\n>>> s = requests.Session()\n>>> requests.__version__\n'2.11.1'\n>>> s.headers['Custom'] = \"\\ntest\\t\"\n>>> r = s.post('http://httpbin.org/post', data = {'key':'value'})\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"/Users/clesiemo3/Code/scratchenv/lib/python3.5/site-packages/requests/sessions.py\", line 522, in post\n return self.request('POST', url, data=data, json=json, **kwargs)\n File \"/Users/clesiemo3/Code/scratchenv/lib/python3.5/site-packages/requests/sessions.py\", line 461, in request\n prep = self.prepare_request(req)\n File \"/Users/clesiemo3/Code/scratchenv/lib/python3.5/site-packages/requests/sessions.py\", line 394, in prepare_request\n hooks=merge_hooks(request.hooks, self.hooks),\n File \"/Users/clesiemo3/Code/scratchenv/lib/python3.5/site-packages/requests/models.py\", line 295, in prepare\n self.prepare_headers(headers)\n File \"/Users/clesiemo3/Code/scratchenv/lib/python3.5/site-packages/requests/models.py\", line 409, in prepare_headers\n check_header_validity(header)\n File \"/Users/clesiemo3/Code/scratchenv/lib/python3.5/site-packages/requests/utils.py\", line 797, in check_header_validity\n raise InvalidHeader(\"Invalid return character or leading space in header: %s\" % name)\nrequests.exceptions.InvalidHeader: Invalid return character or leading space in header: Custom\n>>> try:\n... r = s.post('http://httpbin.org/post', data = {'key':'value'})\n... except requests.exceptions.InvalidHeader as e:\n... print(e)\n...\nInvalid return character or leading space in header: Custom\n```\n", "@clesiemo3 is correct, I got the same error too. But is it valid to throw error for starting header custom ?with \\n?\n", "Yes. You _must not_ insert newline characters into headers for any reason.\n", "Then where are we in terms of this issue?\n", "@kedark3 I don't understand the question. The current version of Requests rejects all headers with newline characters in them.\n", "@Lukasa I think they wanted to ask whether this issue should be closed or not.\n", "I believe so. =)\n", "Closed sounds good -- we're just behind on versions here. Sorry!\n\nOn 29 August 2016 at 17:09, Cory Benfield [email protected] wrote:\n\n> Closed #3521 https://github.com/kennethreitz/requests/issues/3521.\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/kennethreitz/requests/issues/3521#event-770900973,\n> or mute the thread\n> https://github.com/notifications/unsubscribe-auth/ALks2OdSUpWVSxd4xEYBieiYkKEeq_2Dks5qkwRQgaJpZM4JnNhV\n> .\n" ]
https://api.github.com/repos/psf/requests/issues/3520
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3520/labels{/name}
https://api.github.com/repos/psf/requests/issues/3520/comments
https://api.github.com/repos/psf/requests/issues/3520/events
https://github.com/psf/requests/pull/3520
171,728,707
MDExOlB1bGxSZXF1ZXN0ODE2OTMyNTk=
3,520
Adding notes about Requests' timeout behavior
{ "avatar_url": "https://avatars.githubusercontent.com/u/13948653?v=4", "events_url": "https://api.github.com/users/Brausepaul/events{/privacy}", "followers_url": "https://api.github.com/users/Brausepaul/followers", "following_url": "https://api.github.com/users/Brausepaul/following{/other_user}", "gists_url": "https://api.github.com/users/Brausepaul/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Brausepaul", "id": 13948653, "login": "Brausepaul", "node_id": "MDQ6VXNlcjEzOTQ4NjUz", "organizations_url": "https://api.github.com/users/Brausepaul/orgs", "received_events_url": "https://api.github.com/users/Brausepaul/received_events", "repos_url": "https://api.github.com/users/Brausepaul/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Brausepaul/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Brausepaul/subscriptions", "type": "User", "url": "https://api.github.com/users/Brausepaul", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-17T18:33:32Z
2021-09-08T03:00:46Z
2016-08-17T21:30:27Z
CONTRIBUTOR
resolved
As discussed in #2228, I added a short note to the quick start and the advanced section about Requests' standard usage of timeouts as this can be unexpected.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3520/reactions" }
https://api.github.com/repos/psf/requests/issues/3520/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3520.diff", "html_url": "https://github.com/psf/requests/pull/3520", "merged_at": "2016-08-17T21:30:27Z", "patch_url": "https://github.com/psf/requests/pull/3520.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3520" }
true
[ "This change seems to add three names to the AUTHORS file. Why is that?\n", "I made changes according to your comments. My fault about the names, that was me mishandling Git.\n", "✨🍰✨\n" ]
https://api.github.com/repos/psf/requests/issues/3519
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3519/labels{/name}
https://api.github.com/repos/psf/requests/issues/3519/comments
https://api.github.com/repos/psf/requests/issues/3519/events
https://github.com/psf/requests/issues/3519
171,690,191
MDU6SXNzdWUxNzE2OTAxOTE=
3,519
Setting session cookies from cookiejar
{ "avatar_url": "https://avatars.githubusercontent.com/u/19844560?v=4", "events_url": "https://api.github.com/users/JamesTheHacker/events{/privacy}", "followers_url": "https://api.github.com/users/JamesTheHacker/followers", "following_url": "https://api.github.com/users/JamesTheHacker/following{/other_user}", "gists_url": "https://api.github.com/users/JamesTheHacker/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/JamesTheHacker", "id": 19844560, "login": "JamesTheHacker", "node_id": "MDQ6VXNlcjE5ODQ0NTYw", "organizations_url": "https://api.github.com/users/JamesTheHacker/orgs", "received_events_url": "https://api.github.com/users/JamesTheHacker/received_events", "repos_url": "https://api.github.com/users/JamesTheHacker/repos", "site_admin": false, "starred_url": "https://api.github.com/users/JamesTheHacker/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/JamesTheHacker/subscriptions", "type": "User", "url": "https://api.github.com/users/JamesTheHacker", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-17T15:38:15Z
2021-09-08T16:00:29Z
2016-08-17T16:35:29Z
NONE
resolved
I'm trying to set the session cookies from a cookiejar, but having no joy. Here is my current code, cookies, and the error. Surely there has to be a way to set the session cookies from a cookiejar? ``` def cookieLogin(cookies): with open(cookies) as f: cookies = requests.utils.cookiejar_from_dict(json.load(f)[0] ) session = requests.session() session.cookies = cookies r = session.get('https://example.com') ``` Cookie example: ``` [ { "domain": ".example.com", "hostOnly": false, "httpOnly": false, "name": "act", "path": "/", "sameSite": "no_restriction", "secure": false, "session": true, "storeId": "0", "value": "875", "id": 1 }, { "domain": ".example.com", "expirationDate": 1479135421.720188, "hostOnly": false, "httpOnly": false, "name": "c_user", "path": "/", "sameSite": "no_restriction", "secure": true, "session": false, "storeId": "0", "value": "109", "id": 2 }, ... ``` Error: ``` Traceback (most recent call last): File "./cookieInviter.py", line 37, in <module> session = cookieLogin(args.cookies) File "/Users/jj/Projects/Jim/login.py", line 78, in cookieLogin r = session.get('https://example.com') File "/Library/Python/2.7/site-packages/requests/sessions.py", line 487, in get return self.request('GET', url, **kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 461, in request prep = self.prepare_request(req) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 394, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/Library/Python/2.7/site-packages/requests/models.py", line 297, in prepare self.prepare_cookies(cookies) File "/Library/Python/2.7/site-packages/requests/models.py", line 518, in prepare_cookies cookie_header = get_cookie_header(self._cookies, self) File "/Library/Python/2.7/site-packages/requests/cookies.py", line 136, in get_cookie_header jar.add_cookie_header(r) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cookielib.py", line 1342, in add_cookie _header attrs = self._cookie_attrs(cookies) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cookielib.py", line 1301, in _cookie_at trs self.non_word_re.search(cookie.value) and version > 0): TypeError: expected string or buffer ``` CookieJar: ``` <RequestsCookieJar[<Cookie domain=.example.com for />, <Cookie hostOnly=False for />, <Cookie httpOnly=False for />, <Cookie id=1 for />, <Cookie name=act for />, <Cookie path=/ for />, <Cookie sameSite=no_restriction for />, <Cookie s ecure=False for />, <Cookie session=True for />, <Cookie storeId=0 for />, <Cookie value=... for />]> ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/19844560?v=4", "events_url": "https://api.github.com/users/JamesTheHacker/events{/privacy}", "followers_url": "https://api.github.com/users/JamesTheHacker/followers", "following_url": "https://api.github.com/users/JamesTheHacker/following{/other_user}", "gists_url": "https://api.github.com/users/JamesTheHacker/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/JamesTheHacker", "id": 19844560, "login": "JamesTheHacker", "node_id": "MDQ6VXNlcjE5ODQ0NTYw", "organizations_url": "https://api.github.com/users/JamesTheHacker/orgs", "received_events_url": "https://api.github.com/users/JamesTheHacker/received_events", "repos_url": "https://api.github.com/users/JamesTheHacker/repos", "site_admin": false, "starred_url": "https://api.github.com/users/JamesTheHacker/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/JamesTheHacker/subscriptions", "type": "User", "url": "https://api.github.com/users/JamesTheHacker", "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/3519/reactions" }
https://api.github.com/repos/psf/requests/issues/3519/timeline
null
completed
null
null
false
[ "No worries, solved it:\n\n```\ndef cookieLogin(cookies):\n\n with open(cookies) as f:\n j = json.load(f)\n\n session = requests.Session()\n for cookie in j: session.cookies.set(cookie['name'], cookie['value'])\n\n r = session.get('https://example.com')\n```\n" ]
https://api.github.com/repos/psf/requests/issues/3518
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3518/labels{/name}
https://api.github.com/repos/psf/requests/issues/3518/comments
https://api.github.com/repos/psf/requests/issues/3518/events
https://github.com/psf/requests/issues/3518
171,640,949
MDU6SXNzdWUxNzE2NDA5NDk=
3,518
ALL_PROXY is incorrectly preferred to HTTP(S)_PROXY
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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" }, { "color": "0b02e1", "default": false, "description": null, "id": 191274, "name": "Contributor Friendly", "node_id": "MDU6TGFiZWwxOTEyNzQ=", "url": "https://api.github.com/repos/psf/requests/labels/Contributor%20Friendly" } ]
closed
true
null
[]
null
2
2016-08-17T12:04:32Z
2021-09-08T16:00:25Z
2016-08-25T12:45:16Z
MEMBER
resolved
Related to #3516. We should aim to use HTTP(S)_PROXY in priority to ALL_PROXY. Generally speaking, more specific proxy settings should be preferred to less-specific ones.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3518/reactions" }
https://api.github.com/repos/psf/requests/issues/3518/timeline
null
completed
null
null
false
[ "BTW, to any experienced contributor reading this: please can you leave this on the pile? This is a fairly easy change, so it'd be great to let someone who hasn't had the opportunity to get started in OSS take a swing at this if we possibly can.\n", "Resolved.\n" ]
https://api.github.com/repos/psf/requests/issues/3517
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3517/labels{/name}
https://api.github.com/repos/psf/requests/issues/3517/comments
https://api.github.com/repos/psf/requests/issues/3517/events
https://github.com/psf/requests/issues/3517
171,570,129
MDU6SXNzdWUxNzE1NzAxMjk=
3,517
It seems that I cannot hide my IP using the proxy?
{ "avatar_url": "https://avatars.githubusercontent.com/u/8926535?v=4", "events_url": "https://api.github.com/users/eduOS/events{/privacy}", "followers_url": "https://api.github.com/users/eduOS/followers", "following_url": "https://api.github.com/users/eduOS/following{/other_user}", "gists_url": "https://api.github.com/users/eduOS/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/eduOS", "id": 8926535, "login": "eduOS", "node_id": "MDQ6VXNlcjg5MjY1MzU=", "organizations_url": "https://api.github.com/users/eduOS/orgs", "received_events_url": "https://api.github.com/users/eduOS/received_events", "repos_url": "https://api.github.com/users/eduOS/repos", "site_admin": false, "starred_url": "https://api.github.com/users/eduOS/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/eduOS/subscriptions", "type": "User", "url": "https://api.github.com/users/eduOS", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-17T04:06:28Z
2021-09-08T16:00:28Z
2016-08-17T07:50:00Z
NONE
resolved
I want to hide my own IP address but it seems unstable as follows. ``` import requests url = "http://httpbin.org/get" proxy0 = {"http":"http://118.179.220.186:8080"} # just an example, it may have expired proxy1 = {"http":"http://41.79.60.202:8080"} r0 = requests.get(url, proxies=proxy0, timeout=5) r1 = requests.get(url, proxies=proxy1, timeout=5) r0.json()["origin"] r1.json()["origin"] ``` When I tested it, the origin in r0 contained only one IP while that of r1 contained two IPs including the source IP. The same problem was posted on StackOverflow, please refer to [here](http://stackoverflow.com/q/27824055/3552975).
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3517/reactions" }
https://api.github.com/repos/psf/requests/issues/3517/timeline
null
completed
null
null
false
[ "@eduOS In this instance, it's possible that the proxy is setting X-Forwarded-For header, which will contain the IP address of your source. Alternatively, it's possible that you're getting forwarded to a HTTPS address. Either way, it's likely that the connection is still using the proxy: so longa s the scheme of the two URLs match, we _will_ use it.\n" ]
https://api.github.com/repos/psf/requests/issues/3516
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3516/labels{/name}
https://api.github.com/repos/psf/requests/issues/3516/comments
https://api.github.com/repos/psf/requests/issues/3516/events
https://github.com/psf/requests/issues/3516
171,566,453
MDU6SXNzdWUxNzE1NjY0NTM=
3,516
requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1618599?v=4", "events_url": "https://api.github.com/users/alochym01/events{/privacy}", "followers_url": "https://api.github.com/users/alochym01/followers", "following_url": "https://api.github.com/users/alochym01/following{/other_user}", "gists_url": "https://api.github.com/users/alochym01/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/alochym01", "id": 1618599, "login": "alochym01", "node_id": "MDQ6VXNlcjE2MTg1OTk=", "organizations_url": "https://api.github.com/users/alochym01/orgs", "received_events_url": "https://api.github.com/users/alochym01/received_events", "repos_url": "https://api.github.com/users/alochym01/repos", "site_admin": false, "starred_url": "https://api.github.com/users/alochym01/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/alochym01/subscriptions", "type": "User", "url": "https://api.github.com/users/alochym01", "user_view_type": "public" }
[]
closed
true
null
[]
null
7
2016-08-17T03:28:33Z
2021-09-08T01:21:07Z
2016-08-17T03:49:17Z
NONE
resolved
Hi list i got problem Missing dependencies for SOCKS support. with requests module version 2.11, but with requests module version 2.10 the requests module works fine my enviroment : declare -x VIRTUAL_ENV="/home/hadn/python3" declare -x VTE_VERSION="3803" declare -x WINDOWID="33554439" declare -x WINDOWPATH="1" declare -x XAUTHORITY="/run/gdm/auth-for-hadn-0O4FTR/database" declare -x XDG_CURRENT_DESKTOP="GNOME-Classic:GNOME" declare -x XDG_MENU_PREFIX="gnome-" declare -x XDG_RUNTIME_DIR="/run/user/1000" declare -x XDG_SEAT="seat0" declare -x XDG_SESSION_DESKTOP="gnome-classic" declare -x XDG_SESSION_ID="2" declare -x XDG_VTNR="1" declare -x XMODIFIERS="@im=ibus" declare -x _system_arch="x86_64" declare -x _system_name="CentOS" declare -x _system_type="Linux" declare -x _system_version="7" declare -x all_proxy="socks://proxy.hcm.fpt.vn:80/" declare -x ftp_proxy="http://proxy.hcm.fpt.vn:80/" declare -x http_proxy="http://proxy.hcm.fpt.vn:80/" declare -x https_proxy="http://proxy.hcm.fpt.vn:80/" (python3)[hadn@rad-hadn4 ~]$ /home/hadn/Laravel/learning_bootstrap_v4/film/film_le.sh Traceback (most recent call last): File "/home/hadn/Laravel/learning_bootstrap_v4/film/film_le_crawler_page_1.py", line 24, in <module> html_content = session.get(url) File "/home/hadn/python3/lib/python3.4/site-packages/requests/sessions.py", line 483, in get return self.request('GET', url, *_kwargs) File "/home/hadn/python3/lib/python3.4/site-packages/requests/sessions.py", line 471, in request resp = self.send(prep, *_send_kwargs) File "/home/hadn/python3/lib/python3.4/site-packages/requests/sessions.py", line 581, in send r = adapter.send(request, *_kwargs) File "/home/hadn/python3/lib/python3.4/site-packages/requests/adapters.py", line 384, in send conn = self.get_connection(request.url, proxies) File "/home/hadn/python3/lib/python3.4/site-packages/requests/adapters.py", line 287, in get_connection proxy_manager = self.proxy_manager_for(proxy) File "/home/hadn/python3/lib/python3.4/site-packages/requests/adapters.py", line 183, in proxy_manager_for *_proxy_kwargs File "/home/hadn/python3/lib/python3.4/site-packages/requests/adapters.py", line 43, in SOCKSProxyManager raise InvalidSchema("Missing dependencies for SOCKS support.") requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3516/reactions" }
https://api.github.com/repos/psf/requests/issues/3516/timeline
null
completed
null
null
false
[ "`$ pip install requests[socks]`\n", "The specific problem here is that in 2.11 we started supporting `all_proxy`, which you have set up as a SOCKS proxy. That means we'd attempt to use the SOCKS proxy and fail.\n", "@Lukasa @kennethreitz can i have option to disable the SOCKS proxy???\n", "@alochym01 If you don't want it, why is it set in your environment? Regardless, if you use a session with `trust_env=False` that problem will no longer occur, though you'll lose your environment HTTP proxy. \n\nHowever, there does seem like there is a bug here: requests will prefer `all_proxy` to a scheme-specific proxy. I think that's a bad idea. @sigmavirus24, should we re-order that?\n", "@Lukasa So as I understand it, `all_proxy` is what should be used if `http(s)_proxy` is unset. And in a more general sense it should be used if `<protocol>_proxy` is unset. So based on that understanding (and assuming I'm correct) yes we definitely should re-order that. Let's file a new bug for that.\n", "@alochym01 Another option seems to be to use `proxies={'all': None}`.\n", "@Lukasa proxies={'all': None} not work because the network should go through proxy, so i see you did open the new issue :)\nlet follow the new issue :+1: \n" ]
https://api.github.com/repos/psf/requests/issues/3515
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3515/labels{/name}
https://api.github.com/repos/psf/requests/issues/3515/comments
https://api.github.com/repos/psf/requests/issues/3515/events
https://github.com/psf/requests/issues/3515
171,560,264
MDU6SXNzdWUxNzE1NjAyNjQ=
3,515
Not raise ProxyError when I use proxy `https://...:8080`
{ "avatar_url": "https://avatars.githubusercontent.com/u/3938751?v=4", "events_url": "https://api.github.com/users/eromoe/events{/privacy}", "followers_url": "https://api.github.com/users/eromoe/followers", "following_url": "https://api.github.com/users/eromoe/following{/other_user}", "gists_url": "https://api.github.com/users/eromoe/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/eromoe", "id": 3938751, "login": "eromoe", "node_id": "MDQ6VXNlcjM5Mzg3NTE=", "organizations_url": "https://api.github.com/users/eromoe/orgs", "received_events_url": "https://api.github.com/users/eromoe/received_events", "repos_url": "https://api.github.com/users/eromoe/repos", "site_admin": false, "starred_url": "https://api.github.com/users/eromoe/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/eromoe/subscriptions", "type": "User", "url": "https://api.github.com/users/eromoe", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-17T02:25:30Z
2021-09-08T16:00:29Z
2016-08-17T07:44:21Z
NONE
resolved
Code: ``` proxies = {'https': u'https://...:8080'} # or {'HTTP':'http://:80' } r = requests.head(u'http://example.com', proxies=proxies, timeout=10) r.status_code >>> 200 ``` The proxy is broken, seems requests do not use this proxy and make request directly, it should raise `ProxyError('Cannot connect to proxy.'` here.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3515/reactions" }
https://api.github.com/repos/psf/requests/issues/3515/timeline
null
completed
null
null
false
[ "That proxy is not broken. We are using the configuration you set. If you set the scheme `{'https': u'https://...:8080'}`, and make a request to a URL beginning with `http://`, you have not set any proxy for us to use: as a result, we don't use it.\n\nThe mere presence of a proxy dictionary does not indicate that the user wants _every_ request they issue to be proxied.\n" ]
https://api.github.com/repos/psf/requests/issues/3514
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3514/labels{/name}
https://api.github.com/repos/psf/requests/issues/3514/comments
https://api.github.com/repos/psf/requests/issues/3514/events
https://github.com/psf/requests/pull/3514
171,134,081
MDExOlB1bGxSZXF1ZXN0ODEyODY5NTQ=
3,514
Prepare for 2.11.1 bugfix release.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "user_view_type": "public" }
[]
closed
true
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" }
[ { "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" } ]
null
5
2016-08-15T09:08:00Z
2021-09-08T03:00:47Z
2016-08-17T20:01:58Z
MEMBER
resolved
@kennethreitz, this is all we need from a boring administrative perspective. If you merge this PR, you only need to do three things to release: 1. Update the version number to 2.11.1. 2. Put the date you do this in the changelog instead of the XX. 3. Push the release. It'd be good to get this release out this week: it should put the nastiest bugs of 2.11 behind us and get people back to working again. =)
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3514/reactions" }
https://api.github.com/repos/psf/requests/issues/3514/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3514.diff", "html_url": "https://github.com/psf/requests/pull/3514", "merged_at": "2016-08-17T20:01:58Z", "patch_url": "https://github.com/psf/requests/pull/3514.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3514" }
true
[ "@kennethreitz let's :shipit:\n", "Awesome! My main machine is down at the moment. I should be able to do this today, though — once I find my laptop (which I was using just a few days ago).\n", "@kennethreitz I think @Lukasa and I can still do it for you if you want us to. Just let us know. We'd both be happy to help out.\n", "I like making the releases. \n", "Released.\n" ]
https://api.github.com/repos/psf/requests/issues/3513
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3513/labels{/name}
https://api.github.com/repos/psf/requests/issues/3513/comments
https://api.github.com/repos/psf/requests/issues/3513/events
https://github.com/psf/requests/pull/3513
171,076,106
MDExOlB1bGxSZXF1ZXN0ODEyNTMwODE=
3,513
doc updates
{ "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
5
2016-08-14T20:08:58Z
2021-09-08T03:00:48Z
2016-08-15T17:52:56Z
MEMBER
resolved
Various doc updates for clarity. Some of these may not match @kennethreitz's aesthetic sensibilities, which may require an inversion of the proposed change. I was mainly trying to make things consistent, input on preferences would be greatly appreciated. Some notes: - I think at least the faq.rst changes _need_ to be merged because there is still live documentation stating that Requests supports 3.1 and 3.2. I can open a separate PR if we want those changes quicker. - What was ScraperWiki, is now found at quickcode.io and appears to either be a paid or account-walled service. Wayback Machine is showing the site as a free service when the documentation was created, so I'm not sure if Kenneth still wants this included. At the very least, the URL should be updated. - ~~Does Requests support pypy 2.2 officially? faq.rst says yes, but it's other versions were wrong.~~ - While I realize it's common to use `class.method` as a pattern when describing code, I felt like `r.json` is ambiguous when referenced next to `r.text`. Calling exactly `r.json` won't function as described in the provided `ValueError` example. Explicitly defining the call as `r.json()` reduces the chance of misinterpretation. - api.rst has a pared down set of Exceptions and classes. I assume this is to keep extraneous information from bloating the page to a point of being unhelpful. I do think it may be worth including `BaseAdapter` for easy reference since anyone looking into a custom _non-HTTP_ Transport Adapter will likely need to start there.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3513/reactions" }
https://api.github.com/repos/psf/requests/issues/3513/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3513.diff", "html_url": "https://github.com/psf/requests/pull/3513", "merged_at": "2016-08-15T17:52:56Z", "patch_url": "https://github.com/psf/requests/pull/3513.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3513" }
true
[ "@nateprewitt is this related to #2228?\n", "@sigmavirus24 It wasn't originally, I found a few minor hiccups making the `.json` change and then did a pass through the docs from there. I realize this is kind of a mess of unrelated doc changes so I can break it up into different commits or PRs if needed.\n\nIt looks like most of the discussion in #2228 is about timeouts documentation. Was there something low hanging you wanted to see integrated?\n", "> Was there something low hanging you wanted to see integrated?\n\nNo because the last person to comment on that thread wants to contribute and I wanted to make sure we gave them the first chance. If this is unrelated that's fine.\n", "Sorry, I missed that. No, none of these changes touch the timeouts docs, so I think all is well.\n", "These are all fanatastic changes, and ones I would have made myself, given an infinite amount of time :)\n\nThank you very much!\n" ]
https://api.github.com/repos/psf/requests/issues/3512
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3512/labels{/name}
https://api.github.com/repos/psf/requests/issues/3512/comments
https://api.github.com/repos/psf/requests/issues/3512/events
https://github.com/psf/requests/issues/3512
171,037,471
MDU6SXNzdWUxNzEwMzc0NzE=
3,512
Requests 2.11 regression - Site ID needs to be String
{ "avatar_url": "https://avatars.githubusercontent.com/u/19509188?v=4", "events_url": "https://api.github.com/users/listingmirror/events{/privacy}", "followers_url": "https://api.github.com/users/listingmirror/followers", "following_url": "https://api.github.com/users/listingmirror/following{/other_user}", "gists_url": "https://api.github.com/users/listingmirror/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/listingmirror", "id": 19509188, "login": "listingmirror", "node_id": "MDQ6VXNlcjE5NTA5MTg4", "organizations_url": "https://api.github.com/users/listingmirror/orgs", "received_events_url": "https://api.github.com/users/listingmirror/received_events", "repos_url": "https://api.github.com/users/listingmirror/repos", "site_admin": false, "starred_url": "https://api.github.com/users/listingmirror/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/listingmirror/subscriptions", "type": "User", "url": "https://api.github.com/users/listingmirror", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-08-14T01:54:31Z
2021-09-08T16:00:29Z
2016-08-14T02:59:28Z
NONE
resolved
Using https://github.com/timotheus/ebaysdk-python v 2.1.3 (latest) Which transitively uses requests... Requests 2.10 was good, with Requests 2.11 I get: ``` <Truncated> File "/webapps/listing_mirror/lib/python3.5/site-packages/ebaysdk/connection.py", line 119, in execute self.build_request(verb, data, verb_attrs, files) File "/webapps/listing_mirror/lib/python3.5/site-packages/ebaysdk/connection.py", line 159, in build_request self.request = request.prepare() File "/webapps/listing_mirror/lib/python3.5/site-packages/requests/models.py", line 251, in prepare hooks=self.hooks, File "/webapps/listing_mirror/lib/python3.5/site-packages/requests/models.py", line 295, in prepare self.prepare_headers(headers) File "/webapps/listing_mirror/lib/python3.5/site-packages/requests/models.py", line 409, in prepare_headers check_header_validity(header) File "/webapps/listing_mirror/lib/python3.5/site-packages/requests/utils.py", line 756, in check_header_validity "not %s" % (value, type(value))) requests.exceptions.InvalidHeader: Header value 961 must be of type str or bytes, not <class 'int'> ``` Can't say for sure yet where the bug is (requests vs ebaysdk)... but at least something changed in a breaking manner. Trying to investigate more...
{ "avatar_url": "https://avatars.githubusercontent.com/u/19509188?v=4", "events_url": "https://api.github.com/users/listingmirror/events{/privacy}", "followers_url": "https://api.github.com/users/listingmirror/followers", "following_url": "https://api.github.com/users/listingmirror/following{/other_user}", "gists_url": "https://api.github.com/users/listingmirror/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/listingmirror", "id": 19509188, "login": "listingmirror", "node_id": "MDQ6VXNlcjE5NTA5MTg4", "organizations_url": "https://api.github.com/users/listingmirror/orgs", "received_events_url": "https://api.github.com/users/listingmirror/received_events", "repos_url": "https://api.github.com/users/listingmirror/repos", "site_admin": false, "starred_url": "https://api.github.com/users/listingmirror/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/listingmirror/subscriptions", "type": "User", "url": "https://api.github.com/users/listingmirror", "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/3512/reactions" }
https://api.github.com/repos/psf/requests/issues/3512/timeline
null
completed
null
null
false
[ "Hey @listingmirror, you can find more information on this in #3477. 2.11.0 brought in more rigid header validation, requiring values to be passed as either strings or bytes. I'm betting ebaysdk is passing the Content-Length header as an int. This will need to be converted to a string for use with 2.11.0+.\n", "@nateprewitt Perfect I will chase it down there ;)\n" ]
https://api.github.com/repos/psf/requests/issues/3511
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3511/labels{/name}
https://api.github.com/repos/psf/requests/issues/3511/comments
https://api.github.com/repos/psf/requests/issues/3511/events
https://github.com/psf/requests/pull/3511
170,989,114
MDExOlB1bGxSZXF1ZXN0ODEyMDQ5MTE=
3,511
fix grammer mistakes in Quickstart
{ "avatar_url": "https://avatars.githubusercontent.com/u/7857126?v=4", "events_url": "https://api.github.com/users/forrestchang/events{/privacy}", "followers_url": "https://api.github.com/users/forrestchang/followers", "following_url": "https://api.github.com/users/forrestchang/following{/other_user}", "gists_url": "https://api.github.com/users/forrestchang/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/forrestchang", "id": 7857126, "login": "forrestchang", "node_id": "MDQ6VXNlcjc4NTcxMjY=", "organizations_url": "https://api.github.com/users/forrestchang/orgs", "received_events_url": "https://api.github.com/users/forrestchang/received_events", "repos_url": "https://api.github.com/users/forrestchang/repos", "site_admin": false, "starred_url": "https://api.github.com/users/forrestchang/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/forrestchang/subscriptions", "type": "User", "url": "https://api.github.com/users/forrestchang", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-08-13T02:43:30Z
2021-09-08T03:00:48Z
2016-08-13T08:42:25Z
CONTRIBUTOR
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3511/reactions" }
https://api.github.com/repos/psf/requests/issues/3511/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3511.diff", "html_url": "https://github.com/psf/requests/pull/3511", "merged_at": "2016-08-13T08:42:25Z", "patch_url": "https://github.com/psf/requests/pull/3511.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3511" }
true
[ "Thanks @forrestchang! :sparkles: :cake: :sparkles:\n", "p.s. 'grammar' is spelled with an 'a', and these changes are not grammar related :)\n" ]
https://api.github.com/repos/psf/requests/issues/3510
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3510/labels{/name}
https://api.github.com/repos/psf/requests/issues/3510/comments
https://api.github.com/repos/psf/requests/issues/3510/events
https://github.com/psf/requests/pull/3510
170,900,192
MDExOlB1bGxSZXF1ZXN0ODExMzk5NjI=
3,510
adding passthrough in close() for non-urllib3-like Responses
{ "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
5
2016-08-12T15:42:08Z
2021-09-08T02:10:15Z
2016-08-18T08:28:20Z
MEMBER
resolved
This is minor, but when testing `resolve_redirects` I encountered an `AttributeError` when passing a non-urllib3 Response. This is because the method unconditionally calls [`close`](https://github.com/kennethreitz/requests/blob/master/requests/models.py#L864) on the Response which in turn calls `release_conn` on the `Response.raw` attribute. If the desire for requests is to maintain support for non-urllib3 objects in custom adapters, I think this would be a simple and useful addition. If urllib3 is going to be a de facto pattern for Responses though, this is probably just unnecessary code bloat.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3510/reactions" }
https://api.github.com/repos/psf/requests/issues/3510/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3510.diff", "html_url": "https://github.com/psf/requests/pull/3510", "merged_at": "2016-08-18T08:28:20Z", "patch_url": "https://github.com/psf/requests/pull/3510.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3510" }
true
[ "Ok, I have put some small notes in. I don't want to merge this until after 2.11.1 gets out the door though.\n", "Test updated and lambda logic changed to a conditional. No rush on this, just wanted to get it on the record before I forgot.\n", "Just reminding ourselves not to merge this until after 2.11.1 is released\n", "Now that 2.11.1 is out, I don't think I have anything else on my checklist. Let me know if this needs any other final tweaks.\n", "Thanks @nateprewitt!\n" ]
https://api.github.com/repos/psf/requests/issues/3509
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3509/labels{/name}
https://api.github.com/repos/psf/requests/issues/3509/comments
https://api.github.com/repos/psf/requests/issues/3509/events
https://github.com/psf/requests/issues/3509
170,850,033
MDU6SXNzdWUxNzA4NTAwMzM=
3,509
session() got an unexpected keyword argument 'headers'
{ "avatar_url": "https://avatars.githubusercontent.com/u/1391224?v=4", "events_url": "https://api.github.com/users/breize/events{/privacy}", "followers_url": "https://api.github.com/users/breize/followers", "following_url": "https://api.github.com/users/breize/following{/other_user}", "gists_url": "https://api.github.com/users/breize/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/breize", "id": 1391224, "login": "breize", "node_id": "MDQ6VXNlcjEzOTEyMjQ=", "organizations_url": "https://api.github.com/users/breize/orgs", "received_events_url": "https://api.github.com/users/breize/received_events", "repos_url": "https://api.github.com/users/breize/repos", "site_admin": false, "starred_url": "https://api.github.com/users/breize/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/breize/subscriptions", "type": "User", "url": "https://api.github.com/users/breize", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-08-12T11:14:56Z
2018-10-03T00:33:25Z
2016-08-12T11:16:05Z
NONE
null
When trying the second example of [http://docs.python-requests.org/en/v0.10.6/user/advanced/#session-objects](http://docs.python-requests.org/en/v0.10.6/user/advanced/#session-objects) i get the following error: `TypeError: session() got an unexpected keyword argument 'auth'` Did something change there and the documentation didn't get updated?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3509/reactions" }
https://api.github.com/repos/psf/requests/issues/3509/timeline
null
completed
null
null
false
[ "@breize You're linking to an ancient version of the documentation. Try this: http://docs.python-requests.org/en/latest/user/advanced/\n", "@Lukasa this is still in the latest docs version: `http://docs.python-requests.org/en/latest/api/#requests.Session.auth`. I have the same with `headers=`. Are the docs out of date?\r\n\r\nAny reason not to accept this as a init kwarg? Seems a bit silly that you have to do:\r\n```\r\ns = requests.Session()\r\ns.headers.update('foo', 'bar')\r\n```" ]
https://api.github.com/repos/psf/requests/issues/3508
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3508/labels{/name}
https://api.github.com/repos/psf/requests/issues/3508/comments
https://api.github.com/repos/psf/requests/issues/3508/events
https://github.com/psf/requests/issues/3508
170,787,922
MDU6SXNzdWUxNzA3ODc5MjI=
3,508
Grammar error in document: Quickstart
{ "avatar_url": "https://avatars.githubusercontent.com/u/7857126?v=4", "events_url": "https://api.github.com/users/forrestchang/events{/privacy}", "followers_url": "https://api.github.com/users/forrestchang/followers", "following_url": "https://api.github.com/users/forrestchang/following{/other_user}", "gists_url": "https://api.github.com/users/forrestchang/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/forrestchang", "id": 7857126, "login": "forrestchang", "node_id": "MDQ6VXNlcjc4NTcxMjY=", "organizations_url": "https://api.github.com/users/forrestchang/orgs", "received_events_url": "https://api.github.com/users/forrestchang/received_events", "repos_url": "https://api.github.com/users/forrestchang/repos", "site_admin": false, "starred_url": "https://api.github.com/users/forrestchang/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/forrestchang/subscriptions", "type": "User", "url": "https://api.github.com/users/forrestchang", "user_view_type": "public" }
[]
closed
true
null
[]
null
5
2016-08-12T02:33:18Z
2021-09-08T16:00:30Z
2016-08-13T10:43:51Z
CONTRIBUTOR
resolved
In section [Binary Response Content](http://docs.python-requests.org/en/master/user/quickstart/#binary-response-content), `r.content` returns an instance of `bytes` while `StringIO` is an in-memory stream for text only. It should use `BytesIO` instead. ``` python from PIL import Image from io import BytesIO i = Image.open(BytesIO(r.content)) ``` Use original code will raise `TypeError: initial_value must be str or None, not bytes.`
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "user_view_type": "public" }
{ "+1": 1, "-1": 0, "confused": 0, "eyes": 0, "heart": 1, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 2, "url": "https://api.github.com/repos/psf/requests/issues/3508/reactions" }
https://api.github.com/repos/psf/requests/issues/3508/timeline
null
completed
null
null
false
[ "@forrestchang Thanks, would you like to open a PR to change it?\n", "@Lukasa Yes, I would like to. I have modified the mistake in `.rst` file. Should I generate it to the HTML file? \n", "Hey @forrestchang, there's no need to run the docs build. If you open a PR with the rst changes, read the docs will generate changes on merge.\n", "@nateprewitt Thanks.\n", "Resolved by #3511.\n" ]
https://api.github.com/repos/psf/requests/issues/3507
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3507/labels{/name}
https://api.github.com/repos/psf/requests/issues/3507/comments
https://api.github.com/repos/psf/requests/issues/3507/events
https://github.com/psf/requests/issues/3507
170,768,634
MDU6SXNzdWUxNzA3Njg2MzQ=
3,507
Requests 2.11.0 and Python 3.2
{ "avatar_url": "https://avatars.githubusercontent.com/u/726553?v=4", "events_url": "https://api.github.com/users/ppolewicz/events{/privacy}", "followers_url": "https://api.github.com/users/ppolewicz/followers", "following_url": "https://api.github.com/users/ppolewicz/following{/other_user}", "gists_url": "https://api.github.com/users/ppolewicz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ppolewicz", "id": 726553, "login": "ppolewicz", "node_id": "MDQ6VXNlcjcyNjU1Mw==", "organizations_url": "https://api.github.com/users/ppolewicz/orgs", "received_events_url": "https://api.github.com/users/ppolewicz/received_events", "repos_url": "https://api.github.com/users/ppolewicz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ppolewicz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ppolewicz/subscriptions", "type": "User", "url": "https://api.github.com/users/ppolewicz", "user_view_type": "public" }
[]
closed
true
null
[]
null
9
2016-08-11T23:15:17Z
2021-09-08T16:00:30Z
2016-08-12T07:55:32Z
NONE
resolved
requests 2.11.0 is incompatible with python 3.2, but is installable: ``` # pip install requests Collecting requests Downloading requests-2.11.0-py2.py3-none-any.whl (514kB) 100% |████████████████████████████████| 516kB 1.4MB/s Installing collected packages: requests Successfully installed requests-2.11.0 You are using pip version 7.1.2, however version 8.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. # python --version Python 3.2.6 ``` This breaks dependencies for our clients. Could you please make it so 2.11.0 either works properly with python 3.2, or alternatively, make it so it is not installable in Python 3.2?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3507/reactions" }
https://api.github.com/repos/psf/requests/issues/3507/timeline
null
completed
null
null
false
[ "Hey @ppolewicz, I believe you can find answers addressing this in #3479, primarily @Lukasa's comment [here](https://github.com/kennethreitz/requests/issues/3479#issuecomment-238633044).\n\npip is currently unable to filter out libraries based on python version, but it was also [noted](https://github.com/kennethreitz/requests/issues/3479#issuecomment-238640627) in #3479 that this may be available in the _distant_ future. I'm not positive on when 3.2 was officially deprecated for Requests (it was before 2.11.0) but it was removed from the trove list in setup.py in May 2013. Unfortunately, I don't believe there's any intent to reintroduce support for 3.2, per @sigmavirus24 [comments](https://github.com/kennethreitz/requests/issues/3479#issuecomment-238640113).\n", "I'm going to have to question the comments about 'This isn't possible to prevent installation' \n\nIn `setup.py` if you have something along the lines of the following, `if sys.version_info not in [(2,6),(2,7),(3,3),(3,4),(3,5)]` than you could raise an error during `pip install requests` if the python version is outside one of the supported versions\n", "If @Lukasa wants I'd be happy to create a PR for thisfor 2.11.1\n", "## Tetra that does not work with universal wheels which is how most users will be experiencing requests installation these days. That only works for source distributions and we are not going to stop distributing wheels.\n\nSent from my Android device with K-9 Mail. Please excuse my brevity.\n", "This is correct: right now the overwhelming majority of our users download wheels. A quick check of the PyPI download statistics reveals that for the 2.10.0 release last month, the wheel was downloaded 4,087,469 times, and the sdist was downloaded 364,911 times, making the wheels 11.2 times as popular a download as the sdist.\n\nA solution that works only for the sdist is no solution at all.\n\nI should note, as well, that adding a setup.py exception that prevents installation doesn't actually provide a useful behaviour. The _most_ useful behaviour would be if pip clamped the maximum version it would be willing to install on Python 3.2: e.g., if we could say \"the last version that supported Python 3.2 was Requests 1.2.3, so go have fun with that\". But that doesn't exist either.\n\nI'm open to being told that there is a good way to handle this, but right now there just isn't.\n", "Could we fix it in `2.11.1` by changing [those two lines](https://github.com/kennethreitz/requests/pull/3478/files) to use [six.u()](https://pythonhosted.org/six/#six.u)?\nI understand that 3.2 is no longer supported by requests, but pip being broken as it is with the version mapping causes trouble for some people. Requests are extremely popular, so it is bound to break something somewhere. I think a minor change of 2 LOC to prevent this would be acceptable?\n", "> I understand that 3.2 is no longer supported by requests, but pip being broken as it is with the version mapping causes trouble for some people.\n\nI'm sorry, I don't quite understand what you are referring to @ppolewicz. \n\n> I think a minor change of 2 LOC to prevent this would be acceptable?\n\n@ppolewicz except that minor change implies Python 3.2 support. Python 3.2 as a product itself is unsupported. The number of users it has according to PyPI is incredibly small. I don't see a whole lot of value in changing those two lines, but @Lukasa and @kennethreitz may disagree. I'm not against it, I just don't agree that we should be implicitly supporting an unsupported version that is mostly not used (regardless of how easy it is).\n", "@ppolewicz In principle, yes, we could do that. In practice, doing so postpones the inevitable. You'll note that [pip itself dropped support for Python 3.2 in 8.0.0](https://pip.pypa.io/en/stable/news/#release-notes). People who refuse to upgrade to Python 3.3, which was released _four years ago_, are going to need to get comfortable with the idea that their software ecosystem is going to start breaking.\n\n> Requests are extremely popular, so it is bound to break something somewhere. I think a minor change of 2 LOC to prevent this would be acceptable?\n\nThis logic is just fundamentally flawed. The same argument can be made to support Python 3.0 and Python 3.1, and Python 2.5 and earlier. Each change is only a few LoC, but at a certain point we're just holding ourselves back. 3.2 is no longer receiving security patches from Python dev, which means that it is no longer supported by Python-dev: it _should not be used anymore_, because it cannot be made to be secure.\n\nI have exactly no interest in supporting Python 3.2 for free. Users who refuse to upgrade to Python 3.3 can apply patches themselves. Users who cannot upgrade to Python 3.3 because their LTS distribution will not ship it to them should contact their distributor, who can either apply appropriate patches themselves or who can pay the Requests development team to continue to support Python 3.2. Those are the two options I will find acceptable.\n", "Fair enough.\n\nThank you for a detailed explanation.\n" ]
https://api.github.com/repos/psf/requests/issues/3506
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3506/labels{/name}
https://api.github.com/repos/psf/requests/issues/3506/comments
https://api.github.com/repos/psf/requests/issues/3506/events
https://github.com/psf/requests/pull/3506
170,749,846
MDExOlB1bGxSZXF1ZXN0ODEwMzMwNDQ=
3,506
Prevent environment variables from overridding Session settings
{ "avatar_url": "https://avatars.githubusercontent.com/u/728526?v=4", "events_url": "https://api.github.com/users/pfista/events{/privacy}", "followers_url": "https://api.github.com/users/pfista/followers", "following_url": "https://api.github.com/users/pfista/following{/other_user}", "gists_url": "https://api.github.com/users/pfista/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pfista", "id": 728526, "login": "pfista", "node_id": "MDQ6VXNlcjcyODUyNg==", "organizations_url": "https://api.github.com/users/pfista/orgs", "received_events_url": "https://api.github.com/users/pfista/received_events", "repos_url": "https://api.github.com/users/pfista/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pfista/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pfista/subscriptions", "type": "User", "url": "https://api.github.com/users/pfista", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-11T21:19:55Z
2021-09-08T03:00:49Z
2016-08-11T21:28:03Z
NONE
resolved
In some cases, `Session` settings are overridden by environment settings. Session should inherit from its own settings before trying to pull in environment settings. For example, say environment variable `REQUESTS_CA_BUNDLE` is set to a certificate bundle, a session object is created and `session.verify = False`, and then that session is mounted to an adapter. If subsequent requests made do not explicitly pass in `verify=False`, certificate verification will be enabled despite having set `session.verify = False`. This is due to `merge_setting` defaulting to use the `request_setting` when merging verify, which is currently incorrectly set to the environment variables certificate file before checking `session.verify`. This will ensure that `Request` object settings take precedence, then `Session` settings, then global environment settings.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3506/reactions" }
https://api.github.com/repos/psf/requests/issues/3506/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3506.diff", "html_url": "https://github.com/psf/requests/pull/3506", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3506.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3506" }
true
[ "Thanks! This is a known issue (see #2018), but fixing it is a breaking change that needs to go into 3.0.0. Can you please open a new pull request targeting the proposed/3.0.0 branch?\n", "It looks like this has already been fixed in proposed/3.0.0!\n", "It may be worth noting that it's PR #2839 that fixes this.\n" ]
https://api.github.com/repos/psf/requests/issues/3495
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3495/labels{/name}
https://api.github.com/repos/psf/requests/issues/3495/comments
https://api.github.com/repos/psf/requests/issues/3495/events
https://github.com/psf/requests/issues/3495
170,644,688
MDU6SXNzdWUxNzA2NDQ2ODg=
3,495
Any way to set verify=False on session object?
{ "avatar_url": "https://avatars.githubusercontent.com/u/19844560?v=4", "events_url": "https://api.github.com/users/JamesTheHacker/events{/privacy}", "followers_url": "https://api.github.com/users/JamesTheHacker/followers", "following_url": "https://api.github.com/users/JamesTheHacker/following{/other_user}", "gists_url": "https://api.github.com/users/JamesTheHacker/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/JamesTheHacker", "id": 19844560, "login": "JamesTheHacker", "node_id": "MDQ6VXNlcjE5ODQ0NTYw", "organizations_url": "https://api.github.com/users/JamesTheHacker/orgs", "received_events_url": "https://api.github.com/users/JamesTheHacker/received_events", "repos_url": "https://api.github.com/users/JamesTheHacker/repos", "site_admin": false, "starred_url": "https://api.github.com/users/JamesTheHacker/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/JamesTheHacker/subscriptions", "type": "User", "url": "https://api.github.com/users/JamesTheHacker", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-11T13:23:48Z
2021-09-08T16:00:31Z
2016-08-11T13:25:26Z
NONE
resolved
Is there any way to set `verify=False` on a session object rather than having to use it on every HTTP request made by the session?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3495/reactions" }
https://api.github.com/repos/psf/requests/issues/3495/timeline
null
completed
null
null
false
[ "No. =) If you're going to make yourself unsafe, we'd like you to do it every time. Think of us as like your better angel, sitting on your shoulder saying \"are you _sure_ you want to turn off your security?\".\n", "Ah ok. I was debugging HTTP requests with Burp Suite. It's the only time I will be setting `verify=False`. I wanted to do it once for development purposes only.\n", "Oh sure, there are lots of totally legitimate reasons to turn it off, that's why we have the switch at all. =D But we just never want to make it _too_ comfortable to turn off. \n" ]
https://api.github.com/repos/psf/requests/issues/3494
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3494/labels{/name}
https://api.github.com/repos/psf/requests/issues/3494/comments
https://api.github.com/repos/psf/requests/issues/3494/events
https://github.com/psf/requests/issues/3494
170,599,170
MDU6SXNzdWUxNzA1OTkxNzA=
3,494
2.11.0 causing issues with missing attribute 'reason' in raise_for_status()
{ "avatar_url": "https://avatars.githubusercontent.com/u/3816327?v=4", "events_url": "https://api.github.com/users/robcresswell/events{/privacy}", "followers_url": "https://api.github.com/users/robcresswell/followers", "following_url": "https://api.github.com/users/robcresswell/following{/other_user}", "gists_url": "https://api.github.com/users/robcresswell/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/robcresswell", "id": 3816327, "login": "robcresswell", "node_id": "MDQ6VXNlcjM4MTYzMjc=", "organizations_url": "https://api.github.com/users/robcresswell/orgs", "received_events_url": "https://api.github.com/users/robcresswell/received_events", "repos_url": "https://api.github.com/users/robcresswell/repos", "site_admin": false, "starred_url": "https://api.github.com/users/robcresswell/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/robcresswell/subscriptions", "type": "User", "url": "https://api.github.com/users/robcresswell", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-11T09:00:09Z
2021-09-08T16:00:31Z
2016-08-11T09:27:41Z
NONE
resolved
Apologies for the vague header, I'm still narrowing this down. It appears that this commit (https://github.com/kennethreitz/requests/commit/7700ecae14930fd078e28e35425661d46778bfa9) is using self.reason, and in our implementation, its throwing errors for a missing attribute 'reason'. The lib in question is django_openstack_auth; all our tests began failing when 2.11.0 released. 2.10.0 still works fine. I'm unsure whether this is an issue with a clumsy test implementation on our side or a false assumption on the requests side. Will keep digging.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3494/reactions" }
https://api.github.com/repos/psf/requests/issues/3494/timeline
null
completed
null
null
false
[ "I suspect the issue is a bit of both. The higher level requests code expects a reason phrase, but they're not always common, especially in test implementations. That said, I recommend all test implementations _set_ a reason: the code here always expected one, it's just that now it's always checked for, rather than being checked for only in error cases.\n\nIf you have no reason phrase to set, just set `''`: that'll work fine.\n", "Makes sense. This can be closed then, thanks for the quick response!\n", "My pleasure!\n" ]
https://api.github.com/repos/psf/requests/issues/3493
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3493/labels{/name}
https://api.github.com/repos/psf/requests/issues/3493/comments
https://api.github.com/repos/psf/requests/issues/3493/events
https://github.com/psf/requests/pull/3493
170,451,884
MDExOlB1bGxSZXF1ZXN0ODA4MTkxNDE=
3,493
#3490 removing Content-Type and Transfer-Encoding headers on redirect
{ "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
13
2016-08-10T15:50:44Z
2021-09-08T02:10:17Z
2016-08-12T11:24:36Z
MEMBER
resolved
This will remove additional headers (`Content-Type` and `Transfer-Encoding`) from non-temporary/non-permanent redirects in `resolve_redirects` to address #3490. This functionality isn't currently being tested but I'm happy to add a test or two for it if desired.
{ "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/3493/reactions" }
https://api.github.com/repos/psf/requests/issues/3493/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3493.diff", "html_url": "https://github.com/psf/requests/pull/3493", "merged_at": "2016-08-12T11:24:36Z", "patch_url": "https://github.com/psf/requests/pull/3493.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3493" }
true
[ "I would like to see tests for this please! :sparkles:\n", "I was on it too. Did not find a way to properly add tests though since httpbin does not seem to be able to post to an endpoint and respond with a 301/302. Am I wrong on this one?\n\nAnyway since @nateprewitt is on it I will not open my PR ;)\n", "On my version of the fix (https://github.com/kennethreitz/requests/compare/master...saveman71:master) I moved [this line](https://github.com/kennethreitz/requests/pull/3493/files#diff-28e67177469c0d36b068d68d9f6043bfR151) a little higher and removed the try/catch below as it seems the general way (at least in this file) is to check the existence of the key prior to the deletion.\n", "@saveman71, sorry, I didn't mean to jump on your PR. I wasn't sure if anyone had started working on it.\n\n@Lukasa I added a test to check the header removal and empty body.\n", "@Lukasa re: [this line](https://github.com/kennethreitz/requests/pull/3493/files#diff-28e67177469c0d36b068d68d9f6043bfR151)\n\nDo you have an opinion on moving the declaration farther up to avoid the multiple calls to the headers attribute on the prepare_request? Also as for the conversion from try/except, if that was done would you want it in a separate PR to avoid semi-unrelated changes?\n", "@nateprewitt no worries at all, I should have stated I started working on it.\nAs for the line thing, I do not think it is a performance issue (I believe, but I might be mistaken) because well requests is a network library and \"premature optimization is the root of all evil\". (https://www.xkcd.com/1691/)\n\nI was suggesting that merely because it's already been like that [here](https://github.com/nateprewitt/requests/blob/20a2b5ac71f1d6ce674ca2633172ef5964ec9c38/requests/sessions.py#L192) and [here](https://github.com/nateprewitt/requests/blob/20a2b5ac71f1d6ce674ca2633172ef5964ec9c38/requests/sessions.py#L223) for example.\n\nOn a side note, :+1: for a separate PR.\n", "@saveman71, I only bring up the optimization because @sigmavirus24 has [brought it up before](https://github.com/kennethreitz/requests/pull/3362#discussion_r68398047). If I'm misunderstanding his original intent though, I vote we completely remove the declaration, in favor of `prepared_request.headers`. `headers` currently doesn't provide a lot of use in `resolve_redirects`.\n\nEdit: Clarity and Link\n", "Quick semi-unrelated question, what would be the timeline of a release on PyPI after this gets merged?\n\ncc @Lukasa \n", "We'd be aiming to release this early next week if we can merge it this week. \n", "To be clear, this is on my queue, but I'll review tomorrow. \n", "Alright, fab, I'm happy with this. @sigmavirus24 you ok with us merging this for 2.11.1?\n", "Alright, all is well. @sigmavirus24, you want this in 2.11.1?\n", "👍 \n" ]
https://api.github.com/repos/psf/requests/issues/3492
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3492/labels{/name}
https://api.github.com/repos/psf/requests/issues/3492/comments
https://api.github.com/repos/psf/requests/issues/3492/events
https://github.com/psf/requests/pull/3492
170,272,361
MDExOlB1bGxSZXF1ZXN0ODA2OTU3ODA=
3,492
updating HISTORY
{ "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
2016-08-09T21:13:22Z
2021-09-08T03:00:52Z
2016-08-09T21:16:37Z
MEMBER
resolved
Clarifies that ALL non-string values are not permitted in headers.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3492/reactions" }
https://api.github.com/repos/psf/requests/issues/3492/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3492.diff", "html_url": "https://github.com/psf/requests/pull/3492", "merged_at": "2016-08-09T21:16:37Z", "patch_url": "https://github.com/psf/requests/pull/3492.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3492" }
true
[]
https://api.github.com/repos/psf/requests/issues/3491
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3491/labels{/name}
https://api.github.com/repos/psf/requests/issues/3491/comments
https://api.github.com/repos/psf/requests/issues/3491/events
https://github.com/psf/requests/issues/3491
170,268,083
MDU6SXNzdWUxNzAyNjgwODM=
3,491
Requests is no longer converting Boolean values in headers to strings
{ "avatar_url": "https://avatars.githubusercontent.com/u/1134139?v=4", "events_url": "https://api.github.com/users/jidar/events{/privacy}", "followers_url": "https://api.github.com/users/jidar/followers", "following_url": "https://api.github.com/users/jidar/following{/other_user}", "gists_url": "https://api.github.com/users/jidar/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jidar", "id": 1134139, "login": "jidar", "node_id": "MDQ6VXNlcjExMzQxMzk=", "organizations_url": "https://api.github.com/users/jidar/orgs", "received_events_url": "https://api.github.com/users/jidar/received_events", "repos_url": "https://api.github.com/users/jidar/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jidar/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jidar/subscriptions", "type": "User", "url": "https://api.github.com/users/jidar", "user_view_type": "public" }
[]
closed
true
null
[]
null
10
2016-08-09T20:53:57Z
2021-09-08T16:00:32Z
2016-08-09T21:03:01Z
NONE
resolved
This results in an InvalidHeader error. For requests 2.10.0: In [1]: import requests In [2]: r = requests.get('http://www.google.com', headers={'fake-header':True}) In [3]: r.request.headers Out[3]: {'fake-header': True, 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate', 'Accept': '_/_', 'User-Agent': 'python-requests/2.10.0'} For requests 2.11.0: In [1]: import requests In [2]: r = requests.get('http://www.google.com', headers={'fake-header':True}) <Traceback snip> InvalidHeader: Header value True must be of type str or bytes, not <type 'bool'>
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3491/reactions" }
https://api.github.com/repos/psf/requests/issues/3491/timeline
null
completed
null
null
false
[ "Please see #3477.\n", "See also #3477, #865. Requests has always documented that headers _must_ be strings. We just didn't enforce it very well. It's also entirely unclear how to appropriately represent True on Python.\n", "@Lukasa @sigmavirus24 It looks like the [HISTORY.rst change](https://github.com/kennethreitz/requests/blame/master/HISTORY.rst#L33) specifies only integers. Perhaps that should be changed to 'non-string'?\n", "I found all the history after I posted the bug. It would have been nice to have at least included this change in the changelog (the entry lists only integers as being nixed). It would also have been nice to continue supporting python's bools type for True and False at least.\n", "@nateprewitt Yes, it should.\n\n@jidar How do we represent True/False as strings? \"True\"/\"False\"? Why that over \"true\"/\"false\", \"1\"/\"0\", or \"Yes\"/\"No\"? Requests is simply refusing to guess in this case, and asking that you unambiguously decide what you want to send.\n", "I should note that, as far as I know, there are _no_ headers defined that take \"True\"/\"False\" or any variation thereof as header field values. There are one or two that can conceptually accept \"1\"/\"0\". That makes booleans bad candidates for special casing: we'd be much more likely to special-case datetimes and integers than bools.\n", "It's, you know, none at all! :)\n", "@Lukasa str(value) seems acceptable. No need for special casing anything really. It's what the user is going to be forced to do on their end now anyway.\n", "@jidar str(value) is not acceptable, nor is it what anyone will be forced to do. That may work in your case with your data type, but with many data types it will not work and will lead to us emitting bizarre headers that make no sense. For example, consider datetime objects, which print internal representations when str() is called on them. \n", "@jidar if that's acceptable for you, I'm very happy. You should only ever be treating your headers as strings though. I would not expect any movement on this.\n" ]
https://api.github.com/repos/psf/requests/issues/3490
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3490/labels{/name}
https://api.github.com/repos/psf/requests/issues/3490/comments
https://api.github.com/repos/psf/requests/issues/3490/events
https://github.com/psf/requests/issues/3490
170,236,238
MDU6SXNzdWUxNzAyMzYyMzg=
3,490
Remove header in middle of redirection
{ "avatar_url": "https://avatars.githubusercontent.com/u/1615426?v=4", "events_url": "https://api.github.com/users/saveman71/events{/privacy}", "followers_url": "https://api.github.com/users/saveman71/followers", "following_url": "https://api.github.com/users/saveman71/following{/other_user}", "gists_url": "https://api.github.com/users/saveman71/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/saveman71", "id": 1615426, "login": "saveman71", "node_id": "MDQ6VXNlcjE2MTU0MjY=", "organizations_url": "https://api.github.com/users/saveman71/orgs", "received_events_url": "https://api.github.com/users/saveman71/received_events", "repos_url": "https://api.github.com/users/saveman71/repos", "site_admin": false, "starred_url": "https://api.github.com/users/saveman71/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/saveman71/subscriptions", "type": "User", "url": "https://api.github.com/users/saveman71", "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" }, { "color": "0b02e1", "default": false, "description": null, "id": 191274, "name": "Contributor Friendly", "node_id": "MDU6TGFiZWwxOTEyNzQ=", "url": "https://api.github.com/repos/psf/requests/labels/Contributor%20Friendly" } ]
closed
true
null
[]
null
8
2016-08-09T18:24:05Z
2021-09-08T16:00:30Z
2016-08-12T19:57:40Z
NONE
resolved
Hey there, I'm having a pretty specific issue while trying to reproduce the login sequence of a heavy professional website (lots of redirect / cookies involved). The login sequence was tested working on Chrome. I spent some time debugging and finally tracked down the issue, that is that the server will not accept the `Content-Type` header that was required on the first request on the first redirect, thus making the second request crash with a `500`. First request shown in Chrome's dev inspector: ![screenshot from 2016-08-09 20-03-26](https://cloud.githubusercontent.com/assets/1615426/17528006/dec4dfe6-5e6d-11e6-8e67-9af08aa62426.png) Second request (first redirect) show in Chrome's dev inspector: ![screenshot from 2016-08-09 20-15-02](https://cloud.githubusercontent.com/assets/1615426/17528125/5dee5aea-5e6e-11e6-8030-be6a37f4df0a.png) Notice of how on the second request, no `Content-Type` header. The presence of a `Content-Type` header would make the request fail. The code (URLs are mangled): ``` python #!/usr/bin/env python import requests import urllib.parse headers = { 'Origin': 'https://www.example.com', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.8,fr-FR;q=0.6,fr;q=0.4', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36', 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Cache-Control': 'max-age=0', 'Referer': 'https://www.example.com/', 'Connection': 'keep-alive', } data = 'some_data' s = requests.Session() r = s.post('https://www.exampleonanotherdomain.com/openam/UI/Login?realm=front_office&service=EEService&goto=https://www.exampleonanotherdomain.com/ice/rest/aiguillagemp/redirect?dest=', headers=headers, data=data) ``` I worked it around by removing the `Content-Type` header at runtime on the 3rd send (first is the first request header, 2nd is the first request data) to confirm that it was the issue (it was!) Patch code added before the request. ``` python import http.client as http_client def patch(): old_send = http_client.HTTPConnection.send def new_send( self, data ): print(data.decode('utf-8')) if new_send.i == 2: data = '\n'.join([l for l in data.decode('utf-8').split('\n') if not l.startswith('Content-Type:')]).encode('utf-8') print(data.decode('utf-8')) new_send.i += 1 return old_send(self, data) new_send.i = 0 http_client.HTTPConnection.send = new_send old_read = http_client.HTTPResponse.read def new_read( self , amt): data = old_read(self, amt) print(data) return data http_client.HTTPResponse.read = new_read patch() ``` Any idea of how to solve this one? Note: I have no control at all of the remote server. Note: I intend to make a lot of requests while being logged in, so the I would like to stay with a session.
{ "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/3490/reactions" }
https://api.github.com/repos/psf/requests/issues/3490/timeline
null
completed
null
null
false
[ "Can you run the code with a normal, unchanged Requests, and then once the request is complete run this:\n\n``` python\nfor h in r.history:\n print(h.headers)\nprint(r.headers)\n```\n\nAnd then show us the output?\n", "Oh, sorry.\n\nJust stop setting the header yourself! You should avoid setting the Content-Type, Accept-Encoding, Content-Type, and Accept-Encoding headers in this case, as requests will handle all of those for you.\n", "@Lukasa That was it! I was using the data field preformatted with `urlib.parse.urlencode`, my bad.\nFelt bad when I read 2mn later in the official documentation:\n\n> Requests allows you to send organic, grass-fed HTTP/1.1 requests, without the need for manual labor. \n> \n> There's no need to manually add query strings to your URLs, or to form-encode your POST data.\n\nThank you for your quick and effective answer :+1:\n", "My pleasure!\n", "Hey @Lukasa,\n\nYesterday I tested it rapidly and thought it worked. Today I'm not able to reproduce what worked...\n\n``` python\n#!/usr/bin/env python\n\nimport requests\n\nua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36'\n\nheaders = {\n 'User-Agent': ua,\n}\n\ns = requests.Session()\n\ndata = {\n 'user': '[email protected]',\n 'pass': 'password'\n}\n\ndef patch():\n import http.client as http_client\n old_send = http_client.HTTPConnection.send\n def new_send( self, data ):\n print('=== SEND CALL NB {}'.format(new_send.i))\n print(data.decode('utf-8'))\n if new_send.i == 2:\n data = '\\n'.join([l for l in data.decode('utf-8').split('\\n') if not l.startswith('Content-Type:')]).encode('utf-8')\n print('=== ALTERED DATA')\n print(data.decode('utf-8'))\n print('=== END')\n new_send.i += 1\n return old_send(self, data)\n new_send.i = 0\n http_client.HTTPConnection.send = new_send\n\npatch()\n\nr = s.post('https://www.example.com/openam/UI/Login?realm=front_office&service=EEService&goto=https://www.example.com/ice/rest/aiguillagemp/redirect?dest=',\n headers=headers, data=data)\n```\n\nThe output with the patch commented is:\n\n```\n=== SEND CALL NB 0\nPOST /openam/UI/Login?realm=front_office&service=EEService&goto=https://www.example.com/ice/rest/aiguillagemp/redirect?dest= HTTP/1.1\nHost: www.example.com\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nContent-Length: 168\nContent-Type: application/x-www-form-urlencoded\n\n\n=== END\n=== SEND CALL NB 1\[email protected]&pass=password\n=== END\n=== SEND CALL NB 2\nGET /ice/rest/aiguillagemp/redirect?dest= HTTP/1.1\nHost: www.example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nContent-Type: application/x-www-form-urlencoded\nCookie: AMAuthCookie=somecookie; amlbcookie=01; iPlanetDirectoryPro=somecookie\n\n=== END\n{\"errorId\":\"20160810-16a27d9fb6be5720&#x3a;46364bb9&#x3a;1567196d7d5&#x3a;-3b1b\",\"codeEvt\":\"portail.core.java.ko.runtimeerreur\",\"type\":\"tech\",\"message\":\"Le service est actuellement indisponible, veuillez r&eacute;essayer ult&eacute;rieurement\",\"errorData\":{}}\n```\n\nYou can see that the header `Content-Type` is repeated in the redirect although it was not specified explicitly in the request headers as before.\n\nThe log if I activate the workaround suppressing the header for the specific request:\n\n```\n=== SEND CALL NB 0\nPOST /openam/UI/Login?realm=front_office&service=EEService&goto=https://www.example.com/ice/rest/aiguillagemp/redirect?dest= HTTP/1.1\nHost: www.example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nContent-Length: 168\nContent-Type: application/x-www-form-urlencoded\n\n\n=== END\n=== SEND CALL NB 1\[email protected]&pass=password\n=== END\n=== SEND CALL NB 2\nGET /ice/rest/aiguillagemp/redirect?dest= HTTP/1.1\nHost: www.example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nContent-Type: application/x-www-form-urlencoded\nCookie: AMAuthCookie=somecookie; amlbcookie=01; iPlanetDirectoryPro=somecookie\n\n\n=== ALTERED DATA\nGET /ice/rest/aiguillagemp/redirect?dest= HTTP/1.1\nHost: www.example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nCookie: AMAuthCookie=somecookie; amlbcookie=01; iPlanetDirectoryPro=somecookie\n\n\n=== END\n=== SEND CALL NB 3\nGET /eefo/servlet/login HTTP/1.1\nHost: www.example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nContent-Type: application/x-www-form-urlencoded\nCookie: AMAuthCookie=somecookie; amlbcookie=01; iPlanetDirectoryPro=somecookie; dtCookie=somecookie|somecookie; SITE=Autre; APPSSESSIONID=somecookie; XSRF-TOKEN=gGlv1DzI\n\n\n=== END\n=== SEND CALL NB 4\nGET /eefo/servlet/login?authenticate HTTP/1.1\nHost: www.example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nContent-Type: application/x-www-form-urlencoded\nCookie: AMAuthCookie=somecookie; amlbcookie=01; iPlanetDirectoryPro=somecookie; dtCookie=somecookie|somecookie; SITE=Autre; APPSSESSIONID=somecookie; [email protected]; XSRF-TOKEN=gGlv1DzI; FOCOOKIENAME=somecookie\n\n\n=== END\n=== SEND CALL NB 5\nGET /eefo/appmanager/portail/clients?_nfpb=true&_pageLabel=eefo_page_accueil_membre HTTP/1.1\nHost: www.example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\nAccept: */*\nConnection: keep-alive\nAccept-Encoding: gzip, deflate\nContent-Type: application/x-www-form-urlencoded\nCookie: AMAuthCookie=somecookie; amlbcookie=01; iPlanetDirectoryPro=somecookie; dtCookie=somecookie|somecookie; SITE=Autre; APPSSESSIONID=somecookie; userType=userFO; [email protected]; FOCOOKIENAME=somecookie; XSRF-TOKEN=gGlv1DzI; _WL_AUTHCOOKIE_FOCOOKIENAME=somecookie\n\n\n=== END\n```\n\nSorry for the french in error messages/URLs. I, unfortunately, cannot reveal what is the website responsible for the misbehaviour (NDA).\n\nAm I doing something wrong here?\n", "Hrm, no. It does look like we don't strip the content-type header when we remove the body. We should probably do that. This is a bug.\n", "For any contributor who wants to submit a patch for this, look at `resolve_redirects`, around line 143 of `sessions.py`. We want to do the same for `Content-Type` as we do for `Content-Length`, and probably also for `Transfer Encoding` too. \n", "This was fixed in #3493 \n" ]
https://api.github.com/repos/psf/requests/issues/3489
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3489/labels{/name}
https://api.github.com/repos/psf/requests/issues/3489/comments
https://api.github.com/repos/psf/requests/issues/3489/events
https://github.com/psf/requests/pull/3489
170,234,762
MDExOlB1bGxSZXF1ZXN0ODA2Njg2ODE=
3,489
adding in pickling tests for PreparedRequest
{ "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
3
2016-08-09T18:17:19Z
2021-09-08T02:10:12Z
2016-11-10T17:26:47Z
MEMBER
resolved
This is a continuation of @keyan's work in #2757 and addresses issue #1558 regarding pickling Request objects (specifically `PreparedRequest` objects in this PR). These tests ensure that a standard `PreparedRequest`, a `PreparedRequest` with a file object as the body, and a `PreparedRequest` with hooks defined outside of the `locals` scope will all pickle properly. This also works for data passed to the `json` parameter and I can add my test for that as well if it's deemed helpful. Hooks defined inside of a method (such as in the [original test](https://github.com/kennethreitz/requests/pull/2757/files#diff-56c2d754173a4a158ce8f445834c8fe8R843) by @keyan) will fail because you can't pickle local objects. Is this a use case that needs to be handled?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3489/reactions" }
https://api.github.com/repos/psf/requests/issues/3489/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3489.diff", "html_url": "https://github.com/psf/requests/pull/3489", "merged_at": "2016-11-10T17:26:47Z", "patch_url": "https://github.com/psf/requests/pull/3489.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3489" }
true
[ "@Lukasa any thoughts here? We still have edge cases where if the `data` param is a generator or file-like object, it can't be pickled. Is there any utility in adding this subset of tests, or should #1558 be closed as can't fix?\n", "I have no particular problems with merging this PR, though I'd like to confirm we're on the same page regarding file objects.\n", "Yeah, I think we're on the same page. I'm also not terribly tied to the PR, I started it trying to wrap up #1558 and Keyan's work, since Kenneth felt there was some value in having these tests.\n" ]
https://api.github.com/repos/psf/requests/issues/3488
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3488/labels{/name}
https://api.github.com/repos/psf/requests/issues/3488/comments
https://api.github.com/repos/psf/requests/issues/3488/events
https://github.com/psf/requests/issues/3488
170,207,886
MDU6SXNzdWUxNzAyMDc4ODY=
3,488
requests 2.11.0 raises when header contains leading space
{ "avatar_url": "https://avatars.githubusercontent.com/u/11064524?v=4", "events_url": "https://api.github.com/users/brantlk/events{/privacy}", "followers_url": "https://api.github.com/users/brantlk/followers", "following_url": "https://api.github.com/users/brantlk/following{/other_user}", "gists_url": "https://api.github.com/users/brantlk/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/brantlk", "id": 11064524, "login": "brantlk", "node_id": "MDQ6VXNlcjExMDY0NTI0", "organizations_url": "https://api.github.com/users/brantlk/orgs", "received_events_url": "https://api.github.com/users/brantlk/received_events", "repos_url": "https://api.github.com/users/brantlk/repos", "site_admin": false, "starred_url": "https://api.github.com/users/brantlk/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/brantlk/subscriptions", "type": "User", "url": "https://api.github.com/users/brantlk", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-09T16:11:39Z
2021-09-08T16:00:28Z
2016-08-09T16:16:50Z
NONE
resolved
With the release of requests 2.11.0 we're seeing errors where things were working with requests 2.10.0. The exception that's raised is "Invalid return character or leading space in header". We can work around the problem and make sure we set headers without leading spaces, just making sure that this was the intention to have things that were working with 2.10 stop working with 2.11.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3488/reactions" }
https://api.github.com/repos/psf/requests/issues/3488/timeline
null
completed
null
null
false
[ "Thanks for this!\n\nThis is deliberate. Headers with leading spaces in them are frequently mis-handled by intermediaries and servers. This can lead to attacks or misbehaviour, where any or all of a server, client, and all involved proxies disagree on what headers are actually present. This is called a smuggling attack, and it's not a good thing.\n\nGiven that this misbehaviour exists, and given that it is not really _sensible_ to add extra whitespace to the header field value, Requests has simply decided to forbid it entirely. This was entirely the intention of the change: we're trying to help Requests emit better-formed HTTP data.\n", "ok, thanks for the explanation.\n", "> This is deliberate\n\nheh, awesome\n\nhttps://bugs.launchpad.net/python-swiftclient/+bug/1614280\nhttps://review.openstack.org/#/c/356802/1\n" ]
https://api.github.com/repos/psf/requests/issues/3487
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3487/labels{/name}
https://api.github.com/repos/psf/requests/issues/3487/comments
https://api.github.com/repos/psf/requests/issues/3487/events
https://github.com/psf/requests/pull/3487
170,192,948
MDExOlB1bGxSZXF1ZXN0ODA2Mzk0MjM=
3,487
Update README.rst
{ "avatar_url": "https://avatars.githubusercontent.com/u/6855663?v=4", "events_url": "https://api.github.com/users/drpoggi/events{/privacy}", "followers_url": "https://api.github.com/users/drpoggi/followers", "following_url": "https://api.github.com/users/drpoggi/following{/other_user}", "gists_url": "https://api.github.com/users/drpoggi/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/drpoggi", "id": 6855663, "login": "drpoggi", "node_id": "MDQ6VXNlcjY4NTU2NjM=", "organizations_url": "https://api.github.com/users/drpoggi/orgs", "received_events_url": "https://api.github.com/users/drpoggi/received_events", "repos_url": "https://api.github.com/users/drpoggi/repos", "site_admin": false, "starred_url": "https://api.github.com/users/drpoggi/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/drpoggi/subscriptions", "type": "User", "url": "https://api.github.com/users/drpoggi", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-09T15:15:22Z
2021-09-08T03:00:47Z
2016-08-09T15:40:20Z
CONTRIBUTOR
resolved
To match #3480
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3487/reactions" }
https://api.github.com/repos/psf/requests/issues/3487/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3487.diff", "html_url": "https://github.com/psf/requests/pull/3487", "merged_at": "2016-08-09T15:40:20Z", "patch_url": "https://github.com/psf/requests/pull/3487.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3487" }
true
[ "Thanks @drpoggi!\n" ]
https://api.github.com/repos/psf/requests/issues/3486
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3486/labels{/name}
https://api.github.com/repos/psf/requests/issues/3486/comments
https://api.github.com/repos/psf/requests/issues/3486/events
https://github.com/psf/requests/pull/3486
170,168,427
MDExOlB1bGxSZXF1ZXN0ODA2MjE3MDc=
3,486
reverting 3362
{ "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
3
2016-08-09T13:39:28Z
2021-09-08T02:10:17Z
2016-08-09T13:52:22Z
MEMBER
resolved
This addresses #3481 and will revert #3362 back to its prior state. We'll likely want to reopen #3359 since this will reintroduce the bytes/text issue.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3486/reactions" }
https://api.github.com/repos/psf/requests/issues/3486/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3486.diff", "html_url": "https://github.com/psf/requests/pull/3486", "merged_at": "2016-08-09T13:52:22Z", "patch_url": "https://github.com/psf/requests/pull/3486.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3486" }
true
[ "I'm good with this. How about you @Lukasa? (To be honest, I would have rathered let GitHub generate the revert than have it done artisanally.)\n", "I'm fine with this too.\n", "@sigmavirus24 sorry, I tried the revert button and got an error so did it by hand.\n" ]
https://api.github.com/repos/psf/requests/issues/3485
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3485/labels{/name}
https://api.github.com/repos/psf/requests/issues/3485/comments
https://api.github.com/repos/psf/requests/issues/3485/events
https://github.com/psf/requests/issues/3485
170,139,497
MDU6SXNzdWUxNzAxMzk0OTc=
3,485
ConnectionResetError on some urls
{ "avatar_url": "https://avatars.githubusercontent.com/u/4659834?v=4", "events_url": "https://api.github.com/users/Alexander3/events{/privacy}", "followers_url": "https://api.github.com/users/Alexander3/followers", "following_url": "https://api.github.com/users/Alexander3/following{/other_user}", "gists_url": "https://api.github.com/users/Alexander3/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Alexander3", "id": 4659834, "login": "Alexander3", "node_id": "MDQ6VXNlcjQ2NTk4MzQ=", "organizations_url": "https://api.github.com/users/Alexander3/orgs", "received_events_url": "https://api.github.com/users/Alexander3/received_events", "repos_url": "https://api.github.com/users/Alexander3/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Alexander3/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Alexander3/subscriptions", "type": "User", "url": "https://api.github.com/users/Alexander3", "user_view_type": "public" }
[]
closed
true
null
[]
null
5
2016-08-09T11:05:25Z
2021-09-08T16:00:31Z
2016-08-10T09:20:22Z
NONE
resolved
I'm building Django app for translating english words to polish. I'm trying to make a request to dictionary website. When requesting for url: 'http://pl.bab.la/slownik/angielski-polski/' after few minutes it throws ConnectionResetError, but Wireshark sees 200 OK response less than second after request. The strange thing is that when url is 'http://pl.bab.la/slownik/' it works. ``` url = 'http://pl.bab.la/slownik/angielski-polski/' response = requests.get(url) ``` Using urllib everything works fine. ``` import urllib.request req = urllib.request.Request(url) response = urllib.request.urlopen(req) ``` [See full traceback](https://gist.github.com/Alexander3/6b2fe33fd1b98c31a2008fa98ad6d896) I'm using Python 3.5.1 on Windows 10 64 bit
{ "avatar_url": "https://avatars.githubusercontent.com/u/4659834?v=4", "events_url": "https://api.github.com/users/Alexander3/events{/privacy}", "followers_url": "https://api.github.com/users/Alexander3/followers", "following_url": "https://api.github.com/users/Alexander3/following{/other_user}", "gists_url": "https://api.github.com/users/Alexander3/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Alexander3", "id": 4659834, "login": "Alexander3", "node_id": "MDQ6VXNlcjQ2NTk4MzQ=", "organizations_url": "https://api.github.com/users/Alexander3/orgs", "received_events_url": "https://api.github.com/users/Alexander3/received_events", "repos_url": "https://api.github.com/users/Alexander3/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Alexander3/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Alexander3/subscriptions", "type": "User", "url": "https://api.github.com/users/Alexander3", "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/3485/reactions" }
https://api.github.com/repos/psf/requests/issues/3485/timeline
null
completed
null
null
false
[ "Interestingly, this seems to be a Python 3 bug: I can reproduce this repeatably on Python 3.5.1, but am unable to reproduce it on Python 2.7. Not a Windows bug though: I can reproduce on macOS.\n", "Got it. Revealed, as always, by using `stream=True`. The problem is the headers. The server is sending a _gigantic_ Link header that is UTF-8 encoded:\n\n```\nLink: <http://www.babla.cn/英语-波兰语/>; rel=\"alternate\"; hreflang=\"zh-Hans\", <http://cs.bab.la/slovnik/anglicky-polsky/>; rel=\"alternate\"; hreflang=\"cs\", <http://da.bab.la/ordbog/engelsk-polsk/>; rel=\"alternate\"; hreflang=\"da\", <http://de.bab.la/woerterbuch/englisch-polnisch/>; rel=\"alternate\"; hreflang=\"de\", <http://www.babla.gr/αγγλικα-πολωνικα/>; rel=\"alternate\"; hreflang=\"el\", <http://en.bab.la/dictionary/english-polish/>; rel=\"alternate\"; hreflang=\"en\", <http://eo.bab.la/vortaro/angla-pola/>; rel=\"alternate\"; hreflang=\"eo\", <http://es.bab.la/diccionario/ingles-polaco/>; rel=\"alternate\"; hreflang=\"es\", <http://fi.bab.la/sanakirja/englanti-puola/>; rel=\"alternate\"; hreflang=\"fi\", <http://fr.bab.la/dictionnaire/anglais-polonais/>; rel=\"alternate\"; hreflang=\"fr\", <http://www.babla.in/अंग्रेज़ी-पोलिश/>; rel=\"alternate\"; hreflang=\"hi\", <http://hu.bab.la/szótár/angol-lengyel/>; rel=\"alternate\"; hreflang=\"hu\", <http://www.babla.co.id/bahasa-inggris-bahasa-polandia/>; rel=\"alternate\"; hreflang=\"id\", <http://it.bab.la/dizionario/inglese-polacco/>; rel=\"alternate\"; hreflang=\"it\", <http://ja.bab.la/辞書/英語-ポーランド語/>; rel=\"alternate\"; hreflang=\"ja\", <http://www.babla.kr/영어-폴란드어/>; rel=\"alternate\"; hreflang=\"ko\", <http://nl.bab.la/woordenboek/engels-pools/>; rel=\"alternate\"; hreflang=\"nl\", <http://www.babla.no/engelsk-polsk/>; rel=\"alternate\"; hreflang=\"no\", <http://pl.bab.la/slownik/angielski-polski/>; rel=\"alternate\"; hreflang=\"pl\", <http://pt.bab.la/dicionario/ingles-polones/>; rel=\"alternate\"; hreflang=\"pt\", <http://ro.bab.la/dictionar/engleza-poloneza/>; rel=\"alternate\"; hreflang=\"ro\", <http://www.babla.ru/английский-польский/>; rel=\"alternate\"; hreflang=\"ru\", <http://sv.bab.la/lexikon/engelsk-polsk/>; rel=\"alternate\"; hreflang=\"sv\", <http://sw.bab.la/kamusi/kiingereza-kipolishi/>; rel=\"alternate\"; hreflang=\"sw\", <http://www.babla.co.th/english-polish/>; rel=\"alternate\"; hreflang=\"th\", <http://tr.bab.la/sozluk/ingilizce-lehce/>; rel=\"alternate\"; hreflang=\"tr\", <http://www.babla.vn/tieng-anh-tieng-ba-lan/>; rel=\"alternate\"; hreflang=\"vi\"\n```\n\nThis works fine on Python 2, because it handles all the headers as byte strings. This means it searches for the literal newline byte and parses appropriately. You can see this in the headers dict on Python 2:\n\n``` python\n>>> r = requests.get('http://pl.bab.la/slownik/angielski-polski/', stream=True)\n>>> r.headers\n{'Content-Length': '9774', 'Content-Language': 'pl', 'Content-Encoding': 'gzip', 'Set-Cookie': 'PHPSESSID=4jh22qivih8dl3l3arllsed1j1; path=/; domain=.bab.la, settings=pl.enpl.en.es.0..; expires=Thu, 17-Nov-2016 11:13:03 GMT; path=/; domain=.bab.la', 'Expires': 'Mon, 26 Jul 1997 05:00:00 GMT', 'Vary': 'Accept-Encoding', 'Keep-Alive': 'timeout=5, max=70', 'Server': 'Apache', 'Last-Modified': 'Tue, 09 Aug 2016 11:13:03 GMT', 'Connection': 'Keep-Alive', 'Link': '<http://www.babla.cn/\\xe8\\x8b\\xb1\\xe8\\xaf\\xad-\\xe6\\xb3\\xa2\\xe5\\x85\\xb0\\xe8\\xaf\\xad/>; rel=\"alternate\"; hreflang=\"zh-Hans\", <http://cs.bab.la/slovnik/anglicky-polsky/>; rel=\"alternate\"; hreflang=\"cs\", <http://da.bab.la/ordbog/engelsk-polsk/>; rel=\"alternate\"; hreflang=\"da\", <http://de.bab.la/woerterbuch/englisch-polnisch/>; rel=\"alternate\"; hreflang=\"de\", <http://www.babla.gr/\\xce\\xb1\\xce\\xb3\\xce\\xb3\\xce\\xbb\\xce\\xb9\\xce\\xba\\xce\\xb1-\\xcf\\x80\\xce\\xbf\\xce\\xbb\\xcf\\x89\\xce\\xbd\\xce\\xb9\\xce\\xba\\xce\\xb1/>; rel=\"alternate\"; hreflang=\"el\", <http://en.bab.la/dictionary/english-polish/>; rel=\"alternate\"; hreflang=\"en\", <http://eo.bab.la/vortaro/angla-pola/>; rel=\"alternate\"; hreflang=\"eo\", <http://es.bab.la/diccionario/ingles-polaco/>; rel=\"alternate\"; hreflang=\"es\", <http://fi.bab.la/sanakirja/englanti-puola/>; rel=\"alternate\"; hreflang=\"fi\", <http://fr.bab.la/dictionnaire/anglais-polonais/>; rel=\"alternate\"; hreflang=\"fr\", <http://www.babla.in/\\xe0\\xa4\\x85\\xe0\\xa4\\x82\\xe0\\xa4\\x97\\xe0\\xa5\\x8d\\xe0\\xa4\\xb0\\xe0\\xa5\\x87\\xe0\\xa4\\x9c\\xe0\\xa4\\xbc\\xe0\\xa5\\x80-\\xe0\\xa4\\xaa\\xe0\\xa5\\x8b\\xe0\\xa4\\xb2\\xe0\\xa4\\xbf\\xe0\\xa4\\xb6/>; rel=\"alternate\"; hreflang=\"hi\", <http://hu.bab.la/sz\\xc3\\xb3t\\xc3\\xa1r/angol-lengyel/>; rel=\"alternate\"; hreflang=\"hu\", <http://www.babla.co.id/bahasa-inggris-bahasa-polandia/>; rel=\"alternate\"; hreflang=\"id\", <http://it.bab.la/dizionario/inglese-polacco/>; rel=\"alternate\"; hreflang=\"it\", <http://ja.bab.la/\\xe8\\xbe\\x9e\\xe6\\x9b\\xb8/\\xe8\\x8b\\xb1\\xe8\\xaa\\x9e-\\xe3\\x83\\x9d\\xe3\\x83\\xbc\\xe3\\x83\\xa9\\xe3\\x83\\xb3\\xe3\\x83\\x89\\xe8\\xaa\\x9e/>; rel=\"alternate\"; hreflang=\"ja\", <http://www.babla.kr/\\xec\\x98\\x81\\xec\\x96\\xb4-\\xed\\x8f\\xb4\\xeb\\x9e\\x80\\xeb\\x93\\x9c\\xec\\x96\\xb4/>; rel=\"alternate\"; hreflang=\"ko\", <http://nl.bab.la/woordenboek/engels-pools/>; rel=\"alternate\"; hreflang=\"nl\", <http://www.babla.no/engelsk-polsk/>; rel=\"alternate\"; hreflang=\"no\", <http://pl.bab.la/slownik/angielski-polski/>; rel=\"alternate\"; hreflang=\"pl\", <http://pt.bab.la/dicionario/ingles-polones/>; rel=\"alternate\"; hreflang=\"pt\", <http://ro.bab.la/dictionar/engleza-poloneza/>; rel=\"alternate\"; hreflang=\"ro\", <http://www.babla.ru/\\xd0\\xb0\\xd0\\xbd\\xd0\\xb3\\xd0\\xbb\\xd0\\xb8\\xd0\\xb9\\xd1\\x81\\xd0\\xba\\xd0\\xb8\\xd0\\xb9-\\xd0\\xbf\\xd0\\xbe\\xd0\\xbb\\xd1\\x8c\\xd1\\x81\\xd0\\xba\\xd0\\xb8\\xd0\\xb9/>; rel=\"alternate\"; hreflang=\"ru\", <http://sv.bab.la/lexikon/engelsk-polsk/>; rel=\"alternate\"; hreflang=\"sv\", <http://sw.bab.la/kamusi/kiingereza-kipolishi/>; rel=\"alternate\"; hreflang=\"sw\", <http://www.babla.co.th/english-polish/>; rel=\"alternate\"; hreflang=\"th\", <http://tr.bab.la/sozluk/ingilizce-lehce/>; rel=\"alternate\"; hreflang=\"tr\", <http://www.babla.vn/tieng-anh-tieng-ba-lan/>; rel=\"alternate\"; hreflang=\"vi\"', 'Pragma': 'no-cache', 'Cache-Control': 'no-store,no-cache,must-revalidate, post-check=0,pre-check=0', 'Date': 'Tue, 09 Aug 2016 11:13:03 GMT', 'P3P': 'CP=\"CAO DSP CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT\"', 'Content-Type': 'text/html;charset=UTF-8', 'X-Frame-Options': 'SAMEORIGIN, SAMEORIGIN'}\n```\n\nOn Python 3, `http.client` gets all high-and-mighty about headers and tries to decode the header block _using Latin-1_. That goes totally wrong:\n\n``` python\n>>> r = requests.get('http://pl.bab.la/slownik/angielski-polski/', stream=True)\n>>> r.headers\n{'Pragma': 'no-cache', 'P3P': 'CP=\"CAO DSP CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT\"', 'Expires': 'Mon, 26 Jul 1997 05:00:00 GMT', 'Content-Language': 'pl', 'Link': '<http://www.babla.cn/è\\x8b±è¯\\xad-æ³¢å\\x85', 'Date': 'Tue, 09 Aug 2016 11:12:39 GMT', 'Cache-Control': 'no-store,no-cache,must-revalidate, post-check=0,pre-check=0', 'Server': 'Apache'}\n```\n\nAs you can see, the Link header is truncated. This causes a problem, because it means that all headers _after_ the Link header are simply dropped (or rather, treated as part of the body), and that includes the Content-Length header. Thus, `http.client` falls back on connection-termination framing: that is, it assumes that TCP FIN will mark the end of the body. The server is expecting to try to keep the connection alive, so Requests blocks until the connection is timed out by the server, several minutes later.\n\nNow, the server is definitely misbehaving here: it really _shouldn't_ be sending plain UTF-8 in its header block like this. However, a better HTTP client that wasn't so obsessed with translating things into unicode strings wouldn't have this problem either.\n\nI think this counts as a CPython bug for the moment, I'm afraid: Requests is simply not in a position to replace httplib at the moment. We're working on it, but it's going to take a _long_ time before that happens.\n", "This is now tracked as [Python issue 27716](https://bugs.python.org/issue27716).\n", "Thanks, I've found out that `urllib.request` uses `http.client` too (https://docs.python.org/3/library/http.client.html). Is documentation outdated or `urllib` is doing some magic to overcome this issue?\n", "@Alexander3 urllib.request doesn't connection pool. This means that the remote server closes the connection at the end of the request, which is what httplib was expecting. You can try doing this by setting the `Connection` header value to `close`. This is generally a bad idea, as it's very wasteful, but it may help in this case.\n" ]
https://api.github.com/repos/psf/requests/issues/3484
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3484/labels{/name}
https://api.github.com/repos/psf/requests/issues/3484/comments
https://api.github.com/repos/psf/requests/issues/3484/events
https://github.com/psf/requests/pull/3484
170,135,222
MDExOlB1bGxSZXF1ZXN0ODA1OTgxMjY=
3,484
Document bunch of return types
{ "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
1
2016-08-09T10:40:19Z
2021-09-08T03:00:52Z
2016-08-09T10:42:45Z
CONTRIBUTOR
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3484/reactions" }
https://api.github.com/repos/psf/requests/issues/3484/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3484.diff", "html_url": "https://github.com/psf/requests/pull/3484", "merged_at": "2016-08-09T10:42:45Z", "patch_url": "https://github.com/psf/requests/pull/3484.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3484" }
true
[ "LGTM, thanks! :sparkles: :cake: :sparkles:\n" ]
https://api.github.com/repos/psf/requests/issues/3483
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3483/labels{/name}
https://api.github.com/repos/psf/requests/issues/3483/comments
https://api.github.com/repos/psf/requests/issues/3483/events
https://github.com/psf/requests/issues/3483
170,118,364
MDU6SXNzdWUxNzAxMTgzNjQ=
3,483
Commit 386382b18caab6a3a8a111fa8e24875dca27b0aa is kicking my ass on Python 3
{ "avatar_url": "https://avatars.githubusercontent.com/u/6974884?v=4", "events_url": "https://api.github.com/users/alexntt/events{/privacy}", "followers_url": "https://api.github.com/users/alexntt/followers", "following_url": "https://api.github.com/users/alexntt/following{/other_user}", "gists_url": "https://api.github.com/users/alexntt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/alexntt", "id": 6974884, "login": "alexntt", "node_id": "MDQ6VXNlcjY5NzQ4ODQ=", "organizations_url": "https://api.github.com/users/alexntt/orgs", "received_events_url": "https://api.github.com/users/alexntt/received_events", "repos_url": "https://api.github.com/users/alexntt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/alexntt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/alexntt/subscriptions", "type": "User", "url": "https://api.github.com/users/alexntt", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-08-09T09:14:29Z
2021-09-08T16:00:32Z
2016-08-10T08:15:30Z
NONE
resolved
Hi, Today our automated builds started failing because 2.11.0 was pulled and 386382b18caab6a3a8a111fa8e24875dca27b0aa causes a request's body to be a bytes object in Python 3 but a str in Python 2.7, which is breaking both my code and https://github.com/seanbrant/requests-wsgi-adapter: https://gist.github.com/alexntt/b181b562852c6850a83269b7401d3bef Can this be made a bit more "backwards-compatible"? Cheers, Álex
{ "avatar_url": "https://avatars.githubusercontent.com/u/6974884?v=4", "events_url": "https://api.github.com/users/alexntt/events{/privacy}", "followers_url": "https://api.github.com/users/alexntt/followers", "following_url": "https://api.github.com/users/alexntt/following{/other_user}", "gists_url": "https://api.github.com/users/alexntt/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/alexntt", "id": 6974884, "login": "alexntt", "node_id": "MDQ6VXNlcjY5NzQ4ODQ=", "organizations_url": "https://api.github.com/users/alexntt/orgs", "received_events_url": "https://api.github.com/users/alexntt/received_events", "repos_url": "https://api.github.com/users/alexntt/repos", "site_admin": false, "starred_url": "https://api.github.com/users/alexntt/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/alexntt/subscriptions", "type": "User", "url": "https://api.github.com/users/alexntt", "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/3483/reactions" }
https://api.github.com/repos/psf/requests/issues/3483/timeline
null
completed
null
null
false
[ "Bytes and str are the same type. In fact, bytes aliases to str on Python 2.6. For that reason, it would seem like the code to work around this problem is simple: `if not isinstance(bytes, request.body): request.body.encode('utf-8')`\n\nIndeed, I'd like to point out that this has worked around a bug in requests-wsgi-adapter: specifically, if provided a unicode string containing code points outside U+0000 to U+007F then the content-length would have been incorrect. Because we're now providing bytes to you, this error cannot occur. This change was introduced for exactly this reason.\n", "I've patched the library I depend on and our project so this is no longer an issue, thank you\n" ]
https://api.github.com/repos/psf/requests/issues/3482
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3482/labels{/name}
https://api.github.com/repos/psf/requests/issues/3482/comments
https://api.github.com/repos/psf/requests/issues/3482/events
https://github.com/psf/requests/issues/3482
170,116,898
MDU6SXNzdWUxNzAxMTY4OTg=
3,482
Can't connect to HTTPS URL because the SSL module is not available.
{ "avatar_url": "https://avatars.githubusercontent.com/u/12977724?v=4", "events_url": "https://api.github.com/users/rohitkhatri/events{/privacy}", "followers_url": "https://api.github.com/users/rohitkhatri/followers", "following_url": "https://api.github.com/users/rohitkhatri/following{/other_user}", "gists_url": "https://api.github.com/users/rohitkhatri/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/rohitkhatri", "id": 12977724, "login": "rohitkhatri", "node_id": "MDQ6VXNlcjEyOTc3NzI0", "organizations_url": "https://api.github.com/users/rohitkhatri/orgs", "received_events_url": "https://api.github.com/users/rohitkhatri/received_events", "repos_url": "https://api.github.com/users/rohitkhatri/repos", "site_admin": false, "starred_url": "https://api.github.com/users/rohitkhatri/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/rohitkhatri/subscriptions", "type": "User", "url": "https://api.github.com/users/rohitkhatri", "user_view_type": "public" }
[]
closed
true
null
[]
null
10
2016-08-09T09:07:21Z
2017-03-23T21:30:38Z
2016-08-09T09:13:42Z
NONE
null
If I try to fetch any https url, It throws an error on the server, but when I try it on the local machine, It works. Code: ``` def test(): data = requests.get('https://newsroom.co',verify=False) return data; ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3482/reactions" }
https://api.github.com/repos/psf/requests/issues/3482/timeline
null
completed
null
null
false
[ "@rohitkhatri This is almost certainly a problem with the OpenSSL shipped on your server. You'll likely need to elaborate for us to help you: for example, _what_ error do you see?\n", "@Lukasa You can check this out here http://52.40.67.18/testing\n", "Oh that's easy: the Python on your server was compiled without the SSL module. It will be impossible to make HTTPS requests without the SSL module. You'll need to take this up with whomever built your application environment.\n", "So what do I need to do in order to resolve this issue, any suggestion?\n", "My suggestion is the same as what I said in the last comment: you'll need to contact whomever built your application environment. If you're deploying on something like Google App Engine, you'll need to consult their docs. If you're using something like Docker, you'll need to consider changing your base image.\n", "I'm using amazon ec2 instace with ubuntu 14.04 installed on it.\n", "Where is your Python coming from? Because the Python shipped with Ubuntu 14.04 definitely has the SSL module installed.\n", "@rohitkhatri How did you resolve this? I'm getting the same error?", "and me", "All: you need to contact whomever built your Python install. If it was you, then you need to check the Python documentation because you didn't link against OpenSSL." ]
https://api.github.com/repos/psf/requests/issues/3481
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3481/labels{/name}
https://api.github.com/repos/psf/requests/issues/3481/comments
https://api.github.com/repos/psf/requests/issues/3481/events
https://github.com/psf/requests/issues/3481
170,104,204
MDU6SXNzdWUxNzAxMDQyMDQ=
3,481
Error with decode_unicode=True on streamed response
{ "avatar_url": "https://avatars.githubusercontent.com/u/7469?v=4", "events_url": "https://api.github.com/users/jone/events{/privacy}", "followers_url": "https://api.github.com/users/jone/followers", "following_url": "https://api.github.com/users/jone/following{/other_user}", "gists_url": "https://api.github.com/users/jone/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/jone", "id": 7469, "login": "jone", "node_id": "MDQ6VXNlcjc0Njk=", "organizations_url": "https://api.github.com/users/jone/orgs", "received_events_url": "https://api.github.com/users/jone/received_events", "repos_url": "https://api.github.com/users/jone/repos", "site_admin": false, "starred_url": "https://api.github.com/users/jone/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jone/subscriptions", "type": "User", "url": "https://api.github.com/users/jone", "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
9
2016-08-09T07:58:53Z
2021-09-08T15:00:51Z
2016-09-11T09:11:16Z
NONE
resolved
With `requests==2.11.0` I get `AttributeError: 'NoneType' object has no attribute 'readline'` when trying to use `iter_lines` with `decode_unicode=True` on a streamed response. ``` sh $ ./bin/pip freeze requests==2.11.0 wsgiref==0.1.2 ``` ``` python from contextlib import closing import requests with closing(requests.get('http://httpbin.org/stream/20', stream=True)) as response: for line in response.iter_lines(chunk_size=30, decode_unicode=True): print line ``` ``` python $ ./bin/python case.py Traceback (most recent call last): File "case.py", line 6, in <module> for line in response.iter_lines(chunk_size=30, decode_unicode=True): File "/Users/jone/temp/requests-stream/lib/python2.7/site-packages/requests/models.py", line 720, in iter_lines for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode): File "/Users/jone/temp/requests-stream/lib/python2.7/site-packages/requests/utils.py", line 374, in stream_decode_response_unicode for chunk in iterator: File "/Users/jone/temp/requests-stream/lib/python2.7/site-packages/requests/models.py", line 676, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/Users/jone/temp/requests-stream/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 353, in stream for line in self.read_chunked(amt, decode_content=decode_content): File "/Users/jone/temp/requests-stream/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 521, in read_chunked line = self._fp.fp.readline() AttributeError: 'NoneType' object has no attribute 'readline' ``` When removing either `stream=True` or `decode_unicode=True` the script works well. This issue may be related to #3174.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3481/reactions" }
https://api.github.com/repos/psf/requests/issues/3481/timeline
null
completed
null
null
false
[ "Well this is weird: it's not immediately apparent to me how `decode_unicode` leads to this behaviour.\n", "Aha, got it.\n\n`decode_unicode=True` was enhanced in the last release to perform the same auto-detection of encoding as `text` does for Requests. Unfortunately, that may involve a call to `apparent_encoding`, which streams in the entire request body and attempts to determine the encoding.\n\nThis was done as part of #3362 in an attempt to resolve #3359.\n\nFrankly, this leads me to suspect that perhaps we should revert that change. If `apparent_encoding` is going to read the whole response body then there is genuinely no point in falling back to `apparent_encoding` as part of `iter_*`: any reason to use the method has been totally lost.\n\nI wonder if we should instead revert the fix in #3362, and then do one of the following three things:\n1. Use UTF-8 as an unconditional fallback if no specific encoding is declared.\n2. Raise an exception if no specific encoding is declared.\n3. Allow `decode_unicode` to take an encoding name which is used as a fallback.\n\n@kennethreitz @sigmavirus24?\n", "For you, @jone, at least for the short term I recommend not using `decode_unicode`. It saves relatively little code and probably doesn't really work the way you want it to work anyway.\n", "@Lukasa thanks for looking into it that fast!\nYes, I'm going to decode manually, which is quite an easy change for me. 😉 \n", "I really want to tear out `apparent_encoding` and wish it well on future endeavors because it's nothing but a constant headache for us.\n\nLet's revert #3362 ASAP, release 2.11.1 and take a while to decide on what is the correct behaviour here. I don't like the idea of auto-falling back to UTF-8. I feel like this will cause a spate of more bugs as people find that it is insufficient and want a way to pass in the fallback encoding (which I don't see as an unreasonable request).\n\nI also don't think we can raise an exception until 3.0 if no encoding is specified. That said, I'm _firmly_ against `decode_unicode` taking an encoding name. I'd rather that be a separate parameter, e.g., `encoding`.\n", "I'd like to sit on 2.11.1 until at least tomorrow, to give us another day of bugs coming out of the woodwork.\n", "That's fine. I don't think we need to release it until Monday honestly. We just shouldn't wait to revert #3362.\n", "Not sure if this is relevant to add to this, but previous versions of requests raised `UnicodeDecodeError` but 2.11.0 appears to be raising just a `UnicodeError` when `decode_unicode=True` and the content is not unicode. Is the recommended workaround for this to use requests 2.10.0 until this revert is released?\n", "@maxpowa #3486 reverts this change and should be included in the upcoming 2.11.1 release. As @Lukasa suggested [above](https://github.com/kennethreitz/requests/issues/3481#issuecomment-238489871), it's recommended not to use `decode_unicode=True` for the time being. You can either manually decode the strings as a temporary fix, or continue using 2.10 if your workflow allows it.\n" ]
https://api.github.com/repos/psf/requests/issues/3480
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3480/labels{/name}
https://api.github.com/repos/psf/requests/issues/3480/comments
https://api.github.com/repos/psf/requests/issues/3480/events
https://github.com/psf/requests/pull/3480
170,070,364
MDExOlB1bGxSZXF1ZXN0ODA1NTM4OTk=
3,480
Clarify Python versions supported by requests
{ "avatar_url": "https://avatars.githubusercontent.com/u/6855663?v=4", "events_url": "https://api.github.com/users/drpoggi/events{/privacy}", "followers_url": "https://api.github.com/users/drpoggi/followers", "following_url": "https://api.github.com/users/drpoggi/following{/other_user}", "gists_url": "https://api.github.com/users/drpoggi/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/drpoggi", "id": 6855663, "login": "drpoggi", "node_id": "MDQ6VXNlcjY4NTU2NjM=", "organizations_url": "https://api.github.com/users/drpoggi/orgs", "received_events_url": "https://api.github.com/users/drpoggi/received_events", "repos_url": "https://api.github.com/users/drpoggi/repos", "site_admin": false, "starred_url": "https://api.github.com/users/drpoggi/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/drpoggi/subscriptions", "type": "User", "url": "https://api.github.com/users/drpoggi", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2016-08-09T02:51:05Z
2021-09-08T03:00:53Z
2016-08-09T03:00:55Z
CONTRIBUTOR
resolved
Remove some confusion in the Python versions supported by Requests.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3480/reactions" }
https://api.github.com/repos/psf/requests/issues/3480/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3480.diff", "html_url": "https://github.com/psf/requests/pull/3480", "merged_at": "2016-08-09T03:00:55Z", "patch_url": "https://github.com/psf/requests/pull/3480.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3480" }
true
[ "endashes (–) are appropriate for ranges, not hyphens. \n\nLet's also add \"Requests officially supports\".\n", "en dash, not em dash :)\n\nIt's cool, I'll fix it. \n", "✨🍰✨\n", "@kennethreitz thanks, tried copy pasting your en dash from above. Apparently GitHub's UI wasn't a fan of my methods.\n" ]
https://api.github.com/repos/psf/requests/issues/3479
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3479/labels{/name}
https://api.github.com/repos/psf/requests/issues/3479/comments
https://api.github.com/repos/psf/requests/issues/3479/events
https://github.com/psf/requests/issues/3479
170,039,774
MDU6SXNzdWUxNzAwMzk3NzQ=
3,479
requests v2.11 has a syntax error in python3.2
{ "avatar_url": "https://avatars.githubusercontent.com/u/344587?v=4", "events_url": "https://api.github.com/users/huseyinyilmaz/events{/privacy}", "followers_url": "https://api.github.com/users/huseyinyilmaz/followers", "following_url": "https://api.github.com/users/huseyinyilmaz/following{/other_user}", "gists_url": "https://api.github.com/users/huseyinyilmaz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/huseyinyilmaz", "id": 344587, "login": "huseyinyilmaz", "node_id": "MDQ6VXNlcjM0NDU4Nw==", "organizations_url": "https://api.github.com/users/huseyinyilmaz/orgs", "received_events_url": "https://api.github.com/users/huseyinyilmaz/received_events", "repos_url": "https://api.github.com/users/huseyinyilmaz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/huseyinyilmaz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/huseyinyilmaz/subscriptions", "type": "User", "url": "https://api.github.com/users/huseyinyilmaz", "user_view_type": "public" }
[]
closed
true
null
[]
null
7
2016-08-08T22:21:40Z
2021-09-08T16:00:32Z
2016-08-08T22:51:05Z
NONE
resolved
First of all thanks for the awesome library. I am really enjoying using requests. This is my favorite library. In the last version of requests, I started to get an error on my own library and it turned out it was because of my requests dependency. In python3.2, requests v2.11 gives following error: ``` File "/home/travis/build/huseyinyilmaz/placebo/requests/__init__.py", line 64, in <module> from .models import Request, Response, PreparedRequest File "/home/travis/build/huseyinyilmaz/placebo/requests/models.py", line 856 http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url) ^ SyntaxError: invalid syntax ``` Here is the fix https://github.com/kennethreitz/requests/pull/3478 Again sorry about the crappy way of testing. I could not install python3.2 on my local machine so I could not test it with requests tests.
{ "avatar_url": "https://avatars.githubusercontent.com/u/344587?v=4", "events_url": "https://api.github.com/users/huseyinyilmaz/events{/privacy}", "followers_url": "https://api.github.com/users/huseyinyilmaz/followers", "following_url": "https://api.github.com/users/huseyinyilmaz/following{/other_user}", "gists_url": "https://api.github.com/users/huseyinyilmaz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/huseyinyilmaz", "id": 344587, "login": "huseyinyilmaz", "node_id": "MDQ6VXNlcjM0NDU4Nw==", "organizations_url": "https://api.github.com/users/huseyinyilmaz/orgs", "received_events_url": "https://api.github.com/users/huseyinyilmaz/received_events", "repos_url": "https://api.github.com/users/huseyinyilmaz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/huseyinyilmaz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/huseyinyilmaz/subscriptions", "type": "User", "url": "https://api.github.com/users/huseyinyilmaz", "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/3479/reactions" }
https://api.github.com/repos/psf/requests/issues/3479/timeline
null
completed
null
null
false
[ "Hey @huseyinyilmaz, I think this may have been discussed in #3385 (particularly [here](https://github.com/kennethreitz/requests/pull/3385#discussion_r69560890)). Removing the `u` designation on the string would revert the unicode support added in #3385.\n", "Ah, I see @nateprewitt already chimed in over here.\n", "I see. So, python3.2 is not supported by requests library. Than I will just close the issue and pr.\n\nThanks for the link @nateprewitt .\n", "Hey,\nI just wanted to give some extra feedback. I got this error because when I installed requests with following command:\n\n```\npip install requests\n```\n\nIt installed an unstable version in python 3.2.\nIs it possible to not to release unsupported versions in pypi. So python3.2 would not get any updates but it would always load supported version but old version.\n", "@huseyinyilmaz That is not possible, I'm afraid: you'd need to ask @dstufft to provide tools to do that. It's a nice idea, certainly, although it requires much more formalisation of the trove classifiers system that currently exists.\n", "@huseyinyilmaz I think you're going to have a bad time as more and more projects find it unreasonable to support Python 3.2. There are _very_ few users on that version and it does not even receive security updates. \n", "There are updates being made to PEP 503 that will make it possible. It'll take some time for setuptools/pip/etc to filter out that respects that.\n" ]
https://api.github.com/repos/psf/requests/issues/3478
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3478/labels{/name}
https://api.github.com/repos/psf/requests/issues/3478/comments
https://api.github.com/repos/psf/requests/issues/3478/events
https://github.com/psf/requests/pull/3478
170,038,849
MDExOlB1bGxSZXF1ZXN0ODA1MzE2MjM=
3,478
Fix python3.2 unicode literral error.
{ "avatar_url": "https://avatars.githubusercontent.com/u/344587?v=4", "events_url": "https://api.github.com/users/huseyinyilmaz/events{/privacy}", "followers_url": "https://api.github.com/users/huseyinyilmaz/followers", "following_url": "https://api.github.com/users/huseyinyilmaz/following{/other_user}", "gists_url": "https://api.github.com/users/huseyinyilmaz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/huseyinyilmaz", "id": 344587, "login": "huseyinyilmaz", "node_id": "MDQ6VXNlcjM0NDU4Nw==", "organizations_url": "https://api.github.com/users/huseyinyilmaz/orgs", "received_events_url": "https://api.github.com/users/huseyinyilmaz/received_events", "repos_url": "https://api.github.com/users/huseyinyilmaz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/huseyinyilmaz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/huseyinyilmaz/subscriptions", "type": "User", "url": "https://api.github.com/users/huseyinyilmaz", "user_view_type": "public" }
[]
closed
true
null
[]
null
7
2016-08-08T22:16:27Z
2021-09-08T03:00:53Z
2016-08-08T22:52:49Z
NONE
resolved
This is a specific fix for python3.2. When I install requests version v2.11.0, I get an invalid syntax error. It turns out the reason for that error is because "u" prefix for unicode strings are not allowed in python3.2. So I removed the "u" prefix to fix the issue. To test it ,I moved the request library into my codebase and get syntax error: https://travis-ci.org/huseyinyilmaz/placebo/builds/150770392 Than I fixed the issue and ran my tests again: https://travis-ci.org/huseyinyilmaz/placebo/builds/150770803 I realized that this is not a right way to test this. But I could not install python3.2 on my mac. So I decided to use travis-ci's python version.
{ "avatar_url": "https://avatars.githubusercontent.com/u/344587?v=4", "events_url": "https://api.github.com/users/huseyinyilmaz/events{/privacy}", "followers_url": "https://api.github.com/users/huseyinyilmaz/followers", "following_url": "https://api.github.com/users/huseyinyilmaz/following{/other_user}", "gists_url": "https://api.github.com/users/huseyinyilmaz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/huseyinyilmaz", "id": 344587, "login": "huseyinyilmaz", "node_id": "MDQ6VXNlcjM0NDU4Nw==", "organizations_url": "https://api.github.com/users/huseyinyilmaz/orgs", "received_events_url": "https://api.github.com/users/huseyinyilmaz/received_events", "repos_url": "https://api.github.com/users/huseyinyilmaz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/huseyinyilmaz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/huseyinyilmaz/subscriptions", "type": "User", "url": "https://api.github.com/users/huseyinyilmaz", "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/3478/reactions" }
https://api.github.com/repos/psf/requests/issues/3478/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3478.diff", "html_url": "https://github.com/psf/requests/pull/3478", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3478.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3478" }
true
[ "We have not supported Python 3.2 for ... over a year? I don't think we'll accept this. @kennethreitz, thoughts?\n", "@sigmavirus24 . I did not realize that pyhon3.2 is not supported. Thanks for the explanation. I will close the pr.\n", "I'm running into the same issue, where this totally worked before, and stopped working with today's release. Looked through the changelog but found nothing, should this have been publicized?\n", "```\n File \"/home/travis/virtualenv/python3.2.6/lib/python3.2/site-packages/requests/models.py\", line 856\n http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)\n```\n", "Requests no longer supports Python 3.2. As referenced by @sigmavirus24 this has been the case for ever a year.\n\nIf you view the setup.py for requests it specifies 3.3 and higher, or 2.6 and higher.\n", "The setup.py specifies 3.3 or higher, however the documentation homepage and the PyPi page both say: \n\n> Requests supports Python 2.6 — 3.5, and runs great on PyPy.\n\nThese should be amended for clarity, if you're not looking closely this is a pretty innocent mistake.\n", "I've submitted a PR for this in #3480 \n" ]
https://api.github.com/repos/psf/requests/issues/3477
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3477/labels{/name}
https://api.github.com/repos/psf/requests/issues/3477/comments
https://api.github.com/repos/psf/requests/issues/3477/events
https://github.com/psf/requests/issues/3477
170,028,151
MDU6SXNzdWUxNzAwMjgxNTE=
3,477
Requests 2.11: check_header_validity failed on header with integer value
{ "avatar_url": "https://avatars.githubusercontent.com/u/1050156?v=4", "events_url": "https://api.github.com/users/lmazuel/events{/privacy}", "followers_url": "https://api.github.com/users/lmazuel/followers", "following_url": "https://api.github.com/users/lmazuel/following{/other_user}", "gists_url": "https://api.github.com/users/lmazuel/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/lmazuel", "id": 1050156, "login": "lmazuel", "node_id": "MDQ6VXNlcjEwNTAxNTY=", "organizations_url": "https://api.github.com/users/lmazuel/orgs", "received_events_url": "https://api.github.com/users/lmazuel/received_events", "repos_url": "https://api.github.com/users/lmazuel/repos", "site_admin": false, "starred_url": "https://api.github.com/users/lmazuel/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/lmazuel/subscriptions", "type": "User", "url": "https://api.github.com/users/lmazuel", "user_view_type": "public" }
[]
closed
true
null
[]
null
23
2016-08-08T21:19:07Z
2021-09-08T15:00:44Z
2016-08-08T23:40:55Z
NONE
resolved
Hi, Since requests 2.11, all my calls using requests for my app are broken. After debugging, it seems that this version does not accept header with integer value, like it was before. 2.10: ``` python In [1]: import requests In [2]: requests.get('http://bing.com', headers={'Content-Length': 42}) Out[2]: <Response [200]> ``` 2.11 ``` In [1]: import requests In [2]: requests.get('http://bing.com', headers={'Content-Length': 42}) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) D:\VSProjects\azure-sdk-for-python\env3.5\Lib\site-packages\requests\utils.py in check_header_validity(header) 751 try: --> 752 if not pat.match(value): 753 raise InvalidHeader("Invalid return character or leading space in header: %s" % name) TypeError: expected string or bytes-like object During handling of the above exception, another exception occurred: InvalidHeader Traceback (most recent call last) <ipython-input-2-ae7ec2933e34> in <module>() ----> 1 requests.get('http://bing.com', headers={'Content-Length': 42}) D:\VSProjects\azure-sdk-for-python\env3.5\Lib\site-packages\requests\api.py in get(url, params, **kwargs) 68 69 kwargs.setdefault('allow_redirects', True) ---> 70 return request('get', url, params=params, **kwargs) 71 72 D:\VSProjects\azure-sdk-for-python\env3.5\Lib\site-packages\requests\api.py in request(method, url, **kwargs) 54 # cases, and look like a memory leak in others. 55 with sessions.Session() as session: ---> 56 return session.request(method=method, url=url, **kwargs) 57 58 D:\VSProjects\azure-sdk-for-python\env3.5\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) 455 hooks = hooks, 456 ) --> 457 prep = self.prepare_request(req) 458 459 proxies = proxies or {} D:\VSProjects\azure-sdk-for-python\env3.5\Lib\site-packages\requests\sessions.py in prepare_request(self, request) 388 auth=merge_setting(auth, self.auth), 389 cookies=merged_cookies, --> 390 hooks=merge_hooks(request.hooks, self.hooks), 391 ) 392 return p D:\VSProjects\azure-sdk-for-python\env3.5\Lib\site-packages\requests\models.py in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json) 293 self.prepare_method(method) 294 self.prepare_url(url, params) --> 295 self.prepare_headers(headers) 296 self.prepare_cookies(cookies) 297 self.prepare_body(data, files, json) D:\VSProjects\azure-sdk-for-python\env3.5\Lib\site-packages\requests\models.py in prepare_headers(self, headers) 407 for header in headers.items(): 408 # Raise exception on invalid header value. --> 409 check_header_validity(header) 410 name, value = header 411 self.headers[to_native_string(name)] = value D:\VSProjects\azure-sdk-for-python\env3.5\Lib\site-packages\requests\utils.py in check_header_validity(header) 754 except TypeError: 755 raise InvalidHeader("Header value %s must be of type str or bytes, " --> 756 "not %s" % (value, type(value))) 757 758 InvalidHeader: Header value 42 must be of type str or bytes, not <class 'int'> ``` We define 'Content-Length' in each request. Anyway, using an integer for an header which is semantically an integer makes sense no?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1050156?v=4", "events_url": "https://api.github.com/users/lmazuel/events{/privacy}", "followers_url": "https://api.github.com/users/lmazuel/followers", "following_url": "https://api.github.com/users/lmazuel/following{/other_user}", "gists_url": "https://api.github.com/users/lmazuel/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/lmazuel", "id": 1050156, "login": "lmazuel", "node_id": "MDQ6VXNlcjEwNTAxNTY=", "organizations_url": "https://api.github.com/users/lmazuel/orgs", "received_events_url": "https://api.github.com/users/lmazuel/received_events", "repos_url": "https://api.github.com/users/lmazuel/repos", "site_admin": false, "starred_url": "https://api.github.com/users/lmazuel/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/lmazuel/subscriptions", "type": "User", "url": "https://api.github.com/users/lmazuel", "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/3477/reactions" }
https://api.github.com/repos/psf/requests/issues/3477/timeline
null
completed
null
null
false
[ "Non-strings for header values was never an accepted way to use Requests, sadly, and while it was allowed in prior versions we have since made changes that disallow it. This is primarily because headers are _really_ string-string mappings, but also because the general approach of calling `str` on things that are passed to Requests has a tendency to misbehave in unexpected ways that surprise users.\n\nThe TL;DR of this is: yes, this was done on purpose, and no, we don't think it's a bug.\n", "See also: #865.\n", "Seems like a breaking change for a dot-release, no?\n", "And you didn't describe this huge modification in the ChangeLog :(\n", "This is not a breaking API change — the API is clearly documented as being string-based, throughout the documentation. The fact that you were using it with integers, instead of its intended input, is a bug in your code, not with in this codebase or a change in the API.\n\nAdding a note in the changelog about this non-breaking change may be a good idea. \n", "@clarkbreyman-yammer To be clear, this is a bit of a borderline case. You can see the decision making most recently in #3386 and #3388, but the basic argument is: non-string headers were never _intended_ to work, so the fact that they stopped working is acceptable. In fact, that have previously not worked in the past.\n\n@lmazuel You're right that this got missed from the changelog though, and that's 100% my fault: the breakage here was incidental of our tighter verification of header values, and as a result I didn't see it when I was compiling the changelog. I'd welcome a PR that updates the changelog if you'd like to make one.\n", "And to be clear, all three of us are in agreement on this. The fact that sending an integer there _ever_ worked was purely luck. It used to not work at all and we decided it should never work long ago. We never had anything that _enforced_ that though.\n", "That being said, adding that as a supported feature is potentially a great idea, and would be a welcome API change in my book (if the implementation was made well). However, the current status of things is likely to remain for the extended future. \n", "Added a note in the changelog. \n", "Thanks @kennethreitz.\n", "Ok, thanks for the clarification. I will update my code accordingly.\n@kennethreitz if you could add your note in PyPI too, would be amazing.\n", "@lmazuel on it!\n", "@lmazuel done ✨🍰✨\n", "@lmazuel p.s. thank you for caring :P\n", "I fixed my code, everything else is working great. Thanks for your ultra quick response time!\n", "in the official documentations there is no mention about the major change. It is really misleading.\n", "It's not considered a major change by the Requests team, it's considered a bug fix that fits within the boundaries of the documented library behaviour. \n", "Hey @COLDMOUNT, you can find the documentation [here](http://docs.python-requests.org/en/master/user/quickstart/#custom-headers) in the last paragraph from the quickstart section for custom headers. We also published the change in [HISTORY.rst](https://github.com/kennethreitz/requests/blob/master/HISTORY.rst) for 2.11.0 which is Requests' changelog.\n", "It is better to offer an example of the headers in str type, or how to\ntranslate a headers in dict type to str type, thanks.\n\n2016-09-27 1:30 GMT+08:00 Nate Prewitt [email protected]:\n\n> Hey @COLDMOUNT https://github.com/COLDMOUNT, you can find the\n> documentation here\n> http://docs.python-requests.org/en/master/user/quickstart/#custom-headers\n> in the last paragraph from the quickstart section for custom headers. We\n> also published the change in (HISTORY.rst)[https://github.\n> com/kennethreitz/requests/blob/master/HISTORY.rst] for 2.11.0 which is\n> Requests' changelog.\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/kennethreitz/requests/issues/3477#issuecomment-249638650,\n> or mute the thread\n> https://github.com/notifications/unsubscribe-auth/ARIa89wU7tKL8Br2WWU6lJy8HEbNr72Vks5quAE3gaJpZM4JffFG\n> .\n", "> or how to translate a headers in dict type to str type\n\nWait, what? How were you sending headers before?\n", "Just as the guide on the page --\nhttp://docs.python-requests.org/en/master/user/quickstart/ -- \"If you'd\nlike to add HTTP headers to a request, simply pass in a dict to the headers\n parameter.\" But now dict type is no longer accepted, and what does the str\ntype look like?\n\n2016-09-27 17:51 GMT+08:00 Cory Benfield [email protected]:\n\n> or how to translate a headers in dict type to str type\n> \n> Wait, what? How were you sending headers before?\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/kennethreitz/requests/issues/3477#issuecomment-249819028,\n> or mute the thread\n> https://github.com/notifications/unsubscribe-auth/ARIa8_ZPJmzxH2lWmpTvSJ3PvHE7jlpvks5quOcrgaJpZM4JffFG\n> .\n", "@COLDMOUNT `dict` is _absolutely_ accepted, we haven't changed that at all. What we have changed is that the keys and values of that dict must now be strings. Previously it was possible for them to be a few other types by accident, which has now been resolved. The documentation does not need changing.\n", "Got it, cool! Thanks! :)\n\n2016-09-27 18:23 GMT+08:00 Cory Benfield [email protected]:\n\n> @COLDMOUNT https://github.com/COLDMOUNT dict is _absolutely_ accepted,\n> we haven't changed that at all. What we have changed is that the keys and\n> values of that dict must now be strings. Previously it was possible for\n> them to be a few other types by accident, which has now been resolved. The\n> documentation does not need changing.\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/kennethreitz/requests/issues/3477#issuecomment-249825918,\n> or mute the thread\n> https://github.com/notifications/unsubscribe-auth/ARIa8z0jZ-ovBtvFWl4hTXnkk_kJXobrks5quO6ggaJpZM4JffFG\n> .\n" ]
https://api.github.com/repos/psf/requests/issues/3476
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3476/labels{/name}
https://api.github.com/repos/psf/requests/issues/3476/comments
https://api.github.com/repos/psf/requests/issues/3476/events
https://github.com/psf/requests/issues/3476
169,951,323
MDU6SXNzdWUxNjk5NTEzMjM=
3,476
Can't POST UTF-8 encoded data
{ "avatar_url": "https://avatars.githubusercontent.com/u/732595?v=4", "events_url": "https://api.github.com/users/rasgo-cc/events{/privacy}", "followers_url": "https://api.github.com/users/rasgo-cc/followers", "following_url": "https://api.github.com/users/rasgo-cc/following{/other_user}", "gists_url": "https://api.github.com/users/rasgo-cc/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/rasgo-cc", "id": 732595, "login": "rasgo-cc", "node_id": "MDQ6VXNlcjczMjU5NQ==", "organizations_url": "https://api.github.com/users/rasgo-cc/orgs", "received_events_url": "https://api.github.com/users/rasgo-cc/received_events", "repos_url": "https://api.github.com/users/rasgo-cc/repos", "site_admin": false, "starred_url": "https://api.github.com/users/rasgo-cc/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/rasgo-cc/subscriptions", "type": "User", "url": "https://api.github.com/users/rasgo-cc", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-08-08T15:28:04Z
2021-09-08T16:00:33Z
2016-08-08T15:46:31Z
NONE
resolved
Hi, I'm using Requests to send data to a Firebase database. Data contained in the JSON file is UTF-8 encoded. I'm sending that data as follows: ``` data_to_send = json.dumps(data).encode("utf-8") request_object = self.requests.put(request_ref, headers=headers, data=data_to_send) ``` But this is sent as "latin-1" text no matter what, because the underlying HTTP client library always sends the body's text with that encoding. ``` if isinstance(body, str): # RFC 2616 Section 3.7.1 says that text default has a # default charset of iso-8859-1. body = _encode(body, 'body') ``` This results on weird characters displayed on my website. If instead of: `data_to_send = json.dumps(data).encode("utf-8")` or `data_to_send = json.dumps(data, ensure_ascii=False).encode("utf-8")` I do this: `data_to_send = json.dumps(data, ensure_ascii=False)` Then, HTTP client library throws this error: ``` "client.py", line 1150, in _send_request body = _encode(body, 'body') File "C:\Users\mribeiro\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 161, in _encode (name.title(), data[err.start:err.end], name)) from None UnicodeEncodeError: 'latin-1' codec can't encode character '\u2030' in position 164: Body ('▒') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8. ``` So, how am I supposed to POST UTF-8 encoded data using Requests?
{ "avatar_url": "https://avatars.githubusercontent.com/u/732595?v=4", "events_url": "https://api.github.com/users/rasgo-cc/events{/privacy}", "followers_url": "https://api.github.com/users/rasgo-cc/followers", "following_url": "https://api.github.com/users/rasgo-cc/following{/other_user}", "gists_url": "https://api.github.com/users/rasgo-cc/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/rasgo-cc", "id": 732595, "login": "rasgo-cc", "node_id": "MDQ6VXNlcjczMjU5NQ==", "organizations_url": "https://api.github.com/users/rasgo-cc/orgs", "received_events_url": "https://api.github.com/users/rasgo-cc/received_events", "repos_url": "https://api.github.com/users/rasgo-cc/repos", "site_admin": false, "starred_url": "https://api.github.com/users/rasgo-cc/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/rasgo-cc/subscriptions", "type": "User", "url": "https://api.github.com/users/rasgo-cc", "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/3476/reactions" }
https://api.github.com/repos/psf/requests/issues/3476/timeline
null
completed
null
null
false
[ "@cidadao You'll need to more explicitly state what your actual problem is. Let me address why.\n\nFirstly, you say you want to POST your JSON as UTF-8 encoded data. Why is this needed? By default, the Python JSON library will automatically escape all non-ASCII unicode code points. For example:\n\n``` python\nPython 3.5.1 (default, Dec 14 2015, 09:21:15) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import json\n>>> data = {u'key': u'恒写価時究討昭名会証仕玲予邸庁子等図者'}\n>>> json.dumps(data)\n'{\"key\": \"\\\\u6052\\\\u5199\\\\u4fa1\\\\u6642\\\\u7a76\\\\u8a0e\\\\u662d\\\\u540d\\\\u4f1a\\\\u8a3c\\\\u4ed5\\\\u73b2\\\\u4e88\\\\u90b8\\\\u5e81\\\\u5b50\\\\u7b49\\\\u56f3\\\\u8005\"}\n```\n\nThis code produces the same result on Python 2.7, by the way. I mention this because it doesn't matter if this is encoded in UTF-8 or Latin-1, the exact output will be identical as it uses _only ASCII characters_.\n\nYour next comment is about apparent problems with data encoding. I cannot reproduce this problem:\n\n``` python\n>>> requests.post('http://http2bin.org/post', data=json.dumps(data, ensure_ascii=False).encode('utf-8'))\n<Response [200]>\n```\n\nThis is where I use the same data dictionary as above, containing a whole slew of Chinese characters. Wireshark reveals the posted body as being the byte sequence `7b 22 6b 65 79 22 3a 20 22 e6 81 92 e5 86 99 e4 be a1 e6 99 82 e7 a9 b6 e8 a8 8e e6 98 ad e5 90 8d e4 bc 9a e8 a8 bc e4 bb 95 e7 8e b2 e4 ba 88 e9 82 b8 e5 ba 81 e5 ad 90 e7 ad 89 e5 9b b3 e8 80 85 22 7d`, which decodes via UTF-8 to:\n\n``` python\n>>> my_data = \"7b 22 6b 65 79 22 3a 20 22 e6 81 92 e5 86 99 e4 be a1 e6 99 82 e7 a9 b6 e8 a8 8e e6 98 ad e5 90 8d e4 bc 9a e8 a8 bc e4 bb 95 e7 8e b2 e4 ba 88 e9 82 b8 e5 ba 81 e5 ad 90 e7 ad 89 e5 9b b3 e8 80 85 22 7d\"\n>>> import binascii\n>>> binascii.unhexlify(my_data.replace(' ', '')).decode('utf-8')\n'{\"key\": \"恒写価時究討昭名会証仕玲予邸庁子等図者\"}'\n```\n\nSo I think I need more information. What does your data look like? What do your headers look like? What Python and Requests version are you using?\n", "Thanks for the detailed follow up! It turned out to be much more simple than what I thought and totally my fault.\nMy fault: not explicitly opening the JSON file with `encoding=\"utf-8\"` \n`fd = open(file, \"r\", encoding=\"utf-8\")`\n\nUsing that and sending data with: \n\n```\ndata_to_send = json.dumps(data).encode(\"utf-8\")\nrequest_object = self.requests.put(request_ref, headers=headers, data=data_to_send)\n```\n\nSolved the problem!\n" ]
https://api.github.com/repos/psf/requests/issues/3475
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3475/labels{/name}
https://api.github.com/repos/psf/requests/issues/3475/comments
https://api.github.com/repos/psf/requests/issues/3475/events
https://github.com/psf/requests/pull/3475
169,913,065
MDExOlB1bGxSZXF1ZXN0ODA0NDM4OTM=
3,475
Prepare for 2.11 release.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "user_view_type": "public" }
[]
closed
true
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" }
[ { "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" } ]
null
2
2016-08-08T12:39:59Z
2021-09-08T03:00:54Z
2016-08-08T15:05:02Z
MEMBER
resolved
@kennethreitz, this is all we need from a boring administrative perspective. If you merge this PR, you only need to do three things to release: 1. Update the version number to 2.11. 2. Put the date you do this in the changelog instead of the XX. 3. Push the release. @sigmavirus24 I'm inclined to want to let all currently open PRs remain open rather than try to rush merge any: they can always wait for a 2.11.1 or 2.12 without any risk.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 1, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 1, "url": "https://api.github.com/repos/psf/requests/issues/3475/reactions" }
https://api.github.com/repos/psf/requests/issues/3475/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3475.diff", "html_url": "https://github.com/psf/requests/pull/3475", "merged_at": "2016-08-08T15:05:02Z", "patch_url": "https://github.com/psf/requests/pull/3475.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3475" }
true
[ "> I'm inclined to want to let all currently open PRs remain open rather than try to rush merge any: they can always wait for a 2.11.1 or 2.12 without any risk.\n\nMy opinion has been (for a while now) that release numbers are cheap. I'm on board with this. 👍 :shipit: \n", "Released! ✨🍰✨\n" ]
https://api.github.com/repos/psf/requests/issues/3474
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3474/labels{/name}
https://api.github.com/repos/psf/requests/issues/3474/comments
https://api.github.com/repos/psf/requests/issues/3474/events
https://github.com/psf/requests/issues/3474
169,568,513
MDU6SXNzdWUxNjk1Njg1MTM=
3,474
Is requests.get() will release GIL when it is waiting for response from website?
{ "avatar_url": "https://avatars.githubusercontent.com/u/14327519?v=4", "events_url": "https://api.github.com/users/DonaldDai/events{/privacy}", "followers_url": "https://api.github.com/users/DonaldDai/followers", "following_url": "https://api.github.com/users/DonaldDai/following{/other_user}", "gists_url": "https://api.github.com/users/DonaldDai/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/DonaldDai", "id": 14327519, "login": "DonaldDai", "node_id": "MDQ6VXNlcjE0MzI3NTE5", "organizations_url": "https://api.github.com/users/DonaldDai/orgs", "received_events_url": "https://api.github.com/users/DonaldDai/received_events", "repos_url": "https://api.github.com/users/DonaldDai/repos", "site_admin": false, "starred_url": "https://api.github.com/users/DonaldDai/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/DonaldDai/subscriptions", "type": "User", "url": "https://api.github.com/users/DonaldDai", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-08-05T09:33:15Z
2021-09-08T16:00:34Z
2016-08-05T09:33:50Z
NONE
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3474/reactions" }
https://api.github.com/repos/psf/requests/issues/3474/timeline
null
completed
null
null
false
[ "Yes. Anything that uses sockets in Python will do that.\n", "Thanks\n" ]
https://api.github.com/repos/psf/requests/issues/3473
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3473/labels{/name}
https://api.github.com/repos/psf/requests/issues/3473/comments
https://api.github.com/repos/psf/requests/issues/3473/events
https://github.com/psf/requests/issues/3473
169,520,086
MDU6SXNzdWUxNjk1MjAwODY=
3,473
process is terminated while starting new https protocol
{ "avatar_url": "https://avatars.githubusercontent.com/u/710057?v=4", "events_url": "https://api.github.com/users/truyet/events{/privacy}", "followers_url": "https://api.github.com/users/truyet/followers", "following_url": "https://api.github.com/users/truyet/following{/other_user}", "gists_url": "https://api.github.com/users/truyet/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/truyet", "id": 710057, "login": "truyet", "node_id": "MDQ6VXNlcjcxMDA1Nw==", "organizations_url": "https://api.github.com/users/truyet/orgs", "received_events_url": "https://api.github.com/users/truyet/received_events", "repos_url": "https://api.github.com/users/truyet/repos", "site_admin": false, "starred_url": "https://api.github.com/users/truyet/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/truyet/subscriptions", "type": "User", "url": "https://api.github.com/users/truyet", "user_view_type": "public" }
[ { "color": "fef2c0", "default": false, "description": null, "id": 298537994, "name": "Needs More Information", "node_id": "MDU6TGFiZWwyOTg1Mzc5OTQ=", "url": "https://api.github.com/repos/psf/requests/labels/Needs%20More%20Information" } ]
closed
true
null
[]
null
2
2016-08-05T03:13:17Z
2021-09-08T16:00:34Z
2016-08-05T18:38:49Z
NONE
resolved
I use requests pacakge to call nexmo api with post method: requests.post(url) It has worked well for a month, but after my service is terminated and I check logging throw lastest row: requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): rest.nexmo.com I catched exception but no errors are written to logging.
{ "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/3473/reactions" }
https://api.github.com/repos/psf/requests/issues/3473/timeline
null
completed
null
null
false
[ "That information is nowhere near detailed enough to tell us what happened. You'll need to provide a traceback or something similar.\n", "We can reopen this if and when we get more information.\n" ]
https://api.github.com/repos/psf/requests/issues/3472
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3472/labels{/name}
https://api.github.com/repos/psf/requests/issues/3472/comments
https://api.github.com/repos/psf/requests/issues/3472/events
https://github.com/psf/requests/issues/3472
169,431,276
MDU6SXNzdWUxNjk0MzEyNzY=
3,472
post with unicode data and the post body will be truncated!!!
{ "avatar_url": "https://avatars.githubusercontent.com/u/1853121?v=4", "events_url": "https://api.github.com/users/ifooth/events{/privacy}", "followers_url": "https://api.github.com/users/ifooth/followers", "following_url": "https://api.github.com/users/ifooth/following{/other_user}", "gists_url": "https://api.github.com/users/ifooth/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ifooth", "id": 1853121, "login": "ifooth", "node_id": "MDQ6VXNlcjE4NTMxMjE=", "organizations_url": "https://api.github.com/users/ifooth/orgs", "received_events_url": "https://api.github.com/users/ifooth/received_events", "repos_url": "https://api.github.com/users/ifooth/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ifooth/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ifooth/subscriptions", "type": "User", "url": "https://api.github.com/users/ifooth", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-08-04T17:37:34Z
2021-09-08T16:00:38Z
2016-08-05T07:44:26Z
NONE
resolved
when i use requests post data with unicode, and the content-length will be wrong, and the post data will be truncated, test with requests 2.10.0 test code --- ``` # -*- coding: utf-8 -* import json import requests # use utf-8 import sys reload(sys) sys.setdefaultencoding('utf-8') data = json.dumps({'test': u"测试"}, ensure_ascii=False) print data resp = requests.post('https://github.com/kennethreitz/requests/issues', data=data, verify=False) ``` fiddler snapshot --- ![u](https://cloud.githubusercontent.com/assets/1853121/17411410/052ec118-5aab-11e6-9486-ab29fd6a7a9e.png) reason --- ``` data = json.dumps({'test': u"测试"}, ensure_ascii=False) the unicode length: len(data) = 14 the utf-8 chars length len(data.encode('utf-8')) = 18 encode with utf-8 but the content-length not change, so, the post body is truncated data data.encode('utf-8')[:len(data)] = {"test": "测 ``` is it a bug? need help
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3472/reactions" }
https://api.github.com/repos/psf/requests/issues/3472/timeline
null
completed
null
null
false
[ "Why are you passing `ensure_ascii=False`?\n", "Anyway, that's kind of neither here nor there. There are several solutions to your problem:\n1. Don't use `ensure_ascii=False`. There's no requirement to do it: JSON allows unicode escape characters.\n2. Alternatively, don't pass Requests a unicode string in `data`. This kind of works in Python 2, but I wish it didn't: it makes no sense. Encode it yourself using `utf-8`.\n3. Just defer all of this decision making and use `requests.post(url, json={'test': u\"测试\"})`.\n" ]
https://api.github.com/repos/psf/requests/issues/3471
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3471/labels{/name}
https://api.github.com/repos/psf/requests/issues/3471/comments
https://api.github.com/repos/psf/requests/issues/3471/events
https://github.com/psf/requests/issues/3471
169,337,922
MDU6SXNzdWUxNjkzMzc5MjI=
3,471
OverflowError: requested number of bytes is more than a Python string can hold
{ "avatar_url": "https://avatars.githubusercontent.com/u/985461?v=4", "events_url": "https://api.github.com/users/mopuru-murali/events{/privacy}", "followers_url": "https://api.github.com/users/mopuru-murali/followers", "following_url": "https://api.github.com/users/mopuru-murali/following{/other_user}", "gists_url": "https://api.github.com/users/mopuru-murali/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/mopuru-murali", "id": 985461, "login": "mopuru-murali", "node_id": "MDQ6VXNlcjk4NTQ2MQ==", "organizations_url": "https://api.github.com/users/mopuru-murali/orgs", "received_events_url": "https://api.github.com/users/mopuru-murali/received_events", "repos_url": "https://api.github.com/users/mopuru-murali/repos", "site_admin": false, "starred_url": "https://api.github.com/users/mopuru-murali/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mopuru-murali/subscriptions", "type": "User", "url": "https://api.github.com/users/mopuru-murali", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2016-08-04T10:02:49Z
2021-09-08T16:00:39Z
2016-08-04T10:07:20Z
NONE
resolved
I'm facing some weird problem. I'm not able to post ~3GB (more than 2GB) file using requests > 0.7.4 module because of getting following err. File "/build/toolchain/noarch/requests-2.5.3/lib/python2.6/site-packages/requests/api.py", line 83, in post return request('post', url, data=data, *_kwargs) File "/build/toolchain/noarch/requests-2.5.3/lib/python2.6/site-packages/requests/api.py", line 38, in request return s.request(method=method, url=url, *_kwargs) File "/build/toolchain/noarch/requests-2.5.3/lib/python2.6/site-packages/requests/sessions.py", line 200, in request r.send(prefetch=prefetch) File "/build/toolchain/noarch/requests-2.5.3/lib/python2.6/site-packages/requests/models.py", line 387, in send fields.update({k: (fn, fp.read())}) OverflowError: requested number of bytes is more than a Python string can hold But, with requests<=0.7.4 its working fine. No problem of OverflowError. So, I was wondering why it started throwing OverflowError in latest version of requests module (or from requests > 0.7.4)? I tested this with python2.6 and python2.7. PS: I know that instead of posting huge file at once, we can post same file via file chunks. But, I do not want chucks way.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3471/reactions" }
https://api.github.com/repos/psf/requests/issues/3471/timeline
null
completed
null
null
false
[ "The problem here is that you're sending the file using a multipart file upload. For requests, this causes us to read in the entire file in order to build the body.\n\nYou can resolve this by either not using multipart file uploads (if that's possible), or else by using the [streaming multipart data encoder](https://toolbelt.readthedocs.io/en/latest/uploading-data.html#streaming-multipart-data-encoder) from the Requests toolbelt.\n", "Are you saying requests<=0.7.4 handles multipart file uploads well by default?\nBut, I dont think this below code uses multipart format\n\n1501 res = requests.post(\n1502 server_url,\n1503 files={\n1504 'package': open(package, 'rb')},\n1505 data={\n1506 'md5sum': md5sum,\n1507 'length_in_bytes': packagelen\n1508 })\n\nMay I know is it save using requests<=0.7.4 for file uploads?\n", "> Are you saying requests<=0.7.4 handles multipart file uploads well by default?\n\nNo. That is not what @Lukasa is saying.\n\n> But, I dont think this below code uses multipart format\n\nYou're using the files parameter, so yes, it is sending a multipart message.\n\nIf you describe what you want the body to look like, we _might_ be able to help you, but you should be using [StackOverflow](stackoverflow.com) for help with this module, not the defect tracker.\n", "> May I know is it save using requests<=0.7.4 for file uploads?\n\nIt is extremely _unsafe_ to use such an old version of Requests, for any purpose.\n" ]
https://api.github.com/repos/psf/requests/issues/3470
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3470/labels{/name}
https://api.github.com/repos/psf/requests/issues/3470/comments
https://api.github.com/repos/psf/requests/issues/3470/events
https://github.com/psf/requests/issues/3470
169,295,932
MDU6SXNzdWUxNjkyOTU5MzI=
3,470
Add option to specify custom DNS resolver
{ "avatar_url": "https://avatars.githubusercontent.com/u/943001?v=4", "events_url": "https://api.github.com/users/yeukhon/events{/privacy}", "followers_url": "https://api.github.com/users/yeukhon/followers", "following_url": "https://api.github.com/users/yeukhon/following{/other_user}", "gists_url": "https://api.github.com/users/yeukhon/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/yeukhon", "id": 943001, "login": "yeukhon", "node_id": "MDQ6VXNlcjk0MzAwMQ==", "organizations_url": "https://api.github.com/users/yeukhon/orgs", "received_events_url": "https://api.github.com/users/yeukhon/received_events", "repos_url": "https://api.github.com/users/yeukhon/repos", "site_admin": false, "starred_url": "https://api.github.com/users/yeukhon/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/yeukhon/subscriptions", "type": "User", "url": "https://api.github.com/users/yeukhon", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-04T05:45:25Z
2021-09-08T16:00:39Z
2016-08-04T07:07:08Z
NONE
resolved
My services are running on AWS with some of the applications being external. We would run Nagios check to make sure web applications are still accessible (internally and externally). One challenge I have is to run the check as an external user because our Nagios server is in the VPC so the check is performed over the internal VPC network. There are many ways to solve my problem, for example recompile libcurl to support resolver option, or run my nagios in another VPC without any knowledge of my external applications, or adopt a proxy server. However, I found http://stackoverflow.com/questions/22609385/python-requests-library-define-specific-dns. As a Python programmer I like to stick with Python if requests could offer this out of the box. Is anyone interested and willing to accept an option in requests to specify custom DNS resolver?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3470/reactions" }
https://api.github.com/repos/psf/requests/issues/3470/timeline
null
completed
null
null
false
[ "Thanks for this request!\n\nRequests is certainly not going to take a patch use use a custom DNS resolver, partly because we don't want to add flags and options for such low-level functionality, and partly because that functionality is owned entirely by the urllib3 library, which we don't carry patches for.\n\nHowever, this is the kind of thing that urllib3 would be willing to accept in some form, I suspect, so I recommend you open an issue on that repository.\n\nThanks again for reaching out!\n", "@Lukasa are you saying if urllib3 is updated, then requests could be in the position of having this option?\n", "No, I'm saying that if urllib3 is updated you can write a [transport adapter](http://docs.python-requests.org/en/master/user/advanced/#transport-adapters) that uses it.\n" ]
https://api.github.com/repos/psf/requests/issues/3469
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3469/labels{/name}
https://api.github.com/repos/psf/requests/issues/3469/comments
https://api.github.com/repos/psf/requests/issues/3469/events
https://github.com/psf/requests/pull/3469
169,220,944
MDExOlB1bGxSZXF1ZXN0Nzk5NjkzOTU=
3,469
Add a bit about RequestsCookieJar to Cookies section
{ "avatar_url": "https://avatars.githubusercontent.com/u/16552531?v=4", "events_url": "https://api.github.com/users/roselma/events{/privacy}", "followers_url": "https://api.github.com/users/roselma/followers", "following_url": "https://api.github.com/users/roselma/following{/other_user}", "gists_url": "https://api.github.com/users/roselma/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/roselma", "id": 16552531, "login": "roselma", "node_id": "MDQ6VXNlcjE2NTUyNTMx", "organizations_url": "https://api.github.com/users/roselma/orgs", "received_events_url": "https://api.github.com/users/roselma/received_events", "repos_url": "https://api.github.com/users/roselma/repos", "site_admin": false, "starred_url": "https://api.github.com/users/roselma/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/roselma/subscriptions", "type": "User", "url": "https://api.github.com/users/roselma", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-03T20:03:50Z
2021-09-08T03:00:55Z
2016-08-03T20:04:58Z
NONE
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3469/reactions" }
https://api.github.com/repos/psf/requests/issues/3469/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3469.diff", "html_url": "https://github.com/psf/requests/pull/3469", "merged_at": "2016-08-03T20:04:58Z", "patch_url": "https://github.com/psf/requests/pull/3469.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3469" }
true
[ "Woop, woop, thanks @roselma! :sparkles: :cake: :sparkles:\n" ]
https://api.github.com/repos/psf/requests/issues/3468
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3468/labels{/name}
https://api.github.com/repos/psf/requests/issues/3468/comments
https://api.github.com/repos/psf/requests/issues/3468/events
https://github.com/psf/requests/issues/3468
169,011,590
MDU6SXNzdWUxNjkwMTE1OTA=
3,468
Secure proxies are not supported
{ "avatar_url": "https://avatars.githubusercontent.com/u/7513068?v=4", "events_url": "https://api.github.com/users/dessant/events{/privacy}", "followers_url": "https://api.github.com/users/dessant/followers", "following_url": "https://api.github.com/users/dessant/following{/other_user}", "gists_url": "https://api.github.com/users/dessant/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dessant", "id": 7513068, "login": "dessant", "node_id": "MDQ6VXNlcjc1MTMwNjg=", "organizations_url": "https://api.github.com/users/dessant/orgs", "received_events_url": "https://api.github.com/users/dessant/received_events", "repos_url": "https://api.github.com/users/dessant/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dessant/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dessant/subscriptions", "type": "User", "url": "https://api.github.com/users/dessant", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-02T23:19:21Z
2021-09-08T16:00:33Z
2016-08-05T07:44:33Z
NONE
resolved
Requests using [secure web proxies](https://www.chromium.org/developers/design-documents/secure-web-proxy) are failing. You can fetch a new proxy and credentials with [oprah-proxy](https://github.com/spaze/oprah-proxy) for testing. ``` python import requests proxy = '' port = 8000 user = '' passw = '' proxies = { 'https': 'https://{}:{}@{}:{}/'.format(user, passw, proxy, port), } requests.get('https://httpbin.org/get', proxies=proxies) ``` ``` python Traceback (most recent call last): File "C:\Python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 572, in urlopen self._prepare_proxy(conn) File "C:\Python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 780, in _prepare_proxy conn.connect() File "C:\Python34\lib\site-packages\requests\packages\urllib3\connection.py", line 267, in connect self._tunnel() File "C:\Python34\lib\http\client.py", line 852, in _tunnel (version, code, message) = response._read_status() File "C:\Python34\lib\http\client.py", line 368, in _read_status raise BadStatusLine(line) http.client.BadStatusLine:  During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python34\lib\site-packages\requests\adapters.py", line 403, in send timeout=timeout File "C:\Python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 623, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Python34\lib\site-packages\requests\packages\urllib3\util\retry.py", line 255, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Python34\lib\site-packages\requests\packages\urllib3\packages\six.py", line 309, in reraise raise value.with_traceback(tb) File "C:\Python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 572, in urlopen self._prepare_proxy(conn) File "C:\Python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 780, in _prepare_proxy conn.connect() File "C:\Python34\lib\site-packages\requests\packages\urllib3\connection.py", line 267, in connect self._tunnel() File "C:\Python34\lib\http\client.py", line 852, in _tunnel (version, code, message) = response._read_status() File "C:\Python34\lib\http\client.py", line 368, in _read_status raise BadStatusLine(line) requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine('\x15\x03\x01\x00\x02\x02\x16',)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\test.py", line 13, in <module> requests.get('https://httpbin.org/get', proxies=proxies) File "C:\Python34\lib\site-packages\requests\api.py", line 71, in get return request('get', url, params=params, **kwargs) File "C:\Python34\lib\site-packages\requests\api.py", line 57, in request return session.request(method=method, url=url, **kwargs) File "C:\Python34\lib\site-packages\requests\sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "C:\Python34\lib\site-packages\requests\sessions.py", line 585, in send r = adapter.send(request, **kwargs) File "C:\Python34\lib\site-packages\requests\adapters.py", line 453, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('\x15\x03\x01\x00\x02\x02\x16',)) ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3468/reactions" }
https://api.github.com/repos/psf/requests/issues/3468/timeline
null
completed
null
null
false
[ "Requests does not support secure web proxies at this time, I'm afraid, and there is no plan to do so in the immediate future.\n" ]
https://api.github.com/repos/psf/requests/issues/3467
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3467/labels{/name}
https://api.github.com/repos/psf/requests/issues/3467/comments
https://api.github.com/repos/psf/requests/issues/3467/events
https://github.com/psf/requests/issues/3467
168,891,951
MDU6SXNzdWUxNjg4OTE5NTE=
3,467
cannot pass realm parameter to HTTPDigestAuth
{ "avatar_url": "https://avatars.githubusercontent.com/u/19496917?v=4", "events_url": "https://api.github.com/users/alex-movila/events{/privacy}", "followers_url": "https://api.github.com/users/alex-movila/followers", "following_url": "https://api.github.com/users/alex-movila/following{/other_user}", "gists_url": "https://api.github.com/users/alex-movila/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/alex-movila", "id": 19496917, "login": "alex-movila", "node_id": "MDQ6VXNlcjE5NDk2OTE3", "organizations_url": "https://api.github.com/users/alex-movila/orgs", "received_events_url": "https://api.github.com/users/alex-movila/received_events", "repos_url": "https://api.github.com/users/alex-movila/repos", "site_admin": false, "starred_url": "https://api.github.com/users/alex-movila/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/alex-movila/subscriptions", "type": "User", "url": "https://api.github.com/users/alex-movila", "user_view_type": "public" }
[ { "color": "fef2c0", "default": false, "description": null, "id": 298537994, "name": "Needs More Information", "node_id": "MDU6TGFiZWwyOTg1Mzc5OTQ=", "url": "https://api.github.com/repos/psf/requests/labels/Needs%20More%20Information" } ]
closed
true
null
[]
null
14
2016-08-02T13:57:49Z
2021-09-08T15:00:55Z
2016-09-05T23:59:48Z
NONE
resolved
I need to specify a custom realm parameter for HTTPDigestAuth. It does not seems to be supported.
{ "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/3467/reactions" }
https://api.github.com/repos/psf/requests/issues/3467/timeline
null
completed
null
null
false
[ "When you say you \"need to specify a custom realm parameter\", what do you believe that parameter will do? The realm is provided by the remote host in the auth challenge.\n", "I get auth failed if I do not specify it. Besides urllib2 allows to pass this parameter.\n", "urllib2 allows you to pass it because it associates a specific realm with a given username/password tuple, such that it will only respond for challenges using that specific realm. Requests has a simpler Digest Auth model which does not have realm-specific passwords.\n\nWhen you say you get auth failed, I'm going to need some more information. What does your code look like for Requests, and what does it look like for urllib2?\n", "The management interface of Wildfly Jboss is exposed via http/JSON. Basically it requires to pass realm = 'ManagementRealm' to Digest Auth otherwise I cannot login as a superuser and get 401. \n\nThe code looks like this:\n\nurl = 'http://{host}:{port}/management/host/{host}/server/{server}/core-service/platform-mbean/type/garbage-collector/name/G1_Young_Generation?include-runtime=true'\nusername = 'admin'\npassword = 'password'\nrealm = 'ManagementRealm'\n\npassman = urllib2.HTTPPasswordMgr() # this creates a password manager\npassman.add_password( realm, url, username, password)\nauth = urllib2.HTTPDigestAuthHandler( passman)\nurlopener = urllib2.build_opener( auth)\nrequest = urllib2.Request(url)\nresponse = urlopener.open(request).read()\nd = json.loads( response)\npprint.pprint( d)\n", "What's your equivalent requests code, please?\n", "import requests\nfrom requests.auth import HTTPDigestAuth\nr = requests.get(url, auth = HTTPDigestAuth('admin', 'password'))\nr.request.headers\nr.status_code\nr.headers['content-type']\npprint.pprint(r.json())\n", "I assume your passwords here are replacements, and not the actual password? Because they aren't the same.\n\nWhat does r.history contain?\n", "r.history contains: <html><head><title>Error</title></head><body>401 - Unauthorized</body></html>\nuser/password are real but I don't know if they're the defaults after installation\n", "Ok, can you please print: `r.history[0].headers` please? I'm interested to see what the challenge is.\n", "BTW, if the username and password are real, why are they different in each example?\n", "ok fixed now\n", "{'Date': 'Wed, 03 Aug 2016 11:27:31 GMT', 'Content-Type': 'text/html', 'Connection': 'keep-alive', 'Content-Length': '77', 'WWW-Authenticate': 'Digest realm=\"ManagementRealm\",domain=\"/management\",nonce=\"v4CCqEhQR2wNMTQ3MDIyMzY1MTEwMoryoyih0IMIqIg2nq4ZP2M=\",opaque=\"00000000000000000000000000000000\",algorithm=MD5'}\n", "So as you can see, the realm is ManagementRealm in the challenge. So at best the realm portion of this is a red herring. We're using the same realm as urllib2 is. The problem has to be elsewhere.\n", "I'm closing this due to about a month of inactivity. If you can provide more information @alextorex0 such that we can continue debugging this, we will happily reopen this.\n" ]
https://api.github.com/repos/psf/requests/issues/3466
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3466/labels{/name}
https://api.github.com/repos/psf/requests/issues/3466/comments
https://api.github.com/repos/psf/requests/issues/3466/events
https://github.com/psf/requests/issues/3466
168,647,336
MDU6SXNzdWUxNjg2NDczMzY=
3,466
Replacing HTTP Content-Length header
{ "avatar_url": "https://avatars.githubusercontent.com/u/10746711?v=4", "events_url": "https://api.github.com/users/noadmin/events{/privacy}", "followers_url": "https://api.github.com/users/noadmin/followers", "following_url": "https://api.github.com/users/noadmin/following{/other_user}", "gists_url": "https://api.github.com/users/noadmin/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/noadmin", "id": 10746711, "login": "noadmin", "node_id": "MDQ6VXNlcjEwNzQ2NzEx", "organizations_url": "https://api.github.com/users/noadmin/orgs", "received_events_url": "https://api.github.com/users/noadmin/received_events", "repos_url": "https://api.github.com/users/noadmin/repos", "site_admin": false, "starred_url": "https://api.github.com/users/noadmin/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/noadmin/subscriptions", "type": "User", "url": "https://api.github.com/users/noadmin", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-08-01T13:36:03Z
2021-09-08T16:00:41Z
2016-08-01T13:37:43Z
NONE
resolved
Good day, We use your lib for testing S3 protocol, and found minor issue with HTTP headers: some of header parameters, such as Content-Length, were override by sessions.prepare_request() is it possible to add logic not to do this (smth like if request.headers['Content-Length']: p.headers['Content-Length'] = request.headers['Content-Length']) if header value is provided. Thank You
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3466/reactions" }
https://api.github.com/repos/psf/requests/issues/3466/timeline
null
completed
null
null
false
[ "You can change these values by using the [`PreparedRequest` flow](http://docs.python-requests.org/en/master/user/advanced/#prepared-requests), which allow you to either skip the Session preparation step or to change the request after it has been prepared by the Session.\n\n_However_, I strongly recommend that you do not change the Content-Length: Requests has almost certainly got it right, and if you change it to a different value you are likely to break the connection.\n" ]
https://api.github.com/repos/psf/requests/issues/3465
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3465/labels{/name}
https://api.github.com/repos/psf/requests/issues/3465/comments
https://api.github.com/repos/psf/requests/issues/3465/events
https://github.com/psf/requests/issues/3465
168,631,950
MDU6SXNzdWUxNjg2MzE5NTA=
3,465
Recieving 400 Bad Request on GET-request
{ "avatar_url": "https://avatars.githubusercontent.com/u/17240507?v=4", "events_url": "https://api.github.com/users/abriginets/events{/privacy}", "followers_url": "https://api.github.com/users/abriginets/followers", "following_url": "https://api.github.com/users/abriginets/following{/other_user}", "gists_url": "https://api.github.com/users/abriginets/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/abriginets", "id": 17240507, "login": "abriginets", "node_id": "MDQ6VXNlcjE3MjQwNTA3", "organizations_url": "https://api.github.com/users/abriginets/orgs", "received_events_url": "https://api.github.com/users/abriginets/received_events", "repos_url": "https://api.github.com/users/abriginets/repos", "site_admin": false, "starred_url": "https://api.github.com/users/abriginets/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/abriginets/subscriptions", "type": "User", "url": "https://api.github.com/users/abriginets", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-08-01T12:14:42Z
2021-09-08T16:00:41Z
2016-08-01T12:35:24Z
NONE
resolved
Hi. I've wrote a code, but i'm getting an error **400 Bad Request**, when sending a GET-request. What i did wrong? `{'Host': 'http://keddr.com', 'Keep-Alive': 112, 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8) Gecko/20100223 Firefox/3.5.8 Lunascape/6.1.0.20940 ( .NET CLR 3.5.30729)', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Connection': 'keep-alive', 'Referer': 'http://grandsultansaloon.com/plugins/system/plugin_googlemap2_proxy.php?url=EQZMME', 'Cache-Control': 'no-cache'} <Response [400]> ` Here goes my Python code: ``` python def httprequest(): url = sys.argv[1] payload = {buildblock(random.randint(50,100)): buildblock(random.randint(50,100))} headers = {'User-Agent': random.choice(ua), 'Cache-Control': 'no-cache', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Referer': random.choice(ref)+buildblock(random.randint(3,10)), 'Keep-Alive': random.randint(110,120), 'Connection': 'keep-alive', 'Host': url} r = requests.get(url, params=payload, headers=headers) print(headers) print(r) ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3465/reactions" }
https://api.github.com/repos/psf/requests/issues/3465/timeline
null
completed
null
null
false
[ "Well, as a first point your Host header is wrong. Please remove both Host, Header, and Keep-Alive from your header dictionary: Requests will manage those appropriately by itself and will simply ignore anything you set.\n", "Thanks, it helped. And if i'm sending my request, for example, to _example.org_, then in _Host_ header would be a site address? And how can i see all headers my request send?\n", "@JamesJGoodwin We will populate the Host header for you, don't worry about it. It will always include the host portion of whatever URL you use: if you send to http://example.org, Host will be \"example.org\".\n\nTo see your headers, you can look for `r.request.headers`. That does not show _all_ headers: some automatically added headers (e.g. `Host`) are not provided in that dictionary because the layers below Requests add them. \n" ]
https://api.github.com/repos/psf/requests/issues/3464
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3464/labels{/name}
https://api.github.com/repos/psf/requests/issues/3464/comments
https://api.github.com/repos/psf/requests/issues/3464/events
https://github.com/psf/requests/issues/3464
168,564,523
MDU6SXNzdWUxNjg1NjQ1MjM=
3,464
python -m requests
{ "avatar_url": "https://avatars.githubusercontent.com/u/716529?v=4", "events_url": "https://api.github.com/users/glyph/events{/privacy}", "followers_url": "https://api.github.com/users/glyph/followers", "following_url": "https://api.github.com/users/glyph/following{/other_user}", "gists_url": "https://api.github.com/users/glyph/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/glyph", "id": 716529, "login": "glyph", "node_id": "MDQ6VXNlcjcxNjUyOQ==", "organizations_url": "https://api.github.com/users/glyph/orgs", "received_events_url": "https://api.github.com/users/glyph/received_events", "repos_url": "https://api.github.com/users/glyph/repos", "site_admin": false, "starred_url": "https://api.github.com/users/glyph/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/glyph/subscriptions", "type": "User", "url": "https://api.github.com/users/glyph", "user_view_type": "public" }
[]
closed
true
null
[]
null
6
2016-08-01T04:33:30Z
2021-09-08T16:00:41Z
2016-08-01T04:35:36Z
NONE
resolved
Often when I'm debugging some HTTP thing, I poke at with `curl`. But of course in many cases when I interact with it for real, I am going to be talking to it with `requests`. Sometimes - especially in the case of weird SSL debugging - `curl` and `requests` will behave differently. It would be really handy if `requests` had at least partial emulation of the `curl` command-line options to enable me to just `python -m requests https://example.com/` and see what it's doing independent of my code. A really cool bonus feature here would be to print out the relevant Python code for making that same request, but I can see how that might be getting a little far out of scope.
{ "avatar_url": "https://avatars.githubusercontent.com/u/716529?v=4", "events_url": "https://api.github.com/users/glyph/events{/privacy}", "followers_url": "https://api.github.com/users/glyph/followers", "following_url": "https://api.github.com/users/glyph/following{/other_user}", "gists_url": "https://api.github.com/users/glyph/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/glyph", "id": 716529, "login": "glyph", "node_id": "MDQ6VXNlcjcxNjUyOQ==", "organizations_url": "https://api.github.com/users/glyph/orgs", "received_events_url": "https://api.github.com/users/glyph/received_events", "repos_url": "https://api.github.com/users/glyph/repos", "site_admin": false, "starred_url": "https://api.github.com/users/glyph/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/glyph/subscriptions", "type": "User", "url": "https://api.github.com/users/glyph", "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/3464/reactions" }
https://api.github.com/repos/psf/requests/issues/3464/timeline
null
completed
null
null
false
[ "Sorry if this is a dup - I could swear I've seen it before but after 15 minutes of searching I couldn't find it.\n", "I have considered this in the past, but opted against it. Might as well use http://httpie.org, which uses Requests. \n", "@kennethreitz Oh - in my defense I did try searching closed issues as well :).\n", "I don't think anyone's asked for it before :)\n", "Bonus-fact: I used to have a function built-in that would turn your Request object into a curl command. It's been removed (obviously), but I think someone's maintaining a version of it (or perhaps the opposite of it) out there somewhere. \n", "Thanks for the pointer to httpie. I've been using it for testing my latest little creation and it is _rad_.\n" ]
https://api.github.com/repos/psf/requests/issues/3463
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3463/labels{/name}
https://api.github.com/repos/psf/requests/issues/3463/comments
https://api.github.com/repos/psf/requests/issues/3463/events
https://github.com/psf/requests/pull/3463
168,486,327
MDExOlB1bGxSZXF1ZXN0Nzk0Njc1NjY=
3,463
#3416 persisting cookie policy.
{ "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" }
[ { "color": "d4c5f9", "default": false, "description": null, "id": 536793543, "name": "needs rebase", "node_id": "MDU6TGFiZWw1MzY3OTM1NDM=", "url": "https://api.github.com/repos/psf/requests/labels/needs%20rebase" } ]
closed
true
null
[]
null
5
2016-07-30T20:51:17Z
2021-09-06T00:06:58Z
2017-02-10T21:51:13Z
MEMBER
resolved
This will add in the option to persist cookie policies on requests when the session and request cookie jars are merged. Currently any custom cookie policies on the session are not sent as noted in #3416.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3463/reactions" }
https://api.github.com/repos/psf/requests/issues/3463/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3463.diff", "html_url": "https://github.com/psf/requests/pull/3463", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3463.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3463" }
true
[ "So I'm generally ok with this, but I'd like @sigmavirus24 and @kennethreitz to have a look.\n", "Needs a rebase. ", "I'm actually going to propose we close this one unless there's consensus it's needed. There seems to be a lot of unresolved discussion on the state of Session cookies.", "thanks @nateprewitt ", "Given @Lukasa's comment in #4000 do we want to revisit this?\r\n\r\nThe caveat of conflicting policies still seems a bit ugly but that would be a pretty rare case that requires manual user intervention to occur." ]
https://api.github.com/repos/psf/requests/issues/3462
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3462/labels{/name}
https://api.github.com/repos/psf/requests/issues/3462/comments
https://api.github.com/repos/psf/requests/issues/3462/events
https://github.com/psf/requests/pull/3462
168,464,797
MDExOlB1bGxSZXF1ZXN0Nzk0NTYwNjQ=
3,462
Close and then release the connection
{ "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" }
[]
closed
true
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "user_view_type": "public" }
[ { "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "user_view_type": "public" } ]
null
1
2016-07-30T12:18:14Z
2021-09-08T03:00:55Z
2016-07-30T17:18:14Z
CONTRIBUTOR
resolved
urllib3 closes the underlying connection when we call urllib3.Response.close but does not release it back to the connection pool. This can cause issues when users have a blocking connection pool configured and connections are not readily returned to the pool. Since the underlying connection is closed, we should be able to safely return the connection to the connection pool, so to fix this issue we merely need to not return after closing the response. Closes gh-3461
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3462/reactions" }
https://api.github.com/repos/psf/requests/issues/3462/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3462.diff", "html_url": "https://github.com/psf/requests/pull/3462", "merged_at": "2016-07-30T17:18:14Z", "patch_url": "https://github.com/psf/requests/pull/3462.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3462" }
true
[ "Took a second to understand this patch, but when I saw it I felt pretty silly. This is an obvious win! Thanks! :sparkles: :cake: :sparkles:\n" ]
https://api.github.com/repos/psf/requests/issues/3461
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3461/labels{/name}
https://api.github.com/repos/psf/requests/issues/3461/comments
https://api.github.com/repos/psf/requests/issues/3461/events
https://github.com/psf/requests/issues/3461
168,455,190
MDU6SXNzdWUxNjg0NTUxOTA=
3,461
Closing streams before complete read leaks connections
{ "avatar_url": "https://avatars.githubusercontent.com/u/2386612?v=4", "events_url": "https://api.github.com/users/ml31415/events{/privacy}", "followers_url": "https://api.github.com/users/ml31415/followers", "following_url": "https://api.github.com/users/ml31415/following{/other_user}", "gists_url": "https://api.github.com/users/ml31415/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ml31415", "id": 2386612, "login": "ml31415", "node_id": "MDQ6VXNlcjIzODY2MTI=", "organizations_url": "https://api.github.com/users/ml31415/orgs", "received_events_url": "https://api.github.com/users/ml31415/received_events", "repos_url": "https://api.github.com/users/ml31415/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ml31415/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ml31415/subscriptions", "type": "User", "url": "https://api.github.com/users/ml31415", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-30T07:40:12Z
2021-09-08T17:05:19Z
2016-07-30T17:18:14Z
NONE
resolved
``` python import requests s = requests.Session() adp = requests.adapters.HTTPAdapter(pool_maxsize=3, pool_connections=3, pool_block=True) s.mount('http://', adp) for _ in range(5): resp = s.get('http://google.com', stream=True) # resp.content # resp.raw.release_conn() resp.close() print "closed" ``` This hangs after the 3rd close, as the connection pool is depleted. `resp.close()` just closes the connection, when the data is not read completely, but no connection is returned to the pool: https://github.com/kennethreitz/requests/blob/master/requests/models.py#L871
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3461/reactions" }
https://api.github.com/repos/psf/requests/issues/3461/timeline
null
completed
null
null
false
[ "Thanks guys!\n" ]
https://api.github.com/repos/psf/requests/issues/3460
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3460/labels{/name}
https://api.github.com/repos/psf/requests/issues/3460/comments
https://api.github.com/repos/psf/requests/issues/3460/events
https://github.com/psf/requests/issues/3460
168,355,962
MDU6SXNzdWUxNjgzNTU5NjI=
3,460
Documentation makes no mention of CookieJar
{ "avatar_url": "https://avatars.githubusercontent.com/u/16552531?v=4", "events_url": "https://api.github.com/users/roselma/events{/privacy}", "followers_url": "https://api.github.com/users/roselma/followers", "following_url": "https://api.github.com/users/roselma/following{/other_user}", "gists_url": "https://api.github.com/users/roselma/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/roselma", "id": 16552531, "login": "roselma", "node_id": "MDQ6VXNlcjE2NTUyNTMx", "organizations_url": "https://api.github.com/users/roselma/orgs", "received_events_url": "https://api.github.com/users/roselma/received_events", "repos_url": "https://api.github.com/users/roselma/repos", "site_admin": false, "starred_url": "https://api.github.com/users/roselma/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/roselma/subscriptions", "type": "User", "url": "https://api.github.com/users/roselma", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2016-07-29T15:52:00Z
2021-09-08T16:00:40Z
2016-08-03T20:06:52Z
NONE
resolved
There are only dict-based examples in the documentation of the cookies parameter to the get method. Making some mention of the use of CookieJar might save some poor sod from re-implementing half of CookieJar and then finally discovering its existence by printing the cookies property in the response.
{ "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/3460/reactions" }
https://api.github.com/repos/psf/requests/issues/3460/timeline
null
completed
null
null
false
[ "Yup, sounds good to me. Would you like to write something? =)\n", "It looks like the [`RequestsCookieJar` class](http://docs.python-requests.org/en/master/api/#requests.cookies.RequestsCookieJar) is available on the main page of links in the documentation, under the [Developer Interface docs](http://docs.python-requests.org/en/master/#the-api-documentation-guide).\n\nWere you looking to have a code example added in the Quickstart section @roselma, or would a link to the existing documentation suffice? \n", "The quickstart guide is (thankfully) quite thorough, so careless readers may fail to notice that they are not looking at the most detailed documentation available. I believe that a sentence in the Cookies section of the quickstart guide linking to RequestsCookieJar info would be adequate.\n\nOr, you know... you could just drop this, since technically the documentation _does_ make mention of CookieJar... just not in the quickstart guide.\n\nI created a pull request with a blurb about RequestsCookieJar. Do with it as you see fit.\n", "Closed by #3469 \n" ]
https://api.github.com/repos/psf/requests/issues/3459
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3459/labels{/name}
https://api.github.com/repos/psf/requests/issues/3459/comments
https://api.github.com/repos/psf/requests/issues/3459/events
https://github.com/psf/requests/issues/3459
168,189,284
MDU6SXNzdWUxNjgxODkyODQ=
3,459
How to handle incompleteRead()?
{ "avatar_url": "https://avatars.githubusercontent.com/u/18126805?v=4", "events_url": "https://api.github.com/users/haoramirez/events{/privacy}", "followers_url": "https://api.github.com/users/haoramirez/followers", "following_url": "https://api.github.com/users/haoramirez/following{/other_user}", "gists_url": "https://api.github.com/users/haoramirez/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/haoramirez", "id": 18126805, "login": "haoramirez", "node_id": "MDQ6VXNlcjE4MTI2ODA1", "organizations_url": "https://api.github.com/users/haoramirez/orgs", "received_events_url": "https://api.github.com/users/haoramirez/received_events", "repos_url": "https://api.github.com/users/haoramirez/repos", "site_admin": false, "starred_url": "https://api.github.com/users/haoramirez/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/haoramirez/subscriptions", "type": "User", "url": "https://api.github.com/users/haoramirez", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-28T20:30:58Z
2021-09-08T17:05:20Z
2016-07-28T20:55:02Z
NONE
resolved
Hi there, How am I supposed to handle an incompleteRead? I don't get it, because TCP is supposed to inherently prevent this right? And getting this error means that Requests, or Urllib3, somehow doesn't do checksumming properly? I'm just way in over my head thinking about how I'm supposed to even catch it.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3459/reactions" }
https://api.github.com/repos/psf/requests/issues/3459/timeline
null
completed
null
null
false
[ "Thanks for your question!\n\nTCP is not supposed to prevent `IncompleteRead`. If you consider certain possible failure cases you'll see that it's impossible for TCP to prevent such a case. For example, if the server that is serving your web page is destroyed by a meteor midway through serving your web page, there is nothing TCP can do: the data is gone. The response will then necessarily be incomplete!\n\nIn most use cases, though, `IncompleteRead` is not caused by TCP connection problems: those will manifest as timeouts. Instead, `IncompleteRead` is caused when the server appears to have failed to frame it's response correctly. For example, if the server claims that it was going to send 5kB of data but only sends 4kB, we may emit this error. Or, if the server is using chunked transfer encoding and claims it will send a chunk of 40 bytes, but only 20 bytes are sent, that will also cause an `IncompleteRead`.\n\nThere is frequently very little you can do about this error except to log, and move on.\n", "Thank you for that explanation. I didn't understand the limitations of TCP.\n" ]
https://api.github.com/repos/psf/requests/issues/3458
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3458/labels{/name}
https://api.github.com/repos/psf/requests/issues/3458/comments
https://api.github.com/repos/psf/requests/issues/3458/events
https://github.com/psf/requests/issues/3458
168,078,925
MDU6SXNzdWUxNjgwNzg5MjU=
3,458
Closed keep-alive connections not handled correctly
{ "avatar_url": "https://avatars.githubusercontent.com/u/650612?v=4", "events_url": "https://api.github.com/users/santtu/events{/privacy}", "followers_url": "https://api.github.com/users/santtu/followers", "following_url": "https://api.github.com/users/santtu/following{/other_user}", "gists_url": "https://api.github.com/users/santtu/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/santtu", "id": 650612, "login": "santtu", "node_id": "MDQ6VXNlcjY1MDYxMg==", "organizations_url": "https://api.github.com/users/santtu/orgs", "received_events_url": "https://api.github.com/users/santtu/received_events", "repos_url": "https://api.github.com/users/santtu/repos", "site_admin": false, "starred_url": "https://api.github.com/users/santtu/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/santtu/subscriptions", "type": "User", "url": "https://api.github.com/users/santtu", "user_view_type": "public" }
[]
closed
true
null
[]
null
6
2016-07-28T12:00:12Z
2021-09-08T17:05:21Z
2016-07-28T19:00:37Z
NONE
resolved
I have run into a case where a session-based GET request fails: ``` Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 376, in _make_request httplib_response = conn.getresponse(buffering=True) TypeError: getresponse() got an unexpected keyword argument 'buffering' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 559, in urlopen body=body, headers=headers) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 378, in _make_request httplib_response = conn.getresponse() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1197, in getresponse response.begin() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 297, in begin version, status, reason = self._read_status() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/adapters.py", line 370, in send timeout=timeout File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 609, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/util/retry.py", line 245, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/packages/six.py", line 309, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 559, in urlopen body=body, headers=headers) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 378, in _make_request httplib_response = conn.getresponse() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1197, in getresponse response.begin() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 297, in begin version, status, reason = self._read_status() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without" requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 11, in <module> r = s.get(url, allow_redirects=False) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/sessions.py", line 480, in get return self.request('GET', url, **kwargs) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/sessions.py", line 468, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/adapters.py", line 412, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) ``` I finally narrowed the case to a situation where 1. a request is made where the connection is kept open (`Session`) e.g. keep-alive is enabled 2. the connection is to a host that is reverse-proxied by nginx 3. nginx configuration is reloaded 4. a new request is made using the session I believe this is because nginx will close the idle connection (at step 3) and when the next request is generated (step 4) it tries to write to the closed socket which in turn will generate connection abort exception. **As far as I understand Keep-Alive nginx is doing everything correctly.** From RFC2616: > A client, server, or proxy MAY close the transport connection at any time. For example, a client might have started to send a new request at the same time that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed while it was idle, but from the client's point of view, a request is in progress. > > This means that clients, servers, and proxies MUST be able to recover from asynchronous close events. Client software SHOULD reopen the transport connection and retransmit the aborted sequence of requests without user interaction so long as the request sequence is idempotent (see section 9.1.2). Non-idempotent methods or sequences MUST NOT be automatically retried, although user agents MAY offer a human operator the choice of retrying the request(s). Confirmation by user-agent software with semantic understanding of the application MAY substitute for user confirmation. The automatic retry SHOULD NOT be repeated if the second sequence of requests fails. What nginx does on configuration reload is to iterate over connections and close any that it considers idle. (It will allow pending requests to finish, but will close them after completion, too.) So for the client it appears as if the remote end has just hung up. Since the socket state is checked only when a new request is being sent it appears at that point. I created a pair of test programs (https://gist.github.com/santtu/a38bb50c44623a162df72cb6d0a45f0a), a simple socket server which fakes a keep-alive HTTP/1.1 server but will terminate the connection after a short delay, and another program that will do busyloop GETs on an URL using a persistent session. Here are the results. First is the server (`test2.py`) and then the client (`test.py`): ``` $ python3 test2.py 127.0.0.1 wrote: b'GET / HTTP/1.1\r\nHost: localhost:8080\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate\r\nUser-Agent: python-requests/2.8.1\r\nConnection: keep-alive' ``` ``` $ python3 test.py http://localhost:8080/ 200 OK Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 376, in _make_request httplib_response = conn.getresponse(buffering=True) TypeError: getresponse() got an unexpected keyword argument 'buffering' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 559, in urlopen body=body, headers=headers) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 378, in _make_request httplib_response = conn.getresponse() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1197, in getresponse response.begin() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 297, in begin version, status, reason = self._read_status() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/adapters.py", line 370, in send timeout=timeout File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 609, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/util/retry.py", line 245, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/packages/six.py", line 309, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 559, in urlopen body=body, headers=headers) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py", line 378, in _make_request httplib_response = conn.getresponse() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1197, in getresponse response.begin() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 297, in begin version, status, reason = self._read_status() File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without" requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 11, in <module> r = s.get(url, allow_redirects=False) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/sessions.py", line 480, in get return self.request('GET', url, **kwargs) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/sessions.py", line 468, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/adapters.py", line 412, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) ``` The first `200 OK` comes from the faked response after which the client ends up blocking on the socket, finally getting connection abort when it is a few seconds later closed by the server side. Any thoughts on this?
{ "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/3458/reactions" }
https://api.github.com/repos/psf/requests/issues/3458/timeline
null
completed
null
null
false
[ "If you pass `stream=True`, can you show me the headers of the response?\n", "To be clear, if the connection is closed _after_ we've written our request down it, there is very little we can do to handle this. Exceptions are the only sensible thing we can raise: we wrote a request _successfully_, with no TCP errors, and the server closed the connection before responding.\n\nIf this happens to you, its up to your code to decide if it's safe to retry the request. We cannot generically make that decision.\n", "Adding `stream=True` to the `get` actually makes it work:\n\n```\n$ python3 test.py http://localhost:8080/\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n200 OK\n```\n\nSo this is with:\n\n```\nwhile True:\n r = s.get(url, allow_redirects=False, stream=True)\n print(r.status_code, r.reason)\n\n if r.status_code not in [200, 302]:\n break\n```\n\nHowever what I think is that since the stream is not consumed it'll just use a new connection (as written [here](http://docs.python-requests.org/en/master/user/advanced/#body-content-workflow)). Modifying the test case to actually consume all of the input will again cause it to fail on the second request:\n\n```\nwhile True:\n r = s.get(url, allow_redirects=False, stream=True)\n print(r.status_code, r.reason)\n data = r.raw.read()\n\n if r.status_code not in [200, 302]:\n break\n```\n\nresulting in \n\n```\n$ python3 test.py http://localhost:8080/\n200 OK\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.5/site-packages/requests-2.8.1-py3.5.egg/requests/packages/urllib3/connectionpool.py\", line 376, in _make_request\n httplib_response = conn.getresponse(buffering=True)\nTypeError: getresponse() got an unexpected keyword argument 'buffering'\n\nDuring handling of the above exception, another exception occurred:\n(and so on)\n```\n\nThe response headers are just as written by `test2.py`: `{'Connection': 'keep-alive', 'Content-Type': 'text/plain', 'Content-Length': '12'}`\n", "So see my comment above: the server really shouldn't close its connection _after_ we've sent the request but before responding, and so if it does we have no option but to report an error to our user.\n", "> To be clear, if the connection is closed after we've written our request down it, there is very little we can do to handle this. Exceptions are the only sensible thing we can raise: we wrote a request successfully, with no TCP errors, and the server closed the connection before responding.\n\nThis is incorrect thinking when working with asynchronous protocols. As noted in the RFC, the server has closed the connection when it is idle. The closing may have happened 5 minutes ago with the TCP FIN already at the client end. In this case the client could check if the connection has been closed (after all, the underlying TCP socket **has been closed**) before trying to write to it. That it can detect. But generally even that would leave a race condition since in asynchronous case client can write and server can close at the same time.\n\nMind you, it is entirely (as pointed out in the RFC from 1999) possible for the client to detect an aborted connection (like here, from the exception) and **for GET or HEAD** to retry the request once.\n\nSince this is a behavior is described in the HTTP/1.1 specification as a valid behavior for persistent connections I do not think the claim of having \"100%\" support for keep-alives is valid. Without a retry a purely administrative operation (configuration reload) on a server designed for zero-downtime operation (nginx) will show up as errors when using sessions. The only real work-around currently is to not use keep-alives at all. The alternative is to implement the low-level retry-once semantic into all client code wishing to use requests. Neither of these workarounds are terribly good, one loses the benefits of persistent connections and the other requires implementing the same handling code in all places wishing to actually handle persistent connection terminations correctly.\n", "> As noted in the RFC, the server has closed the connection when it is idle.\n\nThe server has not read from the socket layer yet, correct. However, the requests side of the connection cannot know that: from our perspective, our (blocking) writes have succeeded, which means that we have transferred data to the server. We are now expecting a response. Naturally, then, if the server closed the connection five minutes ago we _will_ detect it (and if you want to test this case, you'll find that we correctly re-open the connection).\n\n> Mind you, it is entirely (as pointed out in the RFC from 1999) possible for the client to detect an aborted connection (like here, from the exception) and for GET or HEAD to retry the request once.\n\nYes, we can do that. In practice, we like to leave that choice up to our users, who are better placed to decide what to retry than we are.\n\n> The only real work-around currently is to not use keep-alives at all. The alternative is to implement the low-level retry-once semantic into all client code wishing to use requests.\n\nNeither of those statements is true, and the documentation calls them out as untrue. Note [here](http://docs.python-requests.org/en/master/api/#requests.adapters.HTTPAdapter), which provides a `max_retries` parameter that can be set to an integer value. If you set it to 1, this problem should be resolved for you.\n" ]
https://api.github.com/repos/psf/requests/issues/3447
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3447/labels{/name}
https://api.github.com/repos/psf/requests/issues/3447/comments
https://api.github.com/repos/psf/requests/issues/3447/events
https://github.com/psf/requests/issues/3447
168,009,183
MDU6SXNzdWUxNjgwMDkxODM=
3,447
has bug when using post parameter with list including embed dict?
{ "avatar_url": "https://avatars.githubusercontent.com/u/6281968?v=4", "events_url": "https://api.github.com/users/gsw945/events{/privacy}", "followers_url": "https://api.github.com/users/gsw945/followers", "following_url": "https://api.github.com/users/gsw945/following{/other_user}", "gists_url": "https://api.github.com/users/gsw945/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/gsw945", "id": 6281968, "login": "gsw945", "node_id": "MDQ6VXNlcjYyODE5Njg=", "organizations_url": "https://api.github.com/users/gsw945/orgs", "received_events_url": "https://api.github.com/users/gsw945/received_events", "repos_url": "https://api.github.com/users/gsw945/repos", "site_admin": false, "starred_url": "https://api.github.com/users/gsw945/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/gsw945/subscriptions", "type": "User", "url": "https://api.github.com/users/gsw945", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-28T03:58:57Z
2021-09-08T17:05:21Z
2016-07-28T07:45:20Z
NONE
resolved
My Code is: ``` python import requests try: import json except ImportError: import simplejson as json ids = [ { 'user_id_value': 1, 'user_id_name': 'lms_user_id' }, { 'user_id_value': 2, 'user_id_name': 'lms_user_id' } ] params = { 'ids': ids, 'secret_key': 'c02def69e05614es1c3d14fdfd56ca786e96e215' } r = requests.post('http://httpbin.org/post', data=params) d = r.json() j = json.dumps(d, indent=4) print(j) ``` and the output is: ``` json { "data": "", "json": null, "headers": { "Accept": "*/*", "Content-Type": "application/x-www-form-urlencoded", "Host": "httpbin.org", "Accept-Encoding": "gzip, deflate", "User-Agent": "python-requests/2.10.0", "Content-Length": "121" }, "args": {}, "files": {}, "url": "http://httpbin.org/post", "form": { "ids": [ "user_id_value", "user_id_name", "user_id_value", "user_id_name" ], "secret_key": "c02def69e05614es1c3d14fdfd56ca786e96e215" }, "origin": "125.84.178.184" } ``` I hope the part of 'form.ids' in result as below: ``` json [ { "user_id_value": 1, "user_id_name": "lms_user_id" }, { "user_id_value": 2, "user_id_name": "lms_user_id" } ] ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3447/reactions" }
https://api.github.com/repos/psf/requests/issues/3447/timeline
null
completed
null
null
false
[ "You're presumably trying to send JSON-encoded data. To do that, change your `post` line to this:\n\n```\nr = requests.post('http://httpbin.org/post', json=params)\n```\n", "@Lukasa Thank you very much, it's working!\n" ]
https://api.github.com/repos/psf/requests/issues/3446
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3446/labels{/name}
https://api.github.com/repos/psf/requests/issues/3446/comments
https://api.github.com/repos/psf/requests/issues/3446/events
https://github.com/psf/requests/issues/3446
167,840,304
MDU6SXNzdWUxNjc4NDAzMDQ=
3,446
Posting a mutlipart-encoded file with non-ASCII characters in filename doesn't work
{ "avatar_url": "https://avatars.githubusercontent.com/u/10137?v=4", "events_url": "https://api.github.com/users/ghost/events{/privacy}", "followers_url": "https://api.github.com/users/ghost/followers", "following_url": "https://api.github.com/users/ghost/following{/other_user}", "gists_url": "https://api.github.com/users/ghost/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ghost", "id": 10137, "login": "ghost", "node_id": "MDQ6VXNlcjEwMTM3", "organizations_url": "https://api.github.com/users/ghost/orgs", "received_events_url": "https://api.github.com/users/ghost/received_events", "repos_url": "https://api.github.com/users/ghost/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ghost/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ghost/subscriptions", "type": "User", "url": "https://api.github.com/users/ghost", "user_view_type": "public" }
[]
closed
true
null
[]
null
14
2016-07-27T12:21:19Z
2021-09-06T00:06:34Z
2016-07-27T12:56:24Z
NONE
resolved
The following code doesn't actually upload any data to the server: ``` python r = requests.post('https://gs.smuglo.li/api/statusnet/media/upload', auth=('testbot', 'testbot'), files={'media': open('/tmp/Снимок экрана_2016-07-27_05-15-38.png', 'rb')}) ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3446/reactions" }
https://api.github.com/repos/psf/requests/issues/3446/timeline
null
completed
null
null
false
[ "What makes you think that doesn't upload data to the server?\n", "Put another way: what is `r.request.body`?\n", "@lukasa \n\n> What makes you think that doesn't upload data to the server?\n\nThe fact that the server returns an XML with following content:\n\n``` xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rsp stat=\"fail\">\n <err msg=\"There is no uploaded media for input field &quot;media&quot;.\"></err>\n</rsp>\n```\n\n> Put another way: what is `r.request.body`?\n\n``` python\n>>> r.request.body\nb'--254dc93f44a24498bef41502bb23d76f\\r\\nContent-Disposition: form-data; name=\"media\"; filename*=utf-8\\'\\'%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0_2016-07-2\n7_05-15-38.png\\r\\n\\r\\n\\x89PNG...\n```\n\nAnd a lot of hex values after that.\n", "Yup, so that's why I asked about `r.request.body`. We _are_ uploading data: you can see it in `r.request.body`. What's happening is that the server isn't reading it. This is almost certainly because the server doesn't support RFC 2231. See #2313.\n\nYou can probably fix this by using the extended syntax for file uploads with an appropriately created byte string:\n\n`files = {'media': (u'Снимок экрана_2016-07-27_05-15-38.png'.encode('utf-8'), open('/tmp/Снимок экрана_2016-07-27_05-15-38.png', 'rb'))}`\n", "@Lukasa Is this Python 2? Because in Python 3 I get\n\n``` python\nTypeError: a bytes-like object is required, not 'str'\n```\n", "You get that where? Encode should be forcing to bytes-like object. Can I see the proper traceback?\n", "@Lukasa Sure\n\n``` python\n>>> filename = '/tmp/Снимок экрана_2016-07-27_05-15-38.png' \n>>> media = {'media':(filename.encode('utf-8'), open(filename, 'rb'))}\n>>> r = requests.post(url, auth=('testbot', 'testbot'), files=media)\nTraceback (most recent call last):\n File \"<input>\", line 1, in <module>\n r = requests.post(url, auth=(username, password), files=media)\n File \"/usr/lib/python3.5/site-packages/requests/api.py\", line 111, in post\n return request('post', url, data=data, json=json, **kwargs)\n File \"/usr/lib/python3.5/site-packages/requests/api.py\", line 57, in request\n return session.request(method=method, url=url, **kwargs)\n File \"/usr/lib/python3.5/site-packages/requests/sessions.py\", line 461, in request\n prep = self.prepare_request(req)\n File \"/usr/lib/python3.5/site-packages/requests/sessions.py\", line 394, in prepare_request\n hooks=merge_hooks(request.hooks, self.hooks),\n File \"/usr/lib/python3.5/site-packages/requests/models.py\", line 298, in prepare\n self.prepare_body(data, files, json)\n File \"/usr/lib/python3.5/site-packages/requests/models.py\", line 449, in prepare_body\n (body, content_type) = self._encode_files(files, data)\n File \"/usr/lib/python3.5/site-packages/requests/models.py\", line 155, in _encode_files\n rf.make_multipart(content_type=ft)\n File \"/usr/lib/python3.5/site-packages/urllib3/fields.py\", line 174, in make_multipart\n (('name', self._name), ('filename', self._filename))\n File \"/usr/lib/python3.5/site-packages/urllib3/fields.py\", line 134, in _render_parts\n parts.append(self._render_part(name, value))\n File \"/usr/lib/python3.5/site-packages/urllib3/fields.py\", line 114, in _render_part\n return format_header_param(name, value)\n File \"/usr/lib/python3.5/site-packages/urllib3/fields.py\", line 35, in format_header_param\n if not any(ch in value for ch in '\"\\\\\\r\\n'):\n File \"/usr/lib/python3.5/site-packages/urllib3/fields.py\", line 35, in <genexpr>\n if not any(ch in value for ch in '\"\\\\\\r\\n'):\nTypeError: a bytes-like object is required, not 'str'\n```\n", "Ah, I see what's happening there.\n\nSo this starts to get really unpleasant. It seems like urllib3 gets mad when using a bytestring in this place on Python 3. Out of interest, try dropping the `.encode` from the filename?\n\nEither way, the problem seems to be the use of RFC 2231 in this place. urllib3 is looking to make RFC 2231 encoding optional, so this problem should be resolvable in a future release.\n", "@Lukasa It gets back to the original error.\n\n``` xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rsp stat=\"fail\">\n <err msg=\"There is no uploaded media for input field &quot;media&quot;.\"></err>\n</rsp>\n```\n", "Yeah, so like I said, this is an RFC 2231 concern at this point. This represents a urllib3 problem, but it's one we've got an open PR for solving it: shazow/urllib3#856.\n", "@Lukasa That's good to hear. I have a solution for this, since the filesize can't be more than 20MB for that server, I just do\n\n``` python\n>>> media = {'media': open(filename, 'rb').read()}\n>>> r = requests.post(url, auth=('testbot', 'testbot'), files=media)\n>>> print(r.text)\n```\n\n``` xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rsp stat=\"ok\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <mediaid>84983</mediaid>\n <mediaurl>https://gs.smuglo.li/attachment/84983</mediaurl>\n <media_url>https://gs.smuglo.li/attachment/84983</media_url>\n <size>23815</size>\n <atom:link rel=\"enclosure\" href=\"https://gs.smuglo.li/file/e1035ccd7c31b07edad49251a8ff2bd6bce96fbda7a2585cd113b137df187d8c.png\" type=\"image/png\"></atom:link>\n <media_id>84983</media_id>\n <media_id_string>84983</media_id_string>\n <image w=\"766\" h=\"317\" image_type=\"image/png\"></image>\n</rsp>\n```\n", "That's good! In that case, let's close this in favour of the open issues.\n", "@Lukasa Be sure to hit me up when that RFC is properly implemented by urllib3, an I will remove that filthy hack I use.\n", "any solutions to python3? i have the same problem here:\r\n```\r\ndb = open('db.txt').read().splitlines() #db is written in utf-8\r\ni = 0\r\nfor line in db: # line is './images/APPLE-IPHONE_7_PLUS-SILICON_BLACK.jpg'\r\n files = {'image': (line, open(line, 'rb')) }\r\n r = requests.post(url, files=files, auth=(username, password))\r\n if r.text != 'done!':\r\n print(r.request.body)\r\n errs.write((str(i) + ' ' + line + ' failed!' + '\\n'))\r\n else:\r\n print(i, line)\r\n i = i + 1\r\n```\r\ni have problem when non ascii codes like 'Ş' occurs\r\nand ``` print(r.request.body)``` becomes None" ]
https://api.github.com/repos/psf/requests/issues/3445
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3445/labels{/name}
https://api.github.com/repos/psf/requests/issues/3445/comments
https://api.github.com/repos/psf/requests/issues/3445/events
https://github.com/psf/requests/issues/3445
167,803,894
MDU6SXNzdWUxNjc4MDM4OTQ=
3,445
Connection pooling is tied to sessions
{ "avatar_url": "https://avatars.githubusercontent.com/u/1581590?v=4", "events_url": "https://api.github.com/users/Changaco/events{/privacy}", "followers_url": "https://api.github.com/users/Changaco/followers", "following_url": "https://api.github.com/users/Changaco/following{/other_user}", "gists_url": "https://api.github.com/users/Changaco/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Changaco", "id": 1581590, "login": "Changaco", "node_id": "MDQ6VXNlcjE1ODE1OTA=", "organizations_url": "https://api.github.com/users/Changaco/orgs", "received_events_url": "https://api.github.com/users/Changaco/received_events", "repos_url": "https://api.github.com/users/Changaco/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Changaco/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Changaco/subscriptions", "type": "User", "url": "https://api.github.com/users/Changaco", "user_view_type": "public" }
[]
closed
true
null
[]
null
7
2016-07-27T08:55:42Z
2021-09-08T14:00:23Z
2016-07-27T09:00:26Z
NONE
resolved
This leads to confusion, as demonstrated by #3201 (ping @thanatos), but it's not a documentation issue, it's a design issue. Connections and sessions are unrelated: a connection can be used by multiple sessions, and a session can span multiple connections; thus the library shouldn't tie them together.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3445/reactions" }
https://api.github.com/repos/psf/requests/issues/3445/timeline
null
completed
null
null
false
[ "Thanks for the feedback. It is appreciated and will be considered momentarily (then ignored) :)\n", "Gentle +1 on this one.\r\n\r\nThe existing documentation isn't very clear (as another user mentioned in #3201, I find it quite contradictory, despite the assertion to the contrary). After reading these various GitHub issues I have some understanding as to how it works, and I would especially never have divined that it's possible for connections to be shared across sessions (as mentioned here) without them. I've never come across another language/HTTP library where this is the case, so I would never have intuited Requests' behavior here.\r\n\r\nIMO, it would be beneficial for Requests to have a section in the documentation explaining the precise mechanics of connection pooling. I'd even go as far as to draft it if that would help.", "> After reading these various GitHub issues I have some understanding as to how it works, and I would especially never have divined that it's possible for connections to be shared across sessions (as mentioned here) without them.\r\n\r\nConnections *cannot* be shared across Sessions. Anything you read that gave you that impression is wrong. Sessions are the only place where we anchor connection pooling.\r\n\r\nAs to whether the library ties them together or not, that is absolutely the prerogative of this library. Despite the confident assertion of the OP, plenty of other libraries in other languages tie Sessions and connections together: consider `NSURLSession` from iOS, or Alamofire, or any number of others.\r\n\r\nI have no problem with having some extra documentation, but again I don't think there's any lack of clarity here. Right at the top of the [Session objects](http://docs.python-requests.org/en/master/user/advanced/#session-objects) section of the documentation we say:\r\n\r\n> The Session object allows you to persist certain parameters across requests. It also persists cookies across all requests made from the Session instance, and will use urllib3's connection pooling. So if you're making several requests to the same host, the underlying TCP connection will be reused, which can result in a significant performance increase (see HTTP persistent connection).\r\n\r\nI don't know how much clearer we could make this without adding a hero graphic.", "> I have no problem with having some extra documentation, but again I don't think there's any lack of clarity here. Right at the top of the Session objects section of the documentation we say:\r\n\r\nRight. I don't think that in itself is overly unclear, but when considered along with the front page assertion of:\r\n\r\n> Keep-alive and HTTP connection pooling are 100% automatic\r\n\r\nI think that most developers (including myself and the original reporter of #3201) would find the documentation contradictory. I understand that Kenneth may have meant this to read that the porcelain-level APIs will pool within any given HTTP action, but when backend developers talk about connection pooling, we tend to be thinking about pooling that's a far reach more effective than that. Pooling within any single action is likely to give you only a very nominal performance advantage when using an HTTP library across ten of thousands of requests.\r\n\r\n> I don't know how much clearer we could make this without adding a hero graphic.\r\n\r\nI am sorry, but I honestly don't understand what this means. I hope that my original comment was worded constructively, but let me know if there's anything that I can correct there.", "I think we're arguing past each other, and mostly disagreeing on what \"100% automatic means\". It seems that you and the original reporter of #3201 conclude that \"100% automatic\" means \"applies to any possible usage of the API\": that is, no matter how you use Requests you should get connection pooling unless you explicitly don't ask for it.\r\n\r\nUltimately I don't agree with that: to my reading, \"100% automatic\" means \"without user intervention\", and that aspect is *true*. But it does not mean that arbitrary usage of the API will obtain it.\r\n\r\nWould the problem be resolved if we simply removed the \"100%\" from the documentation? If we removed the word \"automatic\"? I'm trying to understand what specifically in the sentence \"Keep-alive and HTTP connection pooling are 100% automatic\" contradicts the notion that you have to use a Session to get it.\r\n\r\nRegardless, let's say that we accept your assertion that the documentation is contradictory. How would you resolve the contradiction? What documentation would you add/remove/change, and how?", "> Would the problem be resolved if we simply removed the \"100%\" from the documentation? If we removed the word \"automatic\"? I'm trying to understand what specifically in the sentence \"Keep-alive and HTTP connection pooling are 100% automatic\" contradicts the notion that you have to use a Session to get it.\r\n\r\nI don't think removing \"100%\" would clarify anything. The basic problem is that this sentence is perfectly ambiguous; you might interpret it one way while I might interpret it another.\r\n\r\nI don't think an ambiguous sentence is the end of the world, but I do think that it should be clarified elsewhere. Talking about connection pooling under the session documentation is fine, but not wholly adequate.\r\n\r\n> Regardless, let's say that we accept your assertion that the documentation is contradictory. How would you resolve the contradiction? What documentation would you add/remove/change, and how?\r\n\r\nI'd suggest a short section on \"Connection Pooling in Requests\". It could talk about (1) how connections are pooled within a single top-level API request, and (2) how connection pooling across many requests can be achieved with the use of a session object. Pretty much exactly what we've been talking about here.\r\n\r\nAnyway, I don't feel strongly enough about this to forcefully champion it through in the case that there's strong backpressure to corrections from this library's maintainers. I commented originally to re-raise that issues like this one and #3201 seem to be good evidence that people are having trouble interpreting the documentation, but there seems to be a very strong sentiment that this is user error, so I'll let it slide.", "> Despite the confident assertion of the OP, plenty of other libraries in other languages tie Sessions and connections together: consider `NSURLSession` from iOS, or Alamofire, or any number of others.\r\n\r\nOther libraries being designed the same way doesn't prove that the design is good.\r\n\r\n(I'm not trying to reopen the issue, I'm just answering because I was mentioned.)" ]
https://api.github.com/repos/psf/requests/issues/3444
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3444/labels{/name}
https://api.github.com/repos/psf/requests/issues/3444/comments
https://api.github.com/repos/psf/requests/issues/3444/events
https://github.com/psf/requests/pull/3444
167,765,919
MDExOlB1bGxSZXF1ZXN0Nzg5NjI1NjQ=
3,444
Adding better logging for requests/responses
{ "avatar_url": "https://avatars.githubusercontent.com/u/1700823?v=4", "events_url": "https://api.github.com/users/seemethere/events{/privacy}", "followers_url": "https://api.github.com/users/seemethere/followers", "following_url": "https://api.github.com/users/seemethere/following{/other_user}", "gists_url": "https://api.github.com/users/seemethere/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/seemethere", "id": 1700823, "login": "seemethere", "node_id": "MDQ6VXNlcjE3MDA4MjM=", "organizations_url": "https://api.github.com/users/seemethere/orgs", "received_events_url": "https://api.github.com/users/seemethere/received_events", "repos_url": "https://api.github.com/users/seemethere/repos", "site_admin": false, "starred_url": "https://api.github.com/users/seemethere/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/seemethere/subscriptions", "type": "User", "url": "https://api.github.com/users/seemethere", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-27T04:06:28Z
2021-09-02T00:07:37Z
2016-07-27T13:47:42Z
NONE
resolved
# Description A logging mechanism to display important information regarding all requests and responses sent through the `requests` api. # Why is this necessary? At the company I work for we've been using this [logging mechanism](https://github.com/openstack/opencafe/blob/master/cafe/plugins/http/cafe/engine/http/client.py#L29) for a very long time and have had great success with it for testing numerous APIs. The level of logging provides the user with information they would normally have to dig for, and also provides a ready made log from which to draw relevant information. This is especially important for testing as it provides testers with sufficient logs to assess what is wrong, if a request should fail. This information is even valuable for API developers as they can get immediate, easy to see, feedback on what their API is doing and returning. # Try it for yourself!: ## Code: ``` python import logging;root=logging.getLogger();root.addHandler(logging.StreamHandler());root.setLevel(0); import requests requests.post('https://jsonplaceholder.typicode.com/posts', data="""{"id": 101, "title": "foo", "body": "bar", "userId": 1}""", headers={'content-type': 'application/json'}) ``` ## Logging output: ``` (<requests.sessions.Session object at 0x111000a90>,) {'data': '{"id": 101, "title": "foo", "body": "bar", "userId": 1}', 'url': 'https://jsonplaceholder.typicode.com/posts', 'method': 'post', 'headers': {'content-type': 'application/json'}, 'json': None} Starting new HTTPS connection (1): jsonplaceholder.typicode.com "POST /posts HTTP/1.1" 201 65 ------------ REQUEST SENT ------------ request method..: POST request url.....: https://jsonplaceholder.typicode.com/posts request params..: request headers.: {'Content-Length': '55', 'Connection': 'keep-alive', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'python-requests/2.10.0', 'content-type': 'application/json'} request body....: {"id": 101, "title": "foo", "body": "bar", "userId": 1} ----------------- RESPONSE RECEIVED ----------------- response status..: <Response [201]> response time....: 0.7399938106536865 response headers.: {'CF-RAY': '2c8d2175a6d20108-DFW', 'X-Content-Type-Options': 'nosniff', 'Etag': 'W/"41-1twMC34dpcMvmO2NLu+Kkg"', 'Pragma': 'no-cache', 'Server': 'cloudflare-nginx', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '65', 'Set-Cookie': '__cfduid=dadf01d51aae9ede807ecf3e77439a3d51469591463; expires=Thu, 27-Jul-17 03:51:03 GMT; path=/; domain=.typicode.com; HttpOnly', 'X-Powered-By': 'Express', 'Via': '1.1 vegur', 'Vary': 'Origin, X-HTTP-Method-Override, Accept-Encoding', 'Date': 'Wed, 27 Jul 2016 03:51:03 GMT', 'Access-Control-Allow-Credentials': 'true', 'Expires': '-1', 'Connection': 'keep-alive'} response body....: b'{\n "id": 101,\n "title": "foo",\n "body": "bar",\n "userId": 1\n}' ------------------------------------------------------------------------------- ```
{ "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/3444/reactions" }
https://api.github.com/repos/psf/requests/issues/3444/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3444.diff", "html_url": "https://github.com/psf/requests/pull/3444", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3444.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3444" }
true
[ "Thanks for this! \n\nIt's my view that this is overkill: generally speaking, users that require this function can implement it themselves, and the majority of users don't need it. But I'll leave that decision up to @kennethreitz.\n", "@Lukasa further, in v1.0 didn't @kennethreitz completely tear out what logging requests did provide because people were constantly trying to add tons more logging on top of what we provided? I feel like were were to accept this we'd be in the same situation.\n\nFurther, what's being logged here is a very clear overload of information for any logging that I would view as reasonable for requests. This seems to be working very well in Café as it is and I see little reason to include this in Requests.\n\nI appreciate your offer of the code @seemethere, but I'm very strongly against this. If you want review on the code anyway, I'm happy to provide that in a separate forum.\n" ]
https://api.github.com/repos/psf/requests/issues/3443
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3443/labels{/name}
https://api.github.com/repos/psf/requests/issues/3443/comments
https://api.github.com/repos/psf/requests/issues/3443/events
https://github.com/psf/requests/pull/3443
167,756,237
MDExOlB1bGxSZXF1ZXN0Nzg5NTY3OTg=
3,443
Fix quantity of blank lines after code objects.
{ "avatar_url": "https://avatars.githubusercontent.com/u/10137?v=4", "events_url": "https://api.github.com/users/ghost/events{/privacy}", "followers_url": "https://api.github.com/users/ghost/followers", "following_url": "https://api.github.com/users/ghost/following{/other_user}", "gists_url": "https://api.github.com/users/ghost/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ghost", "id": 10137, "login": "ghost", "node_id": "MDQ6VXNlcjEwMTM3", "organizations_url": "https://api.github.com/users/ghost/orgs", "received_events_url": "https://api.github.com/users/ghost/received_events", "repos_url": "https://api.github.com/users/ghost/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ghost/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ghost/subscriptions", "type": "User", "url": "https://api.github.com/users/ghost", "user_view_type": "public" }
[]
closed
false
null
[]
null
1
2016-07-27T02:37:41Z
2016-07-27T02:40:10Z
2016-07-27T02:40:10Z
NONE
null
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3443/reactions" }
https://api.github.com/repos/psf/requests/issues/3443/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3443.diff", "html_url": "https://github.com/psf/requests/pull/3443", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3443.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3443" }
true
[ "I don't think these particular changes are helpful. Thank you though!\n" ]
https://api.github.com/repos/psf/requests/issues/3442
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3442/labels{/name}
https://api.github.com/repos/psf/requests/issues/3442/comments
https://api.github.com/repos/psf/requests/issues/3442/events
https://github.com/psf/requests/pull/3442
167,667,723
MDExOlB1bGxSZXF1ZXN0Nzg4OTQwNzc=
3,442
removing incorrect param from resolve_redirects call
{ "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
2016-07-26T17:40:58Z
2021-09-08T03:00:56Z
2016-07-26T20:16:38Z
MEMBER
resolved
This fixes the failing test I brought up [here](https://github.com/kennethreitz/requests/pull/3417#issuecomment-233136908). 4dfe7a4 removed the `req` param from `resolve_redirects` in favor of calling `response.request` in the method. The test wasn't updated though, so the request param is being assigned to `stream` which should be a boolean. This is causing the `test_requests_are_updated_each_time` test to fail. Edit: Sorry, I overlooked that this was addressed in 4dfe7a4 but accidentally reverted in 18b26d2.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3442/reactions" }
https://api.github.com/repos/psf/requests/issues/3442/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3442.diff", "html_url": "https://github.com/psf/requests/pull/3442", "merged_at": "2016-07-26T20:16:38Z", "patch_url": "https://github.com/psf/requests/pull/3442.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3442" }
true
[]
https://api.github.com/repos/psf/requests/issues/3441
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3441/labels{/name}
https://api.github.com/repos/psf/requests/issues/3441/comments
https://api.github.com/repos/psf/requests/issues/3441/events
https://github.com/psf/requests/pull/3441
167,594,441
MDExOlB1bGxSZXF1ZXN0Nzg4NDIxNjc=
3,441
Spelling fixes
{ "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
1
2016-07-26T12:24:57Z
2021-09-08T03:00:56Z
2016-07-26T12:26:18Z
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/3441/reactions" }
https://api.github.com/repos/psf/requests/issues/3441/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3441.diff", "html_url": "https://github.com/psf/requests/pull/3441", "merged_at": "2016-07-26T12:26:18Z", "patch_url": "https://github.com/psf/requests/pull/3441.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3441" }
true
[ "Thanks @scop!\n" ]
https://api.github.com/repos/psf/requests/issues/3440
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3440/labels{/name}
https://api.github.com/repos/psf/requests/issues/3440/comments
https://api.github.com/repos/psf/requests/issues/3440/events
https://github.com/psf/requests/issues/3440
167,507,984
MDU6SXNzdWUxNjc1MDc5ODQ=
3,440
typo in the documentation(requests.codes.ok)
{ "avatar_url": "https://avatars.githubusercontent.com/u/11005974?v=4", "events_url": "https://api.github.com/users/walkerlala/events{/privacy}", "followers_url": "https://api.github.com/users/walkerlala/followers", "following_url": "https://api.github.com/users/walkerlala/following{/other_user}", "gists_url": "https://api.github.com/users/walkerlala/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/walkerlala", "id": 11005974, "login": "walkerlala", "node_id": "MDQ6VXNlcjExMDA1OTc0", "organizations_url": "https://api.github.com/users/walkerlala/orgs", "received_events_url": "https://api.github.com/users/walkerlala/received_events", "repos_url": "https://api.github.com/users/walkerlala/repos", "site_admin": false, "starred_url": "https://api.github.com/users/walkerlala/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/walkerlala/subscriptions", "type": "User", "url": "https://api.github.com/users/walkerlala", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-26T02:29:46Z
2021-09-08T17:05:22Z
2016-07-26T04:50:04Z
NONE
resolved
In Requests document, I [find a typo](http://docs.python-requests.org/en/master/user/quickstart/#response-status-codes) ``` >>> r.status_code = requests.codes.ok >>> True ``` It should be: ``` >>> r.status_code = requests.status_code.codes.ok ``` It's minor, but you may want to fix it :)
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3440/reactions" }
https://api.github.com/repos/psf/requests/issues/3440/timeline
null
completed
null
null
false
[ "`requests.codes.ok` will actually work in this case because it is [imported in requests' `__init__.py`](https://github.com/kennethreitz/requests/blob/master/requests/__init__.py#L67). That way you won't need to reference the module in order to access the `codes` LookupDict.\n", "@nateprewitt is correct. Thanks for reaching out, though @walkerlala!\n" ]
https://api.github.com/repos/psf/requests/issues/3439
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3439/labels{/name}
https://api.github.com/repos/psf/requests/issues/3439/comments
https://api.github.com/repos/psf/requests/issues/3439/events
https://github.com/psf/requests/pull/3439
167,144,377
MDExOlB1bGxSZXF1ZXN0Nzg1NDg4OTY=
3,439
Put the failing URL into the default RequestException string (issue 3430)
{ "avatar_url": "https://avatars.githubusercontent.com/u/7074165?v=4", "events_url": "https://api.github.com/users/dhduvall/events{/privacy}", "followers_url": "https://api.github.com/users/dhduvall/followers", "following_url": "https://api.github.com/users/dhduvall/following{/other_user}", "gists_url": "https://api.github.com/users/dhduvall/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dhduvall", "id": 7074165, "login": "dhduvall", "node_id": "MDQ6VXNlcjcwNzQxNjU=", "organizations_url": "https://api.github.com/users/dhduvall/orgs", "received_events_url": "https://api.github.com/users/dhduvall/received_events", "repos_url": "https://api.github.com/users/dhduvall/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dhduvall/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dhduvall/subscriptions", "type": "User", "url": "https://api.github.com/users/dhduvall", "user_view_type": "public" }
[]
closed
true
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" }
[ { "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" } ]
null
6
2016-07-22T22:27:38Z
2021-09-08T03:00:54Z
2016-08-04T17:21:49Z
NONE
resolved
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3439/reactions" }
https://api.github.com/repos/psf/requests/issues/3439/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3439.diff", "html_url": "https://github.com/psf/requests/pull/3439", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3439.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3439" }
true
[ "I'm happy enough with this: :+1:\n", "To be clear, I assigned @kennethreitz to this because I think this is something he's going to care about and have opinions about. I'm fine with this but I'll leave it to him to merge.\n", "#3430\n", "An example of what this would actually look like in practice would be nice. I'm not going to interrupt my workflow at the moment to download and see for myself. Maybe in a few days I will be. \n", "At some point between 2.7.0 and 2.8.0, doing something like `requests.Session().request(\"GET\", \"http://badhostname/\")` went from dropping\n\n```\nTraceback (most recent call last):\n File \"<string>\", line 1, in <module>\n File \"/usr/lib/python2.7/vendor-packages/requests/sessions.py\", line 464, in request\n resp = self.send(prep, **send_kwargs)\n File \"/usr/lib/python2.7/vendor-packages/requests/sessions.py\", line 576, in send\n r = adapter.send(request, **kwargs)\n File \"/usr/lib/python2.7/vendor-packages/requests/adapters.py\", line 415, in send\n raise ConnectionError(err, request=request)\nrequests.exceptions.ConnectionError: ('Connection aborted.', gaierror(8, 'node name or service name not known'))\n```\n\nto\n\n```\nTraceback (most recent call last):\n File \"<string>\", line 1, in <module>\n File \"requests/sessions.py\", line 471, in request\n resp = self.send(prep, **send_kwargs)\n File \"requests/sessions.py\", line 581, in send\n r = adapter.send(request, **kwargs)\n File \"requests/adapters.py\", line 481, in send\n raise ConnectionError(e, request=request)\nrequests.exceptions.ConnectionError: HTTPConnectionPool(host='badhostname', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0xed5ac0ec>: Failed to establish a new connection: [Errno 8] node name or service name not known',))\n```\n\nSame with connecting to a bad port on a good hostname, which was my original itch. That's probably good enough for me, and just prepending the URL isn't super readable anymore, since it adds to an already very long line. My apologies for making noise when an upgrade would have been sufficient (we've been on 2.6.0, but will be upgrading to 2.9 soon).\n", "Thanks for following up @dhduvall, and thanks for the work, even though we will probably no longer accept it. =)\n" ]
https://api.github.com/repos/psf/requests/issues/3431
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3431/labels{/name}
https://api.github.com/repos/psf/requests/issues/3431/comments
https://api.github.com/repos/psf/requests/issues/3431/events
https://github.com/psf/requests/issues/3431
166,975,655
MDU6SXNzdWUxNjY5NzU2NTU=
3,431
SSLError: EOF occurred in violation of protocol (_ssl.c:590)
{ "avatar_url": "https://avatars.githubusercontent.com/u/20591671?v=4", "events_url": "https://api.github.com/users/JonahCun/events{/privacy}", "followers_url": "https://api.github.com/users/JonahCun/followers", "following_url": "https://api.github.com/users/JonahCun/following{/other_user}", "gists_url": "https://api.github.com/users/JonahCun/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/JonahCun", "id": 20591671, "login": "JonahCun", "node_id": "MDQ6VXNlcjIwNTkxNjcx", "organizations_url": "https://api.github.com/users/JonahCun/orgs", "received_events_url": "https://api.github.com/users/JonahCun/received_events", "repos_url": "https://api.github.com/users/JonahCun/repos", "site_admin": false, "starred_url": "https://api.github.com/users/JonahCun/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/JonahCun/subscriptions", "type": "User", "url": "https://api.github.com/users/JonahCun", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2016-07-22T06:00:11Z
2021-09-08T15:00:46Z
2016-07-22T06:03:54Z
NONE
resolved
Hi Guys, I was using the maps absolutely fine last night. anyway this morning when I wake up I get this error? The problems start when the debugger pin code is shown.. any ideas how to get around this? Thanks Jonah - Debugger pin code: 315-030-935 Exception in thread search_thread: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run self.__target(_self.__args, *_self.__kwargs) File "example.py", line 581, in main api_endpoint, access_token, profile_response = login(args) File "example.py", line 92, in memoizer cache[key] = obj(_args, *_kwargs) File "example.py", line 514, in login access_token = get_token(args.auth_service, args.username, global_password) File "example.py", line 429, in get_token global_token = login_ptc(username, password) File "example.py", line 331, in login_ptc r = SESSION.get(LOGIN_URL, headers=head) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 487, in get return self.request('GET', url, *_kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, *_send_kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 585, in send r = adapter.send(request, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 477, in send raise SSLError(e, request=request) SSLError: EOF occurred in violation of protocol (_ssl.c:590)
{ "avatar_url": "https://avatars.githubusercontent.com/u/20591671?v=4", "events_url": "https://api.github.com/users/JonahCun/events{/privacy}", "followers_url": "https://api.github.com/users/JonahCun/followers", "following_url": "https://api.github.com/users/JonahCun/following{/other_user}", "gists_url": "https://api.github.com/users/JonahCun/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/JonahCun", "id": 20591671, "login": "JonahCun", "node_id": "MDQ6VXNlcjIwNTkxNjcx", "organizations_url": "https://api.github.com/users/JonahCun/orgs", "received_events_url": "https://api.github.com/users/JonahCun/received_events", "repos_url": "https://api.github.com/users/JonahCun/repos", "site_admin": false, "starred_url": "https://api.github.com/users/JonahCun/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/JonahCun/subscriptions", "type": "User", "url": "https://api.github.com/users/JonahCun", "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/3431/reactions" }
https://api.github.com/repos/psf/requests/issues/3431/timeline
null
completed
null
null
false
[]
https://api.github.com/repos/psf/requests/issues/3430
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3430/labels{/name}
https://api.github.com/repos/psf/requests/issues/3430/comments
https://api.github.com/repos/psf/requests/issues/3430/events
https://github.com/psf/requests/issues/3430
166,946,805
MDU6SXNzdWUxNjY5NDY4MDU=
3,430
better default exception strings
{ "avatar_url": "https://avatars.githubusercontent.com/u/7074165?v=4", "events_url": "https://api.github.com/users/dhduvall/events{/privacy}", "followers_url": "https://api.github.com/users/dhduvall/followers", "following_url": "https://api.github.com/users/dhduvall/following{/other_user}", "gists_url": "https://api.github.com/users/dhduvall/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dhduvall", "id": 7074165, "login": "dhduvall", "node_id": "MDQ6VXNlcjcwNzQxNjU=", "organizations_url": "https://api.github.com/users/dhduvall/orgs", "received_events_url": "https://api.github.com/users/dhduvall/received_events", "repos_url": "https://api.github.com/users/dhduvall/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dhduvall/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dhduvall/subscriptions", "type": "User", "url": "https://api.github.com/users/dhduvall", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-07-22T00:27:17Z
2021-09-08T16:00:38Z
2016-08-05T07:44:42Z
NONE
resolved
I'm getting a bunch of stack traces from an app (various OpenStack componentry) which end with the following message ``` ConnectionError: ('Connection aborted.', error(146, 'ECONNREFUSED')) ``` or something similar. In all cases, the underlying problem is bad administrative configuration -- that is, not strictly a bug in either the app or in requests -- but the message is so vague that it's a huge pain in the ass to try to track down what it was trying to connect to when it failed. Sometimes by looking at the stack trace I can figure out what it was trying to do, but not always. I could go and patch the apps to catch exceptions from requests and have it print out the URL, but that's potentially a lot of places. I was wondering if it would make sense to have a `__str__()` method for `RequestException` that would spit out the URL in addition to the basic junk from `IOError`. I tried ``` def __str__(self): s = super(RequestException, self).__str__() return "%s: %s" % (self.request.url, s) ``` and it did what I expected, at least for the one test case of connecting to an unlistened-on port. I'm not looking for end-user-appropriate strings like in issue #2876, but just something to help out a reasonably savvy administrator unscared of things like stack traces and other gobbledygook, but short on time and patience to go figure out what the software should be telling her anyway. Obviously more information might be necessary to diagnose certain problems, since the problem might be related to the request data, or other possibly large data, which you almost certainly would never want to show by default, but usually the requested URL is a useful point of information. Thoughts?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3430/reactions" }
https://api.github.com/repos/psf/requests/issues/3430/timeline
null
completed
null
null
false
[ "So, as a person who contributes to OpenStack, I'll say this:\n\nThe fact that you're seeing an exception from Requests is a serious problem. Whatever service you're using, might be logging these but should also be logging (with it) an explanation of what happened. Granted, it's OpenStack, so I really shouldn't expect that level of quality, but this is (in my opinion) more of a bug in whatever service caused you this grief than in Requests.\n\n---\n\nThe above aside, I'm +0 on this. I really think our exception messages aren't ever meant for anyone other than the developer who is writing the application using requests, but I can imagine how this _might_ be useful. I'm not +1 on this because we've been trying to attach request objects to most of these errors as it is, so if developers are going to log Requests' exceptions they can display information about the request too.\n", "I'm not averse to this in principle. I suspect we'll find getting this right across things like redirects is a bit tricky, but we can worry about that when we do it. If you want to submit a patch, @dhduvall, I'll review it. =)\n", "I completely agree that the up-stack application should be doing a better job of handling exceptions. But, like you, @sigmavirus24, I'm not about to expect that from OpenStack, and given how prevalent the problem is, it seems like some relief could be found in the common code, even if it's not an actual fix to the real bug(s) here.\n\nThere are a couple of exceptions raised that IMO should include the URL but don't, and don't provide a request object (`InvalidURL` instances seem to be where that would be the most useful). They should probably just have their message strings rewritten, but my initial attempt won't try to change that.\n" ]
https://api.github.com/repos/psf/requests/issues/3429
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3429/labels{/name}
https://api.github.com/repos/psf/requests/issues/3429/comments
https://api.github.com/repos/psf/requests/issues/3429/events
https://github.com/psf/requests/pull/3429
166,628,804
MDExOlB1bGxSZXF1ZXN0NzgxODEwNjI=
3,429
Docstring cleanup
{ "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
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" }
[ { "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" } ]
null
4
2016-07-20T16:48:01Z
2021-09-08T03:00:50Z
2016-07-20T22:38:39Z
MEMBER
resolved
This is adding in mostly cosmetic fixes to docstrings, including some sphinx additions. I think these will help catch docstring style choices that are determined by looking at the function above or below where you're adding your new one. This is part two of two for #3427.
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "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/3429/reactions" }
https://api.github.com/repos/psf/requests/issues/3429/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3429.diff", "html_url": "https://github.com/psf/requests/pull/3429", "merged_at": "2016-07-20T22:38:39Z", "patch_url": "https://github.com/psf/requests/pull/3429.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3429" }
true
[ "Left a note. \n", "Commit removing whitespace between docstrings and code is removed. I did have another question regarding the acceptability of an extra blank line before the closing `\"\"\"` of a docstring.\n\n[e.g.](https://github.com/kennethreitz/requests/pull/3429/files#diff-375a14e45cf81919afe573d3a1364c09L41)\n", "These all look rather straightforward.\n", ":sparkles: :cake: :sparkles:\n" ]
https://api.github.com/repos/psf/requests/issues/3428
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3428/labels{/name}
https://api.github.com/repos/psf/requests/issues/3428/comments
https://api.github.com/repos/psf/requests/issues/3428/events
https://github.com/psf/requests/pull/3428
166,628,079
MDExOlB1bGxSZXF1ZXN0NzgxODA1NjI=
3,428
adding in pep8 fixes
{ "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
3
2016-07-20T16:44:21Z
2021-09-08T03:00:50Z
2016-07-20T16:47:00Z
MEMBER
resolved
Cleaning up some of the pep8 issues in the code. This isn't exhaustive, but the ones that I felt were either obvious (whitespaces, blank lines) or made the code more compliant with [Kenneth Reitz's Code Style™](http://docs.python-requests.org/en/latest/dev/contributing/#kenneth-reitz-s-code-style).
{ "avatar_url": "https://avatars.githubusercontent.com/u/119893?v=4", "events_url": "https://api.github.com/users/kennethreitz/events{/privacy}", "followers_url": "https://api.github.com/users/kennethreitz/followers", "following_url": "https://api.github.com/users/kennethreitz/following{/other_user}", "gists_url": "https://api.github.com/users/kennethreitz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/kennethreitz", "id": 119893, "login": "kennethreitz", "node_id": "MDQ6VXNlcjExOTg5Mw==", "organizations_url": "https://api.github.com/users/kennethreitz/orgs", "received_events_url": "https://api.github.com/users/kennethreitz/received_events", "repos_url": "https://api.github.com/users/kennethreitz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/kennethreitz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/kennethreitz/subscriptions", "type": "User", "url": "https://api.github.com/users/kennethreitz", "user_view_type": "public" }
{ "+1": 0, "-1": 0, "confused": 0, "eyes": 0, "heart": 1, "hooray": 0, "laugh": 0, "rocket": 0, "total_count": 1, "url": "https://api.github.com/repos/psf/requests/issues/3428/reactions" }
https://api.github.com/repos/psf/requests/issues/3428/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3428.diff", "html_url": "https://github.com/psf/requests/pull/3428", "merged_at": "2016-07-20T16:47:00Z", "patch_url": "https://github.com/psf/requests/pull/3428.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3428" }
true
[ "This is part one of two in #3427.\n", "These are all great. \n", ":sparkles: :cake: :sparkles:\n" ]
https://api.github.com/repos/psf/requests/issues/3427
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3427/labels{/name}
https://api.github.com/repos/psf/requests/issues/3427/comments
https://api.github.com/repos/psf/requests/issues/3427/events
https://github.com/psf/requests/issues/3427
166,627,168
MDU6SXNzdWUxNjY2MjcxNjg=
3,427
Code Consistency Work
{ "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
4
2016-07-20T16:39:57Z
2021-09-08T17:05:23Z
2016-07-20T22:45:47Z
MEMBER
resolved
This is a combination of two passes over the code to help cleanup some of the coding style differences that have creeped in over time. It's mostly cosmetic but I think it'll help reduce inconsistencies going forward by having the code be an example for future contributors. Per @Lukasa's request, I'm going to break this up into two pull requests. One involving docstrings and the other involving pep8 fixes. I don't know that these changes are necessarily "correct", I simply chose what appeared to be the most common occurrence in the code. I'm sure @kennethreitz will have opinions on which choices are best.
{ "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/3427/reactions" }
https://api.github.com/repos/psf/requests/issues/3427/timeline
null
completed
null
null
false
[ "Is this supposed to be a pull request?\n", "@kennethreitz, I kinda want you to take the lead on code review for this: just flag changes you don't like and I'm sure @nateprewitt will undo it.\n", "Nah, it's an umbrella issue that'll cover two PRs.\n", "👍 \n" ]
https://api.github.com/repos/psf/requests/issues/3426
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3426/labels{/name}
https://api.github.com/repos/psf/requests/issues/3426/comments
https://api.github.com/repos/psf/requests/issues/3426/events
https://github.com/psf/requests/pull/3426
166,620,325
MDExOlB1bGxSZXF1ZXN0NzgxNzUwMTA=
3,426
converting hasattr usages to getattr
{ "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
10
2016-07-20T16:08:10Z
2021-09-05T00:07:17Z
2016-07-20T17:33:12Z
MEMBER
resolved
This spawned off of [an article](https://hynek.me/articles/hasattr/) @Lukasa brought up in another PR. These changes should fix the pitfalls with using `hasattr` by converting their logic to use `getattr` instead.
{ "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/3426/reactions" }
https://api.github.com/repos/psf/requests/issues/3426/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3426.diff", "html_url": "https://github.com/psf/requests/pull/3426", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3426.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3426" }
true
[ "Ok, changes have been implemented.\n", "What is the point of this? Because of the way properties are actually namespaced in Python 2?\n", "@kennethreitz Same reason: https://hynek.me/articles/hasattr/\n", "Yeah, I read the article. I still don't see why we're making these changes. \n", "The short answer is: because it marginally reduces the likelihood of us encountering bugs and tripping over errors. They're not mandatory, but from my perspective they don't hurt.\n", "Well, my opinion is that this is an extremely easy to comprehend built-in function that is not causing us any problems (obviously), and removing all use of it suddenly (and making the code ugly in the process) is a bit reactionary and either some strange form of premature optimization or simply silliness. \n\nThe first change in this diff is the only one I like (in `adapters.py`). \n", "This was thrown together mostly as a nice-to-have. I agree that `is not None` is kind of an ugly idiom in this context, but figured covering the accidental execution may be helpful. I'm fine either paring this down to the diff you like (could we get a link to that one?) or closing it, if the clutter is determined to outweigh the edge case.\n", "P.S. there are no pitfalls to `hasattr`, it's doing exactly what it's supposed to do. Properties are weird in Python 2, and if you want to pin \"pitfalls\" on anything, it should be them. `hasattr` works exactly as expected, which can be seen if you use it against a property's actual getter or setter methods. \n", "I'm -10, but I'm not the only one here. I'm just sort of shocked this got so far :)\n", "I'll go ahead and close this for now. Let me know if there's any use in the `adapters.py` change and I'll rebase this commit.\n" ]
https://api.github.com/repos/psf/requests/issues/3425
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3425/labels{/name}
https://api.github.com/repos/psf/requests/issues/3425/comments
https://api.github.com/repos/psf/requests/issues/3425/events
https://github.com/psf/requests/pull/3425
166,615,309
MDExOlB1bGxSZXF1ZXN0NzgxNzE0OTQ=
3,425
Proposed/3.0.0
{ "avatar_url": "https://avatars.githubusercontent.com/u/16962997?v=4", "events_url": "https://api.github.com/users/Ricke21/events{/privacy}", "followers_url": "https://api.github.com/users/Ricke21/followers", "following_url": "https://api.github.com/users/Ricke21/following{/other_user}", "gists_url": "https://api.github.com/users/Ricke21/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Ricke21", "id": 16962997, "login": "Ricke21", "node_id": "MDQ6VXNlcjE2OTYyOTk3", "organizations_url": "https://api.github.com/users/Ricke21/orgs", "received_events_url": "https://api.github.com/users/Ricke21/received_events", "repos_url": "https://api.github.com/users/Ricke21/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Ricke21/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Ricke21/subscriptions", "type": "User", "url": "https://api.github.com/users/Ricke21", "user_view_type": "public" }
[]
closed
true
null
[]
null
0
2016-07-20T15:47:43Z
2021-09-08T03:00:57Z
2016-07-20T15:48:31Z
NONE
resolved
Change exception and variable names so that tests will run.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3425/reactions" }
https://api.github.com/repos/psf/requests/issues/3425/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3425.diff", "html_url": "https://github.com/psf/requests/pull/3425", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3425.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3425" }
true
[]
https://api.github.com/repos/psf/requests/issues/3424
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3424/labels{/name}
https://api.github.com/repos/psf/requests/issues/3424/comments
https://api.github.com/repos/psf/requests/issues/3424/events
https://github.com/psf/requests/issues/3424
166,246,860
MDU6SXNzdWUxNjYyNDY4NjA=
3,424
When using Session.send on a prepared request, session hooks aren't dispatched
{ "avatar_url": "https://avatars.githubusercontent.com/u/10525230?v=4", "events_url": "https://api.github.com/users/13steinj/events{/privacy}", "followers_url": "https://api.github.com/users/13steinj/followers", "following_url": "https://api.github.com/users/13steinj/following{/other_user}", "gists_url": "https://api.github.com/users/13steinj/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/13steinj", "id": 10525230, "login": "13steinj", "node_id": "MDQ6VXNlcjEwNTI1MjMw", "organizations_url": "https://api.github.com/users/13steinj/orgs", "received_events_url": "https://api.github.com/users/13steinj/received_events", "repos_url": "https://api.github.com/users/13steinj/repos", "site_admin": false, "starred_url": "https://api.github.com/users/13steinj/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/13steinj/subscriptions", "type": "User", "url": "https://api.github.com/users/13steinj", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-19T04:44:10Z
2021-09-08T17:05:24Z
2016-07-19T10:26:15Z
CONTRIBUTOR
resolved
https://github.com/kennethreitz/requests/blob/bca205e9bf60adbf578ef15958c872bfedcbdc60/requests/sessions.py#L568 I'm unsure if this is intentional or not, just had a problem given a session level hook didn't run. Hooks are merged when [preparing the request](https://github.com/kennethreitz/requests/blob/bca205e9bf60adbf578ef15958c872bfedcbdc60/requests/sessions.py#L396), but any requests prepared by the user manually and then sent via Session.send don't run session level hooks.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3424/reactions" }
https://api.github.com/repos/psf/requests/issues/3424/timeline
null
completed
null
null
false
[ "This is intentional. [Per the documentation](http://docs.python-requests.org/en/master/user/advanced/#prepared-requests), if you want the advantages of a Session you need to use the `Session.prepare_request` method.\n" ]
https://api.github.com/repos/psf/requests/issues/3423
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3423/labels{/name}
https://api.github.com/repos/psf/requests/issues/3423/comments
https://api.github.com/repos/psf/requests/issues/3423/events
https://github.com/psf/requests/issues/3423
166,159,788
MDU6SXNzdWUxNjYxNTk3ODg=
3,423
iter_content() not actually reading/raising exception
{ "avatar_url": "https://avatars.githubusercontent.com/u/6320683?v=4", "events_url": "https://api.github.com/users/dvasseur/events{/privacy}", "followers_url": "https://api.github.com/users/dvasseur/followers", "following_url": "https://api.github.com/users/dvasseur/following{/other_user}", "gists_url": "https://api.github.com/users/dvasseur/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/dvasseur", "id": 6320683, "login": "dvasseur", "node_id": "MDQ6VXNlcjYzMjA2ODM=", "organizations_url": "https://api.github.com/users/dvasseur/orgs", "received_events_url": "https://api.github.com/users/dvasseur/received_events", "repos_url": "https://api.github.com/users/dvasseur/repos", "site_admin": false, "starred_url": "https://api.github.com/users/dvasseur/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/dvasseur/subscriptions", "type": "User", "url": "https://api.github.com/users/dvasseur", "user_view_type": "public" }
[]
closed
true
null
[]
null
5
2016-07-18T18:25:36Z
2021-09-08T17:05:25Z
2016-07-18T18:51:19Z
NONE
resolved
I've the following code ('stream' set to True): ``` python try: for chunk in r.iter_content(chunk_size=512 * 1024): if chunk: # filter out keep-alive new chunks f_temp.write(chunk) ``` In case of network issue, I was expecting an exception at the 'iter_content' line, but got the following stack trace: ``` python Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/urllib3/response.py", line 232, in _error_catcher yield File "/usr/lib/python3.5/site-packages/urllib3/response.py", line 314, in read data = self._fp.read(amt) File "/usr/lib/python3.5/http/client.py", line 448, in read n = self.readinto(b) File "/usr/lib/python3.5/http/client.py", line 488, in readinto n = self.fp.readinto(b) File "/usr/lib/python3.5/socket.py", line 575, in readinto return self._sock.recv_into(b) socket.timeout: timed out Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/requests/models.py", line 664, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/usr/lib/python3.5/site-packages/urllib3/response.py", line 357, in stream data = self.read(amt=amt, decode_content=decode_content) File "/usr/lib/python3.5/site-packages/urllib3/response.py", line 324, in read flush_decoder = True File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/usr/lib/python3.5/site-packages/urllib3/response.py", line 237, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='vpn.media.shagma.net', port=8888): Read timed out. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<my file>", line 434, in <my function> f_temp.write(chunk) File "/usr/lib/python3.5/site-packages/requests/models.py", line 671, in generate raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPConnectionPool(host='<my proxy address>', port=8888): Read timed out. ``` => exception is raised during .write() command, not iter_content() ? Took me a while to figure out... Is it a bug ? (python 3.5.2, requests 2.10, archlinux) side note: I just read the doc and chunk_size=None may be a better option, but should not be related to my issue, I think... :)
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3423/reactions" }
https://api.github.com/repos/psf/requests/issues/3423/timeline
null
completed
null
null
false
[ "Without knowing what `f_temp` is or being able to see how you're using requests, I don't think we can definitely say this is a bug. That said, it is very strange that you're seeing that in your call to `write`. The chunk should just be a bytes object, nothing fancy.\n", "The exception is not coming in the call to `write`. The original exception is coming in the call to `stream`. The problem is that exception tracebacks can be somewhat misleading when using generators, which you are here.\n\nThe `iter_content` method _returns_ a generator, which is where the exception is actually thrown from. Because of the way `iter_content` is structured, it actually has an inner function (called `generate`) that is called to get the returned generator. That means that, when Python attempts to reconstruct the traceback, it only gets to `generate`: nothing is holding on to the original `iter_content` call anymore.\n\nEverything is working as expected. =)\n", "@Lukasa Not sure to understand but if you say so... :)\nThat means that the traceback is wrong and the following should work (it quite hard to test here) ?\n\n``` python\ntry:\n for chunk in r.iter_content(chunk_size=512 * 1024): \n if chunk: # filter out keep-alive new chunks\n try:\n f_temp.write(chunk)\n except:\n # error during write (disk full, whatever...)\nexcept requests.exceptions.ConnectionError:\n # error during read\n```\n", "@dvasseur Yes. =)\n", "@Lukasa ok, thanks!\n" ]
https://api.github.com/repos/psf/requests/issues/3422
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3422/labels{/name}
https://api.github.com/repos/psf/requests/issues/3422/comments
https://api.github.com/repos/psf/requests/issues/3422/events
https://github.com/psf/requests/issues/3422
166,143,200
MDU6SXNzdWUxNjYxNDMyMDA=
3,422
HTTPoxy migitation
{ "avatar_url": "https://avatars.githubusercontent.com/u/426784?v=4", "events_url": "https://api.github.com/users/remram44/events{/privacy}", "followers_url": "https://api.github.com/users/remram44/followers", "following_url": "https://api.github.com/users/remram44/following{/other_user}", "gists_url": "https://api.github.com/users/remram44/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/remram44", "id": 426784, "login": "remram44", "node_id": "MDQ6VXNlcjQyNjc4NA==", "organizations_url": "https://api.github.com/users/remram44/orgs", "received_events_url": "https://api.github.com/users/remram44/received_events", "repos_url": "https://api.github.com/users/remram44/repos", "site_admin": false, "starred_url": "https://api.github.com/users/remram44/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/remram44/subscriptions", "type": "User", "url": "https://api.github.com/users/remram44", "user_view_type": "public" }
[]
closed
true
null
[]
null
4
2016-07-18T17:04:46Z
2021-09-08T17:05:25Z
2016-07-18T18:53:15Z
CONTRIBUTOR
resolved
https://httpoxy.org/ It is possible to set the `HTTP_PROXY` in CGI scripts by passing the `Proxy` header. If the script uses requests to download files, requests will happily use the attacker-supplied proxy to make requests. This should be mitigated like it is in Perl (since 2001), Ruby, and libraries like curl. I confirmed that `HTTP_PROXY` (in uppercase) is accepted as well as the conventional, lowercase `http_proxy` (requests 2.7.0)
{ "avatar_url": "https://avatars.githubusercontent.com/u/426784?v=4", "events_url": "https://api.github.com/users/remram44/events{/privacy}", "followers_url": "https://api.github.com/users/remram44/followers", "following_url": "https://api.github.com/users/remram44/following{/other_user}", "gists_url": "https://api.github.com/users/remram44/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/remram44", "id": 426784, "login": "remram44", "node_id": "MDQ6VXNlcjQyNjc4NA==", "organizations_url": "https://api.github.com/users/remram44/orgs", "received_events_url": "https://api.github.com/users/remram44/received_events", "repos_url": "https://api.github.com/users/remram44/repos", "site_admin": false, "starred_url": "https://api.github.com/users/remram44/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/remram44/subscriptions", "type": "User", "url": "https://api.github.com/users/remram44", "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/3422/reactions" }
https://api.github.com/repos/psf/requests/issues/3422/timeline
null
completed
null
null
false
[ "We've been discussing this at length in IRC. We have a complex set of opinions here, but here they are:\n1. In general, if you are running your Requests script in a location where your application allows writes to the environment, you should disable Requests' search of the environment. We have a flag for this: `Session.trust_env`. Setting it to `False` entirely and completely mitigates this risk.\n2. CGI is an _extremely_ uncommon mode for running Python code. It is stunningly inefficient, and as far as I know essentially zero Python applications are developed using it.\n3. Our search for proxies is actually done by the Python standard library. This means that the more efficient fix is in the Python standard library itself, which can mitigate the problem not just for Requests but for all the other clients in the Python standard library.\n\nI am willing to consider the possibility of raising warnings when running Requests inside a CGI process with `trust_env=True`, and I'm even willing to consider the possibility of forcing `trust_env` to `False` in such a situation, but realistically for Python code the correct solution to this is simply to _not run your applications inside CGI_.\n", "Makes sense to me. Avoiding HTTP_PROXY (uppercase) in a CGI context would probably be a good move, but if requests is not doing that directly there is probably no sense in you taking active measures. I myself only ever use wsgi. I'm gonna go ahead and close this.\n", "@remram44 For what it's worth, I would _heartily_ support a patch to the stdlib's `urllib.request` module's `getproxies` method to implement this kind of checking. That seems like a much more productive place to put the patch. =) If you want to open a bug report for that, I'll happily chime in: I may even volunteer to write the patch myself!\n", "I filed [cpython-27568](http://bugs.python.org/issue27568).\n" ]
https://api.github.com/repos/psf/requests/issues/3421
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3421/labels{/name}
https://api.github.com/repos/psf/requests/issues/3421/comments
https://api.github.com/repos/psf/requests/issues/3421/events
https://github.com/psf/requests/issues/3421
165,979,808
MDU6SXNzdWUxNjU5Nzk4MDg=
3,421
iter_content with chunk_size=None hangs when used with requests.Session on Python 3
{ "avatar_url": "https://avatars.githubusercontent.com/u/9883897?v=4", "events_url": "https://api.github.com/users/tobinus/events{/privacy}", "followers_url": "https://api.github.com/users/tobinus/followers", "following_url": "https://api.github.com/users/tobinus/following{/other_user}", "gists_url": "https://api.github.com/users/tobinus/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/tobinus", "id": 9883897, "login": "tobinus", "node_id": "MDQ6VXNlcjk4ODM4OTc=", "organizations_url": "https://api.github.com/users/tobinus/orgs", "received_events_url": "https://api.github.com/users/tobinus/received_events", "repos_url": "https://api.github.com/users/tobinus/repos", "site_admin": false, "starred_url": "https://api.github.com/users/tobinus/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tobinus/subscriptions", "type": "User", "url": "https://api.github.com/users/tobinus", "user_view_type": "public" }
[]
closed
true
null
[]
null
13
2016-07-17T14:48:02Z
2021-09-08T17:05:26Z
2016-07-17T17:04:18Z
NONE
resolved
Under some specific circumstances, a loop using `iter_content` ends up hanging after all the content has been iterated over. Specifically, all the following conditions must be met for this to occur: - You must be using Python 3 (I've tested using 2.7.11 (under which this works) and 3.3.6, 3.4.11 and 3.5.1 (under which this bug occurs). - Use `requests.Session()`, not `requests`. - Set `chunk_size=None` in `iter_content`. Here, have an example: ``` python # requests_bug.py import requests def iterate_through_streamed_content(requests_module_or_session, chunk_size): r = requests_module_or_session.get('http://example.org', stream=True) r.raise_for_status() for chunk in r.iter_content(chunk_size=chunk_size): print(len(chunk)) iterate_through_streamed_content(requests, 1024) print('requests, 1024 works') iterate_through_streamed_content(requests, None) print('requests, None works') iterate_through_streamed_content(requests.Session(), 1024) print('requests.Session(), 1024 works') iterate_through_streamed_content(requests.Session(), None) print('requests.Session(), None works') print("That's all.") ``` Output 1 (bug does not occur in Python2.7): ``` $ python --version Python 2.7.11 $ pip install -U requests Requirement already up-to-date: requests in /home/... $ python requests_bug.py 1270 requests, 1024 works 1270 requests, None works 1270 requests.Session(), 1024 works 1270 requests.Session(), None works That's all. ``` Output 2 (bug occurs in Python3.5): ``` $ python --version Python 3.5.1 $ pip install -U requests Requirement already up-to-date: requests in /home/... $ python requests_bug.py 1270 requests, 1024 works 1270 requests, None works 1270 requests.Session(), 1024 works 1270 ``` ...after which the script hangs until you do Ctrl+C. This is all done on Ubuntu 16.04, using pyenv and its virtualenv feature for testing using different Python versions. (Thank you all for requests, btw! Keep on rocking :+1: )
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3421/reactions" }
https://api.github.com/repos/psf/requests/issues/3421/timeline
null
completed
null
null
false
[ "So I can reproduce this on OSX, and it appears to be an issue in urllib3. [Here](https://github.com/shazow/urllib3/blob/master/urllib3/response.py#L361) to be more specific. The file object isn't marking itself as closed for some reason and the while loop never exits. This happens on both https://httpbin.org and http://example.org but not https://google.com, so Google is doing something to force the connection closed. I'll do a bit more digging and see if I can figure out why the stream doesn't have an EOF.\n", "Just speculation on my part, but may it be related to Keep-Alive? Considering it only occurs when using requests.Session().\n", "Ok, I can reproduce this test under test conditions in urllib3. This suggests that it's orthogonal to the use of `requests.Session`.\n", "Note as well that using `requests` directly is really no different at all: `requests.request` creates a one-off `Session` through which to run all its calls. The _real_ question is why this happens consistently on the _second_ request, which I'm stunningly unsure about at this time.\n", "While we're here, note also that this bug doesn't appear to actually be affected by timeouts, because none of the _socket_ calls take long: we're just busy-looping.\n", "So, this seems relevant:\n\n``` python\nPython 2.7.11 (default, Dec 14 2015, 09:18:27) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import httplib\n>>> hasattr(httplib.HTTPResponse, 'closed')\nFalse\n```\n\n``` python\nPython 3.5.1 (default, Dec 14 2015, 09:21:15) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import http.client\n>>> hasattr(http.client.HTTPResponse, 'closed')\nTrue\n```\n", "Note that in Python 3.5 `_close_conn` does not call `super().close()`, which means that the closed property never gets set.\n", "That's about where I am at in debugging too @Lukasa. It looks like `isclosed` is being set and will evaluate to `True` but the `closed` attribute is permanently `False`. I'm trying to figure out if this is a bug in `httplib` or `urllib3`'s use of it. Our current check in `is_fp_closed` is checking the `closed` attribute.\n", "The answer is that it doesn't really matter. =)\n\nThis behaviour is present in basically all the shipped Python 3 solutions, which means even if it's a bug we need to be bug-compatible with it. I think the best solution is simply to rely on `isclosed` if it's present, in preference to `closed`, which is then in preference to reaching in to the `fp` thing.\n\nAre you interested in writing the PR that fixes this, @nateprewitt?\n", "And, if you are: do you want my test?\n", "Yeah, I'm happy to throw something together if that'll help. Any test code would be greatly appreciated :)\n", "Ok, for now let's close this. @nateprewitt, can you open an equivalent issue on the urllib3 repository? You can use this test code as the example (it should live in `test_socketlevel.py` in the urllib3 repo):\n\n``` python\nclass TestStream(SocketDummyServerTestCase):\n def test_stream_none_unchunked_response_does_not_hang(self):\n done_event = Event()\n\n def socket_handler(listener):\n sock = listener.accept()[0]\n\n buf = b''\n while not buf.endswith(b'\\r\\n\\r\\n'):\n buf += sock.recv(65536)\n\n sock.send(\n b'HTTP/1.1 200 OK\\r\\n'\n b'Content-Length: 12\\r\\n'\n b'Content-type: text/plain\\r\\n'\n b'\\r\\n'\n b'hello, world'\n )\n done_event.wait(5)\n sock.close()\n\n self._start_server(socket_handler)\n pool = HTTPConnectionPool(self.host, self.port, retries=False)\n r = pool.request('GET', '/', timeout=1, preload_content=False)\n\n # Stream should read to the end.\n self.assertEqual([b'hello, world'], list(r.stream(None)))\n\n done_event.set()\n```\n", "Sounds good, will do.\n" ]
https://api.github.com/repos/psf/requests/issues/3420
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3420/labels{/name}
https://api.github.com/repos/psf/requests/issues/3420/comments
https://api.github.com/repos/psf/requests/issues/3420/events
https://github.com/psf/requests/pull/3420
165,775,037
MDExOlB1bGxSZXF1ZXN0Nzc2MDY5ODU=
3,420
Update connectionpool.py
{ "avatar_url": "https://avatars.githubusercontent.com/u/5911982?v=4", "events_url": "https://api.github.com/users/springjools/events{/privacy}", "followers_url": "https://api.github.com/users/springjools/followers", "following_url": "https://api.github.com/users/springjools/following{/other_user}", "gists_url": "https://api.github.com/users/springjools/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/springjools", "id": 5911982, "login": "springjools", "node_id": "MDQ6VXNlcjU5MTE5ODI=", "organizations_url": "https://api.github.com/users/springjools/orgs", "received_events_url": "https://api.github.com/users/springjools/received_events", "repos_url": "https://api.github.com/users/springjools/repos", "site_admin": false, "starred_url": "https://api.github.com/users/springjools/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/springjools/subscriptions", "type": "User", "url": "https://api.github.com/users/springjools", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-15T12:20:10Z
2021-09-08T03:00:57Z
2016-07-15T12:21:20Z
NONE
resolved
Change some spammy DEBUG logs to the proper log level.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3420/reactions" }
https://api.github.com/repos/psf/requests/issues/3420/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3420.diff", "html_url": "https://github.com/psf/requests/pull/3420", "merged_at": null, "patch_url": "https://github.com/psf/requests/pull/3420.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3420" }
true
[ "As mentioned in #3419, these logs come from the urllib3 project. Requests does not carry patches to that project: you'll need to submit this fix upstream.\n" ]
https://api.github.com/repos/psf/requests/issues/3419
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3419/labels{/name}
https://api.github.com/repos/psf/requests/issues/3419/comments
https://api.github.com/repos/psf/requests/issues/3419/events
https://github.com/psf/requests/issues/3419
165,773,971
MDU6SXNzdWUxNjU3NzM5NzE=
3,419
Requests connectionpool.py is spammy
{ "avatar_url": "https://avatars.githubusercontent.com/u/5911982?v=4", "events_url": "https://api.github.com/users/springjools/events{/privacy}", "followers_url": "https://api.github.com/users/springjools/followers", "following_url": "https://api.github.com/users/springjools/following{/other_user}", "gists_url": "https://api.github.com/users/springjools/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/springjools", "id": 5911982, "login": "springjools", "node_id": "MDQ6VXNlcjU5MTE5ODI=", "organizations_url": "https://api.github.com/users/springjools/orgs", "received_events_url": "https://api.github.com/users/springjools/received_events", "repos_url": "https://api.github.com/users/springjools/repos", "site_admin": false, "starred_url": "https://api.github.com/users/springjools/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/springjools/subscriptions", "type": "User", "url": "https://api.github.com/users/springjools", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-15T12:13:41Z
2021-09-08T17:05:27Z
2016-07-15T12:14:23Z
NONE
resolved
Connectionpool spams always when starting connection. It should be DEBUG log level and not INFO. Thank you.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3419/reactions" }
https://api.github.com/repos/psf/requests/issues/3419/timeline
null
completed
null
null
false
[ "This is a log coming from the urllib3 module, not from requests. Please open this bug report there. =)\n" ]
https://api.github.com/repos/psf/requests/issues/3418
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3418/labels{/name}
https://api.github.com/repos/psf/requests/issues/3418/comments
https://api.github.com/repos/psf/requests/issues/3418/events
https://github.com/psf/requests/issues/3418
165,754,976
MDU6SXNzdWUxNjU3NTQ5NzY=
3,418
send a lot of http request at same time?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1804755?v=4", "events_url": "https://api.github.com/users/1c7/events{/privacy}", "followers_url": "https://api.github.com/users/1c7/followers", "following_url": "https://api.github.com/users/1c7/following{/other_user}", "gists_url": "https://api.github.com/users/1c7/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/1c7", "id": 1804755, "login": "1c7", "node_id": "MDQ6VXNlcjE4MDQ3NTU=", "organizations_url": "https://api.github.com/users/1c7/orgs", "received_events_url": "https://api.github.com/users/1c7/received_events", "repos_url": "https://api.github.com/users/1c7/repos", "site_admin": false, "starred_url": "https://api.github.com/users/1c7/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/1c7/subscriptions", "type": "User", "url": "https://api.github.com/users/1c7", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-15T10:17:50Z
2021-09-08T17:05:28Z
2016-07-15T10:21:51Z
NONE
resolved
### What I have tried I already search on Google, and tried “grequest”, but grequests document is not enough, I don't know how to use it correctly. ### What I am trying to do what I am trying to do is send about 1000 http GET request, and then use "beautifulsoup"(python module) get content I want. ### Why I need send multi request once send them one by one is just too slow I want send as much as possible, maybe 30 requests in a batch? I am crawling a website, so there are really no way to cut down request number.. ### Lastly Thanks for you time on reading this post :dancer: oh, I just found out requests and grequest is same author, awesome.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3418/reactions" }
https://api.github.com/repos/psf/requests/issues/3418/timeline
null
completed
null
null
false
[ "@1c7 I'm taking this example [straight from the grequests README](https://github.com/kennethreitz/grequests):\n\n``` python\nimport grequests\n\nurls = [\n# Put all the URLs you need to get here.\n]\n\n# Create a whole series of unsent requests.\nrequests = (grequests.get(u) for u in urls)\n\n# Send them\nresponses = grequests.map(requests)\n\nfor response in responses:\n # Do whatever you need to do with the responses.\n```\n" ]
https://api.github.com/repos/psf/requests/issues/3417
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3417/labels{/name}
https://api.github.com/repos/psf/requests/issues/3417/comments
https://api.github.com/repos/psf/requests/issues/3417/events
https://github.com/psf/requests/pull/3417
165,715,784
MDExOlB1bGxSZXF1ZXN0Nzc1NjYyMjc=
3,417
raise InvalidHeader on multiple Location values
{ "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
18
2016-07-15T05:42:45Z
2021-09-08T02:10:20Z
2016-08-22T16:49:36Z
MEMBER
resolved
Addresses issue raised in #2939 with a fix for multiple Location headers in response. This currently breaks on `test_requests_are_updated_each_time` because the [`RedirectSession`](https://github.com/kennethreitz/requests/blob/proposed/3.0.0/tests/test_requests.py#L1564) populates it's `raw` attribute with `StringIO` rather than a urllib3 `HTTPResponse`. I can convert the `_build_raw` method to fix the test, if this looks like a workable solution.
{ "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/3417/reactions" }
https://api.github.com/repos/psf/requests/issues/3417/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3417.diff", "html_url": "https://github.com/psf/requests/pull/3417", "merged_at": "2016-08-22T16:49:36Z", "patch_url": "https://github.com/psf/requests/pull/3417.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3417" }
true
[ "@nateprewitt Thanks for starting this!\n\nUnfortunately, quite a lot of people use non-urllib3 file-like objects to back requests, and I'd like to avoid breaking that if we can. Can you rearrange this to support urllib3 if possible but otherwise fallback to some other behaviour, [per my comment](https://github.com/kennethreitz/requests/issues/2939#issuecomment-166003526).\n", "This looks good to me.\n", "Sadly we have no CI for this though, so one or both of us should pull this down and test it.\n", "Sorry, @sigmavirus24, I just pushed a new copy with partially finished changes. I have a couple of questions on how we're expecting the code to function that I was going to annotate for discussion.\n", "Ok, I think this is probably ready for another glance. I'm getting an `AssertionError` from `test_requests_are_updated_each_time` on line 1641, but that appears to be pre-existing in the `proposed/3.0.0` branch. I was able to reproduce it in a fresh virtualenv with `proposed/3.0.0` checked out with python 2.7.\n", "Ok, I'm happy with this. @sigmavirus24?\n", "On a quick side note, I PR'd this against `proposed/3.0.0` because of comments in the issue, but is there a reason this shouldn't go straight against `master`?\n", "@nateprewitt Yeah, this is a breaking change. =)\n", "Hey @Lukasa @sigmavirus24, just wanted to check in on this. Let me know if you're waiting on anything from me.\n", "No problem from me. @sigmavirus24?\n", "Looks fine as a start. Thanks @nateprewitt \n\n@Lukasa since we're sans CI, have you pulled this and run the tests?\n", "@sigmavirus24 I haven't, would you like me to?\n", "I'll do it. Just wanted to make sure someone was doing it.\n", "It's still failing on #3442 because I haven't rebased on to master since the merge. Let me do that really quickly.\n", "@nateprewitt I merged the original branch into the head of proposed/3.0.0 and it passed just fine. No need to rebase\n", "Oh I see you already did, effectively invalidating the tests. Let me run them again\n", "Sorry, I'd already pushed it before the message.\n", "Tests passed both times.\n" ]
https://api.github.com/repos/psf/requests/issues/3416
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3416/labels{/name}
https://api.github.com/repos/psf/requests/issues/3416/comments
https://api.github.com/repos/psf/requests/issues/3416/events
https://github.com/psf/requests/issues/3416
165,713,289
MDU6SXNzdWUxNjU3MTMyODk=
3,416
Unable to override cookie policy in Session.prepare_request
{ "avatar_url": "https://avatars.githubusercontent.com/u/5336190?v=4", "events_url": "https://api.github.com/users/bdusell/events{/privacy}", "followers_url": "https://api.github.com/users/bdusell/followers", "following_url": "https://api.github.com/users/bdusell/following{/other_user}", "gists_url": "https://api.github.com/users/bdusell/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/bdusell", "id": 5336190, "login": "bdusell", "node_id": "MDQ6VXNlcjUzMzYxOTA=", "organizations_url": "https://api.github.com/users/bdusell/orgs", "received_events_url": "https://api.github.com/users/bdusell/received_events", "repos_url": "https://api.github.com/users/bdusell/repos", "site_admin": false, "starred_url": "https://api.github.com/users/bdusell/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/bdusell/subscriptions", "type": "User", "url": "https://api.github.com/users/bdusell", "user_view_type": "public" }
[]
closed
true
null
[]
null
9
2016-07-15T05:20:27Z
2021-09-08T10:00:43Z
2017-05-23T14:51:01Z
NONE
resolved
I would like to be able to override the [cookie policy](https://docs.python.org/2.7/library/cookielib.html#cookielib.CookiePolicy) used by a `Session` when making a request or when using a `Session` to prepare a request. However, overriding the cookie policy on the cookie jar of the `Session` or of the `Request` object has had no effect. This line of code explains why: https://github.com/kennethreitz/requests/blob/master/requests/sessions.py#L377 The cookie jars of both the session and the request are merged into a newly constructed `RequestsCookieJar`, discarding the policies of both. I believe there should be a way to inject a non-default cookie policy at this point. What I expected to be able to do, and what isn't working currently, is something like the following: ``` python import requests s = requests.Session() s.cookies = requests.cookies.RequestsCookieJar(policy=MyCustomCookiePolicy()) s.get('http://httpbin.org/cookies/set?k2=v2&k1=v1') # Put some cookies in the jar r = requests.Request('GET', 'http://httpbin.org/cookies') pr = s.prepare_request(r) # Include certain cookies in the jar based on arbitrary rules # Print the request data for debugging s.send(pr) ```
{ "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/3416/reactions" }
https://api.github.com/repos/psf/requests/issues/3416/timeline
null
completed
null
null
false
[ "I think it would make sense to at least preserve the cookie policy in `merge_cookies`. This could be pretty quickly accomplished adding a line [here](https://github.com/kennethreitz/requests/blob/master/requests/cookies.py#L488) with something like:\n\n`cookiejar.set_policy(cookies._policy)`\n", "AFAIK there is no public API for getting the policy of a cookie jar (it's stored under `_policy` in `cookielib.CookieJar`).\n\nhttps://docs.python.org/2.7/library/cookielib.html#cookiejar-and-filecookiejar-objects\n", "Honestly, I'm not hugely convinced that this is an idea that's worthwhile pursuing in Requests. Generally speaking Requests aims to keep its API fairly simple, and we often don't add options when they have minimal utility (which this one does).\n\nI could _potentially_ be convinced to accept a patch to the `RequestsCookieJar` that exposes the policy publicly, allowing it to be persisted, but honestly it feels like it's pretty close to overkill.\n", "I believe the original motivation for copying the cookies to a new `RequestsCookieJar` was to avoid modifying the original cookie jar objects. This makes some sense, because if both the session and the request have jars, this would mean the cookies of one will be unexpectedly copied into the other. The authors chose to pick neither.\n\nYou could change `prepare_request` so that it always copies the request cookies into the session cookie jar, but that would be a behavioral change in requests. Perhaps a sensible alternative would be to add a public method to `Session` which constructs the blank cookie jar object, making it possible to override it?\n\n``` python\ndef empty_cookie_jar(self):\n return RequestsCookieJar()\n```\n", "@bdusell I'm _strongly_ averse to adding more methods to `Session` if they can possibly be avoided. I'd altogether be happier to have helpers on the `RequestsCookieJar` that `merge_cookies` uses.\n", "Or possibly even allow `merge_cookies` to accept a `None` in the first parameter and respond to that by copying the cookiejar in the second parameter.\n", "Okay, so one possibility is:\n1. Override `RequestsCookieJar.__init__` and `RequestsCookieJar.set_policy` to save the policy.\n2. Expose the policy through `get_policy()` or some such.\n", "So that there is something I'm much more willing to consider.\n", "This should now be resolved with #4042." ]
https://api.github.com/repos/psf/requests/issues/3415
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3415/labels{/name}
https://api.github.com/repos/psf/requests/issues/3415/comments
https://api.github.com/repos/psf/requests/issues/3415/events
https://github.com/psf/requests/pull/3415
165,706,712
MDExOlB1bGxSZXF1ZXN0Nzc1NjAzMjc=
3,415
removing redundant test
{ "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
2016-07-15T03:57:01Z
2021-09-08T03:00:50Z
2016-07-15T07:07:44Z
MEMBER
resolved
I was writing up a new test and found this comment block. Looks like it was commented out as part of a cleanup effort, but never removed. Test functionality is fulfilled by [this test](https://github.com/kennethreitz/requests/blob/master/tests/test_requests.py#L196).
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3415/reactions" }
https://api.github.com/repos/psf/requests/issues/3415/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3415.diff", "html_url": "https://github.com/psf/requests/pull/3415", "merged_at": "2016-07-15T07:07:44Z", "patch_url": "https://github.com/psf/requests/pull/3415.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3415" }
true
[ "Thanks @nateprewitt! :sparkles: :cake: :sparkles:\n" ]
https://api.github.com/repos/psf/requests/issues/3414
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3414/labels{/name}
https://api.github.com/repos/psf/requests/issues/3414/comments
https://api.github.com/repos/psf/requests/issues/3414/events
https://github.com/psf/requests/issues/3414
165,698,556
MDU6SXNzdWUxNjU2OTg1NTY=
3,414
Max retries exceeded with url
{ "avatar_url": "https://avatars.githubusercontent.com/u/20178234?v=4", "events_url": "https://api.github.com/users/seu1tyz/events{/privacy}", "followers_url": "https://api.github.com/users/seu1tyz/followers", "following_url": "https://api.github.com/users/seu1tyz/following{/other_user}", "gists_url": "https://api.github.com/users/seu1tyz/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/seu1tyz", "id": 20178234, "login": "seu1tyz", "node_id": "MDQ6VXNlcjIwMTc4MjM0", "organizations_url": "https://api.github.com/users/seu1tyz/orgs", "received_events_url": "https://api.github.com/users/seu1tyz/received_events", "repos_url": "https://api.github.com/users/seu1tyz/repos", "site_admin": false, "starred_url": "https://api.github.com/users/seu1tyz/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/seu1tyz/subscriptions", "type": "User", "url": "https://api.github.com/users/seu1tyz", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-15T02:26:13Z
2021-09-08T17:05:28Z
2016-07-15T12:05:58Z
NONE
resolved
when I intend to grab PAge It raise the error.
{ "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/3414/reactions" }
https://api.github.com/repos/psf/requests/issues/3414/timeline
null
completed
null
null
false
[ "@seu1tyz You need to provide substantially more information than this for us to be able to help you. Please read [this document](https://github.com/kennethreitz/requests/blob/master/CONTRIBUTING.md) and answer the questions it asks.\n" ]
https://api.github.com/repos/psf/requests/issues/3403
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3403/labels{/name}
https://api.github.com/repos/psf/requests/issues/3403/comments
https://api.github.com/repos/psf/requests/issues/3403/events
https://github.com/psf/requests/issues/3403
165,611,128
MDU6SXNzdWUxNjU2MTExMjg=
3,403
"hostname doesn't match" error while requesting IP address directly and setting host header (HTTPS)
{ "avatar_url": "https://avatars.githubusercontent.com/u/20462409?v=4", "events_url": "https://api.github.com/users/huoneefi/events{/privacy}", "followers_url": "https://api.github.com/users/huoneefi/followers", "following_url": "https://api.github.com/users/huoneefi/following{/other_user}", "gists_url": "https://api.github.com/users/huoneefi/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/huoneefi", "id": 20462409, "login": "huoneefi", "node_id": "MDQ6VXNlcjIwNDYyNDA5", "organizations_url": "https://api.github.com/users/huoneefi/orgs", "received_events_url": "https://api.github.com/users/huoneefi/received_events", "repos_url": "https://api.github.com/users/huoneefi/repos", "site_admin": false, "starred_url": "https://api.github.com/users/huoneefi/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/huoneefi/subscriptions", "type": "User", "url": "https://api.github.com/users/huoneefi", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-07-14T17:05:44Z
2021-09-08T17:05:27Z
2016-07-17T12:05:54Z
NONE
resolved
In an application, I can't use DNS resolving. So I request the IP address directly while setting the host header (vhosts). In this case, SSL certificate validation (/SNI) doesn't work properly because it doesn't respect the explicitly set host header: Python 2.7.11: ``` python >>> import requests >>> requests.__version__ '2.10.0' >>> requests.get(url="http://example.org") <Response [200]> >>> requests.get(url="https://example.org") <Response [200]> >>> requests.get(url="http://93.184.216.34", headers={"Host": "example.org"}) <Response [200]> >>> requests.get(url="https://93.184.216.34", headers={"Host": "example.org"}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "[...]/requests/api.py", line 71, in get return request('get', url, params=params, **kwargs) File "[...]/requests/api.py", line 57, in request return session.request(method=method, url=url, **kwargs) File "[...]/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "[...]/requests/sessions.py", line 585, in send r = adapter.send(request, **kwargs) File "[...]/requests/adapters.py", line 477, in send raise SSLError(e, request=request) requests.exceptions.SSLError: hostname '93.184.216.34' doesn't match either of 'www.example.org', 'example.com', 'example.edu', 'example.net', 'example.org', 'www.example.com', 'www.example.edu', 'www.example.net' ```
{ "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/3403/reactions" }
https://api.github.com/repos/psf/requests/issues/3403/timeline
null
completed
null
null
false
[ "This is intended and expected behavior, at the moment. \n\nThe host header is simply a semantic of HTTP, not of the connection you are making, and has no effect on the underlying TLS mechanisms. \n\nRequests could build additional supplemental functionality around this, to support this rare use-case, but has opted not to so far. It's most likely that the end result would be a custom ConnectionAdapter that would need to be utilized to enable this behavior. \n", "That being said, you should be able to build this ConnectionAdapter yourself. I think it would make a great addition to the Requests-Toolbelt. \n\nhttps://github.com/sigmavirus24/requests-toolbelt\n", "Thank you for your thoughts about this issue. I implemented an Adapter and created a pull request to requests-toolbelt: https://github.com/sigmavirus24/requests-toolbelt/pull/157\n" ]
https://api.github.com/repos/psf/requests/issues/3402
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3402/labels{/name}
https://api.github.com/repos/psf/requests/issues/3402/comments
https://api.github.com/repos/psf/requests/issues/3402/events
https://github.com/psf/requests/pull/3402
165,594,640
MDExOlB1bGxSZXF1ZXN0Nzc0Nzk1MzY=
3,402
Remove duplicate import warnings
{ "avatar_url": "https://avatars.githubusercontent.com/u/1638561?v=4", "events_url": "https://api.github.com/users/HarrisonJackson/events{/privacy}", "followers_url": "https://api.github.com/users/HarrisonJackson/followers", "following_url": "https://api.github.com/users/HarrisonJackson/following{/other_user}", "gists_url": "https://api.github.com/users/HarrisonJackson/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/HarrisonJackson", "id": 1638561, "login": "HarrisonJackson", "node_id": "MDQ6VXNlcjE2Mzg1NjE=", "organizations_url": "https://api.github.com/users/HarrisonJackson/orgs", "received_events_url": "https://api.github.com/users/HarrisonJackson/received_events", "repos_url": "https://api.github.com/users/HarrisonJackson/repos", "site_admin": false, "starred_url": "https://api.github.com/users/HarrisonJackson/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/HarrisonJackson/subscriptions", "type": "User", "url": "https://api.github.com/users/HarrisonJackson", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-14T15:49:18Z
2021-09-08T03:00:58Z
2016-07-14T16:59:51Z
CONTRIBUTOR
resolved
Just reading through the source and found this dupe import - is it intentional? After running the tests locally before and after nothing fails... but there is some extra output as the test runs. Before: ``` make test # This runs all of the tests. To run an individual test, run py.test with # the -k flag, like "py.test -k test_path_is_not_double_encoded" py.test tests ======================================= test session starts ======================================= platform darwin -- Python 2.7.11, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 rootdir: /Users/harrisonjackson/Zapier/requests, inifile: plugins: cov-2.2.1, httpbin-0.2.0, mock-0.11.0 collected 357 items tests/test_hooks.py ... tests/test_lowlevel.py ......... tests/test_requests.py ................................................................................................................................X.........127.0.0.1 - - [14/Jul/2016 09:42:31] "GET /stream/4 HTTP/1.1" 200 1080 X................................................... tests/test_structures.py .................... tests/test_testserver.py ........... tests/test_utils.py ............................................................................................................................ ============================= 355 passed, 2 xpassed in 42.56 seconds ============================== ``` After: ``` make test # This runs all of the tests. To run an individual test, run py.test with # the -k flag, like "py.test -k test_path_is_not_double_encoded" py.test tests ======================================= test session starts ======================================= platform darwin -- Python 2.7.11, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 rootdir: /Users/harrisonjackson/Zapier/requests, inifile: plugins: cov-2.2.1, httpbin-0.2.0, mock-0.11.0 collected 357 items tests/test_hooks.py ... tests/test_lowlevel.py ......... tests/test_requests.py ...................127.0.0.1 - - [14/Jul/2016 09:44:19] "GET /get HTTP/1.1" 200 197 ................................................127.0.0.1 - - [14/Jul/2016 09:44:21] "GET /gzip HTTP/1.1" 200 205 ...127.0.0.1 - - [14/Jul/2016 09:44:21] "GET /get?f%C3%B8%C3%B8=f%C3%B8%C3%B8 HTTP/1.1" 200 370 ..........................................................X.........127.0.0.1 - - [14/Jul/2016 09:44:21] "GET /stream/4 HTTP/1.1" 200 1080 X................................................... tests/test_structures.py .................... tests/test_testserver.py ........... tests/test_utils.py ............................................................................................................................ ============================= 355 passed, 2 xpassed in 41.34 seconds ============================== ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3402/reactions" }
https://api.github.com/repos/psf/requests/issues/3402/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3402.diff", "html_url": "https://github.com/psf/requests/pull/3402", "merged_at": "2016-07-14T16:59:51Z", "patch_url": "https://github.com/psf/requests/pull/3402.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3402" }
true
[ "Nope, that duplicate import looks like a mistake. Thanks! :sparkles:\n" ]
https://api.github.com/repos/psf/requests/issues/3401
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3401/labels{/name}
https://api.github.com/repos/psf/requests/issues/3401/comments
https://api.github.com/repos/psf/requests/issues/3401/events
https://github.com/psf/requests/pull/3401
165,463,895
MDExOlB1bGxSZXF1ZXN0NzczOTIwODQ=
3,401
in python3.x not have StringIO
{ "avatar_url": "https://avatars.githubusercontent.com/u/20295772?v=4", "events_url": "https://api.github.com/users/CarGod/events{/privacy}", "followers_url": "https://api.github.com/users/CarGod/followers", "following_url": "https://api.github.com/users/CarGod/following{/other_user}", "gists_url": "https://api.github.com/users/CarGod/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/CarGod", "id": 20295772, "login": "CarGod", "node_id": "MDQ6VXNlcjIwMjk1Nzcy", "organizations_url": "https://api.github.com/users/CarGod/orgs", "received_events_url": "https://api.github.com/users/CarGod/received_events", "repos_url": "https://api.github.com/users/CarGod/repos", "site_admin": false, "starred_url": "https://api.github.com/users/CarGod/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/CarGod/subscriptions", "type": "User", "url": "https://api.github.com/users/CarGod", "user_view_type": "public" }
[]
closed
true
null
[]
null
6
2016-07-14T02:40:39Z
2021-09-08T03:00:58Z
2016-07-14T07:57:49Z
CONTRIBUTOR
resolved
I think, should such an amendment.
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3401/reactions" }
https://api.github.com/repos/psf/requests/issues/3401/timeline
null
null
false
{ "diff_url": "https://github.com/psf/requests/pull/3401.diff", "html_url": "https://github.com/psf/requests/pull/3401", "merged_at": "2016-07-14T07:57:49Z", "patch_url": "https://github.com/psf/requests/pull/3401.patch", "url": "https://api.github.com/repos/psf/requests/pulls/3401" }
true
[ "Thanks! :sparkles:\n", "AFAIK (I haven't checked), all of our documentation is written with 2.x in mind. If this holds true, I believe this is a slightly user-hostile change, as the majority of user userbase is not using Python 3.\n\nIf we want to be subtly suggestive that they should be using 3, we need to make sure it's happening everywhere, not just in this one spot. \n\nAgain, I haven't checked.\n", "@kennethreitz Python 2.7 also has the `io` module: this change keeps the code working as expected on Python 2.\n", "Ah yes, I forgot a `StringIO` class was also available under `io` in 2.7. Obviously, it's fine to not pander to 2.6 users :)\n\nEither way, my above comment is generally relevant. We may want to start making our examples 3.x soon, if we want to \"move the needle\". I don't think there's any rush to do so, though.\n", "> Either way, my above comment is generally relevant. We may want to start making our examples 3.x soon, if we want to \"move the needle\". I don't think there's any rush to do so, though.\n\n@kennethreitz have you looked at the downloads for requests recently? I'm not sure which version is \"winning\" but regardless, I think we can write the examples to work across all supported versions without having to have an opinion on whether they're all Py2 or Py3 or moving any needle.\n", "I have, yes.\n\nThat would be my preferred method too. I'm speaking more if we'd like to make a more political move within our documentation, akin to what the Django project has done.\n\nI don't think we need to, but am brining it up as a possibility.\n" ]
https://api.github.com/repos/psf/requests/issues/3400
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3400/labels{/name}
https://api.github.com/repos/psf/requests/issues/3400/comments
https://api.github.com/repos/psf/requests/issues/3400/events
https://github.com/psf/requests/issues/3400
165,386,356
MDU6SXNzdWUxNjUzODYzNTY=
3,400
requests throws an exception when using future strings on Py2
{ "avatar_url": "https://avatars.githubusercontent.com/u/4231472?v=4", "events_url": "https://api.github.com/users/st-pasha/events{/privacy}", "followers_url": "https://api.github.com/users/st-pasha/followers", "following_url": "https://api.github.com/users/st-pasha/following{/other_user}", "gists_url": "https://api.github.com/users/st-pasha/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/st-pasha", "id": 4231472, "login": "st-pasha", "node_id": "MDQ6VXNlcjQyMzE0NzI=", "organizations_url": "https://api.github.com/users/st-pasha/orgs", "received_events_url": "https://api.github.com/users/st-pasha/received_events", "repos_url": "https://api.github.com/users/st-pasha/repos", "site_admin": false, "starred_url": "https://api.github.com/users/st-pasha/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/st-pasha/subscriptions", "type": "User", "url": "https://api.github.com/users/st-pasha", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-13T18:14:42Z
2021-09-08T17:05:29Z
2016-07-13T19:07:45Z
NONE
resolved
We are using `future` module in our project ([http://python-future.org/](http://python-future.org/)), and it appears that `requests` has trouble processing futurized strings in Python 2.7.12. Test case: ``` from future.types import newstr as str from requests import get get("http://google.com/search", params={"q": str("/foo/bar")}) ``` This throws an exception "KeyError: 47".
{ "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/3400/reactions" }
https://api.github.com/repos/psf/requests/issues/3400/timeline
null
completed
null
null
false
[ "- I have never heard of python-future before.\n- It has incomplete API documentation, specifically none around `newstr`.\n", "I made a virtual environment to reproduce this and it's absolutley reproducible... except that the exception comes from _the standard library_.\n\nAll that's necessary to reproduce this is:\n\n``` py\n>>> import urllib\n>>> urllib.urlencode({'q': str('/foo')}, doseq=True)\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py\", line 1359, in urlencode\n v = quote_plus(v.encode(\"ASCII\",\"replace\"))\n File \"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py\", line 1310, in quote_plus\n return quote(s, safe)\n File \"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py\", line 1303, in quote\n return ''.join(map(quoter, s))\nKeyError: 47\n```\n\nThis is entirely the fault of `future.types.newstr.newstr`.\n\nIf you do not use `future.types.newstr` then instead you get:\n\n``` py\n>>> urllib.urlencode({'q': '/foo'}, doseq=True)\n'q=%2Ffoo'\n```\n\nThis is a bug in future.\n" ]
https://api.github.com/repos/psf/requests/issues/3399
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3399/labels{/name}
https://api.github.com/repos/psf/requests/issues/3399/comments
https://api.github.com/repos/psf/requests/issues/3399/events
https://github.com/psf/requests/issues/3399
165,329,986
MDU6SXNzdWUxNjUzMjk5ODY=
3,399
Content-Length incorrect?
{ "avatar_url": "https://avatars.githubusercontent.com/u/114803?v=4", "events_url": "https://api.github.com/users/furlongm/events{/privacy}", "followers_url": "https://api.github.com/users/furlongm/followers", "following_url": "https://api.github.com/users/furlongm/following{/other_user}", "gists_url": "https://api.github.com/users/furlongm/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/furlongm", "id": 114803, "login": "furlongm", "node_id": "MDQ6VXNlcjExNDgwMw==", "organizations_url": "https://api.github.com/users/furlongm/orgs", "received_events_url": "https://api.github.com/users/furlongm/received_events", "repos_url": "https://api.github.com/users/furlongm/repos", "site_admin": false, "starred_url": "https://api.github.com/users/furlongm/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/furlongm/subscriptions", "type": "User", "url": "https://api.github.com/users/furlongm", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-13T14:07:53Z
2021-09-08T17:05:29Z
2016-07-13T14:11:23Z
NONE
resolved
I seem to consistently get a different Content-Length when I use httplib (8494757) and when I use requests (625290), for the same file. Is this normal or is this a bug? ``` >>> conn = httplib.HTTPSConnection('raw.githubusercontent.com') >>> conn.request('HEAD','/stevemeier/cefs/master/errata.latest.xml') >>> conn.getresponse().getheaders() [('content-length', '8494757'), ('via', '1.1 varnish'), ('vary', 'Authorization,Accept-Encoding'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"d8000ebc3721f00f130736072186146d50df2781"'), ('x-cache-hits', '3'), ('cache-control', 'max-age=300'), ('source-age', '105'), ('x-served-by', 'cache-mel6523-MEL'), ('x-cache', 'HIT'), ('x-github-request-id', '2BF94A17:13B4D:46ADE7:578648AD'), ('accept-ranges', 'bytes'), ('expires', 'Wed, 13 Jul 2016 14:03:47 GMT'), ('x-fastly-request-id', '363b36bb9fb7c18106f7e1182450c91bed7e60f7'), ('x-geo-block-list', ''), ('date', 'Wed, 13 Jul 2016 13:58:47 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'; style-src 'unsafe-inline'"), ('strict-transport-security', 'max-age=31536000'), ('connection', 'keep-alive'), ('x-frame-options', 'deny'), ('content-type', 'text/plain; charset=utf-8')] ``` vs ``` >>> res = requests.head('https://raw.githubusercontent.com/stevemeier/cefs/master/errata.latest.xml') >>> res.headers {'Content-Length': '625290', 'X-XSS-Protection': '1; mode=block', 'Content-Security-Policy': "default-src 'none'; style-src 'unsafe-inline'", 'X-Cache-Hits': '1', 'X-Frame-Options': 'deny', 'Access-Control-Allow-Origin': '*', 'X-Served-By': 'cache-mel6521-MEL', 'X-GitHub-Request-Id': '2BF94A14:37EB:8B44EC:57864851', 'Expires': 'Wed, 13 Jul 2016 14:03:55 GMT', 'X-Fastly-Request-ID': 'd1f56c5b421ddc141601df05fd3cc5dc0167f3e1', 'Date': 'Wed, 13 Jul 2016 13:58:55 GMT', 'Source-Age': '205', 'X-Cache': 'HIT', 'Accept-Ranges': 'bytes', 'Strict-Transport-Security': 'max-age=31536000', 'Connection': 'keep-alive', 'X-Geo-Block-List': '', 'Via': '1.1 varnish', 'X-Content-Type-Options': 'nosniff', 'Content-Encoding': 'gzip', 'Vary': 'Authorization,Accept-Encoding', 'ETag': '"d8000ebc3721f00f130736072186146d50df2781"', 'Cache-Control': 'max-age=300', 'Content-Type': 'text/plain; charset=utf-8'} ```
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3399/reactions" }
https://api.github.com/repos/psf/requests/issues/3399/timeline
null
completed
null
null
false
[ "This is entirely normal. The key difference is in the headers. Specifically, requests has an extra one: `Content-Encoding: gzip`. This is because requests transparently supports compressed response bodies and then decompresses them for you on the fly. This is why the content-length is smaller in requests: the body was delivered compressed. If you compare the two bodies, you'll see that they're the same: requests' version was just delivered in a smaller form and then expanded later.\n\nIn the future, please ask questions on Stack Overflow if possible, rather than using the bugtracker. =) We have quite a lot of volume here, and it helps to reduce our workload!\n" ]
https://api.github.com/repos/psf/requests/issues/3398
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3398/labels{/name}
https://api.github.com/repos/psf/requests/issues/3398/comments
https://api.github.com/repos/psf/requests/issues/3398/events
https://github.com/psf/requests/issues/3398
165,313,440
MDU6SXNzdWUxNjUzMTM0NDA=
3,398
option to not urlencode parameters ?
{ "avatar_url": "https://avatars.githubusercontent.com/u/84749?v=4", "events_url": "https://api.github.com/users/pcompassion/events{/privacy}", "followers_url": "https://api.github.com/users/pcompassion/followers", "following_url": "https://api.github.com/users/pcompassion/following{/other_user}", "gists_url": "https://api.github.com/users/pcompassion/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pcompassion", "id": 84749, "login": "pcompassion", "node_id": "MDQ6VXNlcjg0NzQ5", "organizations_url": "https://api.github.com/users/pcompassion/orgs", "received_events_url": "https://api.github.com/users/pcompassion/received_events", "repos_url": "https://api.github.com/users/pcompassion/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pcompassion/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pcompassion/subscriptions", "type": "User", "url": "https://api.github.com/users/pcompassion", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-13T12:56:05Z
2021-09-08T17:05:30Z
2016-07-13T13:12:46Z
NONE
resolved
The api end point I'm working with won't work correctly when parameters are urlencoded. There seems to be other servers who don't work well with urlencoded urls... (http://stackoverflow.com/a/23497912/433570) How can I make requests not urlencode ? :(
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3398/reactions" }
https://api.github.com/repos/psf/requests/issues/3398/timeline
null
completed
null
null
false
[ "The best way to do it is to build your URL yourself, and then use the [PreparedRequest flow](http://docs.python-requests.org/en/master/user/advanced/#prepared-requests) to manually change `PreparedRequest.url` to the complete URL you'd like to use.\n" ]
https://api.github.com/repos/psf/requests/issues/3397
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3397/labels{/name}
https://api.github.com/repos/psf/requests/issues/3397/comments
https://api.github.com/repos/psf/requests/issues/3397/events
https://github.com/psf/requests/issues/3397
165,265,401
MDU6SXNzdWUxNjUyNjU0MDE=
3,397
proxy scheme is case-sensitive?
{ "avatar_url": "https://avatars.githubusercontent.com/u/3216484?v=4", "events_url": "https://api.github.com/users/ryanwy/events{/privacy}", "followers_url": "https://api.github.com/users/ryanwy/followers", "following_url": "https://api.github.com/users/ryanwy/following{/other_user}", "gists_url": "https://api.github.com/users/ryanwy/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ryanwy", "id": 3216484, "login": "ryanwy", "node_id": "MDQ6VXNlcjMyMTY0ODQ=", "organizations_url": "https://api.github.com/users/ryanwy/orgs", "received_events_url": "https://api.github.com/users/ryanwy/received_events", "repos_url": "https://api.github.com/users/ryanwy/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ryanwy/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ryanwy/subscriptions", "type": "User", "url": "https://api.github.com/users/ryanwy", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-13T08:30:18Z
2021-09-08T17:05:30Z
2016-07-13T09:03:53Z
NONE
resolved
I'm not sure if this is a bug? please take a look. Thanks. I use proxy below and it doesn't work, when I change scheme to lower 'http', it's fine. **proxy = {'HTTP': '218.26.237.18:3128'} url = http://httpbin.org/ip** I track the source code and don't find anywhere to handle scheme case conversion. -> requests.get -> request -> settings = self.merge_environment_settings( prep.url, proxies, stream, verify, cert ) **from function self.merge_environment_settings, get orderdict object proxies:** **OrderedDict([('HTTP', '118.144.187.254:3128')])** -> resp = self.send(prep, *_send_kwargs) -> r = adapter.send(request, *_kwargs) -> conn = self.get_connection(request.url, proxies) -> proxy = select_proxy(url, proxies) def select_proxy(url, proxies): proxies = proxies or {} urlparts = urlparse(url) if urlparts.hostname is None: return proxies.get('all', proxies.get(urlparts.scheme)) ...... **in function select_proxy, urlparts.scheme = 'http' and proxies.scheme is 'HTTP', so it returns None and the setting proxy is invalid '**
{ "avatar_url": "https://avatars.githubusercontent.com/u/3216484?v=4", "events_url": "https://api.github.com/users/ryanwy/events{/privacy}", "followers_url": "https://api.github.com/users/ryanwy/followers", "following_url": "https://api.github.com/users/ryanwy/following{/other_user}", "gists_url": "https://api.github.com/users/ryanwy/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/ryanwy", "id": 3216484, "login": "ryanwy", "node_id": "MDQ6VXNlcjMyMTY0ODQ=", "organizations_url": "https://api.github.com/users/ryanwy/orgs", "received_events_url": "https://api.github.com/users/ryanwy/received_events", "repos_url": "https://api.github.com/users/ryanwy/repos", "site_admin": false, "starred_url": "https://api.github.com/users/ryanwy/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/ryanwy/subscriptions", "type": "User", "url": "https://api.github.com/users/ryanwy", "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/3397/reactions" }
https://api.github.com/repos/psf/requests/issues/3397/timeline
null
completed
null
null
false
[ "Yeah, you need to lowercase the scheme in the proxy dictionary. While we could deal with this problem ourselves, it's somewhat problematic to do it because we need to avoid mutating the dictionary that is passed to us. I'll accept a pull request that adds some appropriate lowercasing in the `select_proxy` method (probably by copying the dictionary and lowercasing the keys as we go), but I don't consider this urgent: the documentation always shows people using lowercase keys in the proxy dictionary.\n\nFor what it's worth, you should [read that section](http://docs.python-requests.org/en/master/user/advanced/#proxies), as your target URL is not really correctly formatted either: it should also have a scheme.\n", "Thank you. so I close this known issue.\n" ]
https://api.github.com/repos/psf/requests/issues/3396
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3396/labels{/name}
https://api.github.com/repos/psf/requests/issues/3396/comments
https://api.github.com/repos/psf/requests/issues/3396/events
https://github.com/psf/requests/issues/3396
165,096,806
MDU6SXNzdWUxNjUwOTY4MDY=
3,396
JSON decode failed
{ "avatar_url": "https://avatars.githubusercontent.com/u/12646348?v=4", "events_url": "https://api.github.com/users/cchenship/events{/privacy}", "followers_url": "https://api.github.com/users/cchenship/followers", "following_url": "https://api.github.com/users/cchenship/following{/other_user}", "gists_url": "https://api.github.com/users/cchenship/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/cchenship", "id": 12646348, "login": "cchenship", "node_id": "MDQ6VXNlcjEyNjQ2MzQ4", "organizations_url": "https://api.github.com/users/cchenship/orgs", "received_events_url": "https://api.github.com/users/cchenship/received_events", "repos_url": "https://api.github.com/users/cchenship/repos", "site_admin": false, "starred_url": "https://api.github.com/users/cchenship/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/cchenship/subscriptions", "type": "User", "url": "https://api.github.com/users/cchenship", "user_view_type": "public" }
[]
closed
true
null
[]
null
3
2016-07-12T14:38:03Z
2021-09-08T17:05:31Z
2016-07-12T14:40:43Z
NONE
resolved
I want to do the following curl call in python with requests **curl:** `curl -b cookies -c cookies -X POST -d @auth 'https://api.a_website.com/auth'` The above curl commanded worked. So, I started migrating it into python 3.5.2. **python** ``` base_url = 'https://api.a_website.com/auth' result = requests.post(url=base_url, data={'auth': open('auth', 'rb')}, cookies=cookies) result.content ``` However, I got the following error: > b'{"response":{"error_id":"SYNTAX","error":"JSON decode failed","error_description":null,"service":null,"method":null,"error_code":null,"dbg_info":{"instance":"65.bm-hbapi.prod.nym2","slave_hit":false,"db":"master","awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"c941819d5c860f9a","warnings":[],"time":39.22700881958,"start_microtime":1468334115.9092,"version":"1.16.707","slave_lag":0,"output_term":"not_found"}}}\n' here is the auth file `$ cat auth` > { > "auth": { > "username" : "a_username", > "password" : "a_password" > } > }
{ "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/3396/reactions" }
https://api.github.com/repos/psf/requests/issues/3396/timeline
null
completed
null
null
false
[ "You are not sending JSON to the website in either request.\n\nFor assistance with using this library, please ask your question on [StackOverflow](https://stackoverflow.com/questions/tagged/python-requests). We do not provide a Q&A forum in the bug tracker.\n", "Please note as well that, whatever you think that curl command was doing, I don't think it was doing the right thing. I don't think curl takes a `--file` argument...\n\nAssuming you meant `--data` instead, what you want is this:\n\n`result = requests.post(url=base_url, data=open('auth', 'rb'), cookies=cookies)`\n", "Thanks for the quick response, I was indeed using -d in curl, pasted the wrong line\n" ]
https://api.github.com/repos/psf/requests/issues/3395
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3395/labels{/name}
https://api.github.com/repos/psf/requests/issues/3395/comments
https://api.github.com/repos/psf/requests/issues/3395/events
https://github.com/psf/requests/issues/3395
165,032,315
MDU6SXNzdWUxNjUwMzIzMTU=
3,395
4-byte UTF-8 character in package description can break repositories
{ "avatar_url": "https://avatars.githubusercontent.com/u/199657?v=4", "events_url": "https://api.github.com/users/wichert/events{/privacy}", "followers_url": "https://api.github.com/users/wichert/followers", "following_url": "https://api.github.com/users/wichert/following{/other_user}", "gists_url": "https://api.github.com/users/wichert/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/wichert", "id": 199657, "login": "wichert", "node_id": "MDQ6VXNlcjE5OTY1Nw==", "organizations_url": "https://api.github.com/users/wichert/orgs", "received_events_url": "https://api.github.com/users/wichert/received_events", "repos_url": "https://api.github.com/users/wichert/repos", "site_admin": false, "starred_url": "https://api.github.com/users/wichert/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/wichert/subscriptions", "type": "User", "url": "https://api.github.com/users/wichert", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-12T09:25:26Z
2021-09-08T16:00:38Z
2016-08-05T07:45:32Z
NONE
resolved
I'm afraid this is a bit of a 'WTF' thing. I was trying to use a hosted package repository, and discovered that trying to upload a wheel for requests failed. Some back and forth revealed an interesting reason: they store package description in MySQL, and MySQL can't normally store 4-byte UTF-8 sequences. And it so happens the cake symbol you are using for the `pip install` example is a 4-byte UTF-8 character. Considering this is not a bug in requests and the limitation is completely silly I hate to ask this, but still: could you consider using another replacing that cake symbol with something else so we won't hit that limitation?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3395/reactions" }
https://api.github.com/repos/psf/requests/issues/3395/timeline
null
completed
null
null
false
[ "Uh...I mean, we could. But it seems like that's just deferring the problem until later in the day. At some point the hosted package repository is going to need to deal with the full breadth of UTF-8. I feel like it'd be for the good of the world to hold Requests hostage behind dealing with this issue!\n\nSeriously though, MySQL's standard utf8 encoding is a joke: your package host really desperately needs to migrate to utf8mb4 or they'll encounter substantial trouble down the road. I recommend either moving to a different package host or threatening to do so unless they fix the issue.\n", "> I recommend either moving to a different package host or threatening to do so unless they fix the issue.\n\nI second that. I doubt Requests is the only package that will cause you this pain. Asking each one as it pops up to \"fix\" this (instead of the hosted repository fixing it) seems really kind of unreasonable.\n" ]
https://api.github.com/repos/psf/requests/issues/3394
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3394/labels{/name}
https://api.github.com/repos/psf/requests/issues/3394/comments
https://api.github.com/repos/psf/requests/issues/3394/events
https://github.com/psf/requests/issues/3394
165,011,480
MDU6SXNzdWUxNjUwMTE0ODA=
3,394
How to correctly change the Content of a Response in hook function
{ "avatar_url": "https://avatars.githubusercontent.com/u/16007157?v=4", "events_url": "https://api.github.com/users/pceBuildMaster/events{/privacy}", "followers_url": "https://api.github.com/users/pceBuildMaster/followers", "following_url": "https://api.github.com/users/pceBuildMaster/following{/other_user}", "gists_url": "https://api.github.com/users/pceBuildMaster/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pceBuildMaster", "id": 16007157, "login": "pceBuildMaster", "node_id": "MDQ6VXNlcjE2MDA3MTU3", "organizations_url": "https://api.github.com/users/pceBuildMaster/orgs", "received_events_url": "https://api.github.com/users/pceBuildMaster/received_events", "repos_url": "https://api.github.com/users/pceBuildMaster/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pceBuildMaster/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pceBuildMaster/subscriptions", "type": "User", "url": "https://api.github.com/users/pceBuildMaster", "user_view_type": "public" }
[]
closed
true
null
[]
null
1
2016-07-12T07:27:51Z
2021-09-08T17:05:31Z
2016-07-12T07:30:04Z
NONE
resolved
I have registered a `'response'` hook with the Request in the `__call__` method of my subclass of `AuthBase` as I need to check for API errors from my product and massage the output it returns for upstream consumption. The hook logic is working fine but I have concerns about my approach: Reading the `Requests API` section and playing around I found setting the Response `_content` with new data works. But I strongly suspect this is the wrong approach and it will come back to bite me. The `Requests API` lists `content` but in the hook logic I get the error: `AttributeError: can't set attribute` when I use that one. Is there a correct way to change the Response content?
{ "avatar_url": "https://avatars.githubusercontent.com/u/1382556?v=4", "events_url": "https://api.github.com/users/Lukasa/events{/privacy}", "followers_url": "https://api.github.com/users/Lukasa/followers", "following_url": "https://api.github.com/users/Lukasa/following{/other_user}", "gists_url": "https://api.github.com/users/Lukasa/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/Lukasa", "id": 1382556, "login": "Lukasa", "node_id": "MDQ6VXNlcjEzODI1NTY=", "organizations_url": "https://api.github.com/users/Lukasa/orgs", "received_events_url": "https://api.github.com/users/Lukasa/received_events", "repos_url": "https://api.github.com/users/Lukasa/repos", "site_admin": false, "starred_url": "https://api.github.com/users/Lukasa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Lukasa/subscriptions", "type": "User", "url": "https://api.github.com/users/Lukasa", "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/3394/reactions" }
https://api.github.com/repos/psf/requests/issues/3394/timeline
null
completed
null
null
false
[ "Setting `_content` is fine. That's where we store buffered content. Note that you can't unconditionally read from `_content` to massage in the first place, you do need to use `content`. The reason you can't override `content` is because it's a property that executes a function that does things like lazy loading.\n" ]
https://api.github.com/repos/psf/requests/issues/3393
https://api.github.com/repos/psf/requests
https://api.github.com/repos/psf/requests/issues/3393/labels{/name}
https://api.github.com/repos/psf/requests/issues/3393/comments
https://api.github.com/repos/psf/requests/issues/3393/events
https://github.com/psf/requests/issues/3393
164,737,992
MDU6SXNzdWUxNjQ3Mzc5OTI=
3,393
Obtaining Request and Session info in the AuthBase subclassed __call__ method
{ "avatar_url": "https://avatars.githubusercontent.com/u/16007157?v=4", "events_url": "https://api.github.com/users/pceBuildMaster/events{/privacy}", "followers_url": "https://api.github.com/users/pceBuildMaster/followers", "following_url": "https://api.github.com/users/pceBuildMaster/following{/other_user}", "gists_url": "https://api.github.com/users/pceBuildMaster/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pceBuildMaster", "id": 16007157, "login": "pceBuildMaster", "node_id": "MDQ6VXNlcjE2MDA3MTU3", "organizations_url": "https://api.github.com/users/pceBuildMaster/orgs", "received_events_url": "https://api.github.com/users/pceBuildMaster/received_events", "repos_url": "https://api.github.com/users/pceBuildMaster/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pceBuildMaster/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pceBuildMaster/subscriptions", "type": "User", "url": "https://api.github.com/users/pceBuildMaster", "user_view_type": "public" }
[]
closed
true
null
[]
null
2
2016-07-10T22:42:31Z
2021-09-08T17:05:32Z
2016-07-12T04:39:05Z
NONE
resolved
tl:dr How to get data avail at request time to the **AuthBase** `__call__` method to make needed changes to the request HTTP Post data Details: For our product's HTTP API I needed to create a new authentication method and modify the Request Post data based on the new authentication and what was passed to the Request HTTP verb call; Post in this instance. When Request.Session create was called I had the `__init__` method of my AuthBase class make a Requests call to login with provide credentials. The returning auth token was stored in the session obj. Then when the `__call__` method of my AuthBase call was called it would change the Request Post data with the auth token. The ugly part is the call to make the Request Post could also get a 'cmd' param which needs to be in the HTTP data sent to the server. JSON format of Post data: ``` { "token" : "access token" "cmd" : "get"/"set"/"special" "data" : { ... } } ``` Since at time of `__call__` running only the **PreparedRequest** is available I see three methods of making the needed data and cmd info available: 1. save in session and add session object to request obj before Post is called 2. save cmd in headers before Post is called 3. add info to HTTP Post data and in **call** method extract and format as needed. I looked at the hook system but that seems to now only hook into the Response event so it is too late for my needs. I choose method 1 because it was late and I could just add all the info into session. It was just a proof-of-concept at this time. Either of the other methods would work but all seem ugly. In the morning I tore it out and added a type attribute to the Requests.Session obj at creation time. Then at Post time if session is this type I make the changes before Post. I am integrating this into the [RobotFramework Requests wrapper library.](https://github.com/bulkan/robotframework-requests/) So creating my own session type and using a subclassed `AuthBase` seemed it would provide a way to not have to change the HTTP verb calls like post_request with my session specific logic. But in the end it seems it might be the cleanest solution for my product's auth/cmd API methods. Am I missing something that would allow the `AuthBase` methods to have access to the Session obj besides the methods outlined above?
{ "avatar_url": "https://avatars.githubusercontent.com/u/16007157?v=4", "events_url": "https://api.github.com/users/pceBuildMaster/events{/privacy}", "followers_url": "https://api.github.com/users/pceBuildMaster/followers", "following_url": "https://api.github.com/users/pceBuildMaster/following{/other_user}", "gists_url": "https://api.github.com/users/pceBuildMaster/gists{/gist_id}", "gravatar_id": "", "html_url": "https://github.com/pceBuildMaster", "id": 16007157, "login": "pceBuildMaster", "node_id": "MDQ6VXNlcjE2MDA3MTU3", "organizations_url": "https://api.github.com/users/pceBuildMaster/orgs", "received_events_url": "https://api.github.com/users/pceBuildMaster/received_events", "repos_url": "https://api.github.com/users/pceBuildMaster/repos", "site_admin": false, "starred_url": "https://api.github.com/users/pceBuildMaster/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pceBuildMaster/subscriptions", "type": "User", "url": "https://api.github.com/users/pceBuildMaster", "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/3393/reactions" }
https://api.github.com/repos/psf/requests/issues/3393/timeline
null
completed
null
null
false
[ "Generally speaking, the `Auth` handlers do not have access to the `Session` object unless you give it to them. That's not hard:\n\n``` python\ns = requests.Session()\ns.auth = MyCustomAuthClass(s)\n```\n\nHowever, a session-scoped auth class is automatically applied to all requests, so in fact it only needs to store information on itself: by definition unless your code overrides it that auth handler will continue to exist for the entire duration of the `Session`. That means that, in practice, your auth handler can just store the data on `self` if it's applied to the entire session.\n\nDoes that make sense?\n", "It does make sense. Just wanted to make sure I did not miss something. Thanks for your time.\n\nClosing issue.\n" ]