Keys and values in request.args are returned as byes in Python3
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 838
- Forks
- 123
- Avg merge
- 7h 58m
- Merged PRs (30d)
- 12
Description
With Python3, the keys and values for request.args returned when submitting form data to an app.route are returned as bytes, not strings.
2020-06-29 23:11:10-0400 [-] (Pdb) {b'username': [b'irowell'], b'email': [b'test@gmail.com'], b'password': [b'test']}
request.args['username']
2020-06-29 23:11:21-0400 [-] (Pdb) *** KeyError: 'username'
request.args[b'username']
2020-06-29 23:20:01-0400 [-] (Pdb) [b'irowell']
So either the user would have to convert the kv pairs to string before parsing, or use bytes when looking up values in the dictionary. Is there anythign that handles this natively?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Python 3 behavior described for request.args when form data is submitted to an app.route, then trace where its keys and values are parsed. Done means string keys such as 'username' work for lookup without caller-side conversion, with a regression test covering the reported request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100