[英]python requests and percent encoding of path
when using python requests am I supposed to urlencode the URI manually? 当使用python请求时,我应该手动urlencode URI吗?
>>> 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()
? 我应该使用urllib.quote()
包装路径部分吗?
requests
will quote only unreserved characters ( code ). requests
将仅引用未保留的字符( 代码 )。 % and () are reserved characters so you'd have to quote them yourself. %和()是保留字符,因此您必须自己引用它们。 Spaces are unreserved characters and requests
does quote them for you. 空格是未保留的字符, requests
会为您引用它们。 See Percent-encoding for the list of reserved URI characters. 有关保留URI字符列表,请参阅百分比编码 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.