when using python requests am I supposed to urlencode the URI manually?
>>> requests.get('http://example.com/increased by 10% (@tom)').url
u'http://example.com/increased%20by%2010%%20(@tom)'
here the %, (, ) and @ characters are not encoded while spaces are. what is the official way of making such request? should I wrap the path part using urllib.quote()?
requests will quote only unreserved characters (code). % and () are reserved characters so you'd have to quote them yourself. Spaces are unreserved characters and requests does quote them for you. See Percent-encoding for the list of reserved URI characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With