psf / psf/requests

cookies.get behavior

Open
#5,116 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
54.3k
Forks
10.4k
Avg merge
16h 43m
Merged PRs (30d)
3

Description

Pardon me... I'm not proficient in python... This library appears to be the de-facto reference for http clients in other programming languages as well..
it seems like many http get clients return raw cookie values. and require raw cookie names... because... that's what this library does

The subtitle for this project is "http for humans"....
This human isn't interested in the transport-layer encoding.. I want the human value

With all that said... why :


Expected Result

I would expect response.cookies.get() to
a) expect a decoded name as a parameter and
b) return a decoded (human) value

Actual Result

Encoded value returned
if name was encoded for http transport... I must pass encoded name to get value

response headers:

Set-Cookie: dingus=foo%3Bbar; path=/
Set-Cookie: a%3Bb=foo%3Bbar; path=/
[nav] In [1]: import requests                                                                                                     

[ins] In [2]: r = requests.get('http://localhost/cookietest')                                                                          

[ins] In [3]: r.cookies.get('dingus')                                                                                             
Out[3]: 'foo%3Bbar'

[ins] In [4]: r.cookies.get('a;b')                                                                                                

[ins] In [5]: r.cookies.get('a%3Bb')                                                                                              
Out[5]: 'foo%3Bbar'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the response.cookies.get() entry point and reproduce the behavior with the two Set-Cookie headers shown in the issue. Determine the expected handling of encoded cookie names and values, then verify that the requested decoded lookup and returned value work for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.