Url encode using python 2.7

孤人 提交于 2020-01-03 13:38:07

问题


>>> import httplib
>>> x = httplib.HTTPConnection('localhost', 8080)
>>> x.connect()
>>> x.request('GET','/camera/store?fn=aaa&ts='+str.encode('2015-06-15T14:45:21.982600+00:00','ascii')+'&cam=ddd')
>>> y=x.getresponse()
>>> z=y.read()
>>> z

'error: Invalid format: "2015-06-15T14:45:21.982600 00:00" is malformed at " 00:00"'

And the system show me this error. As i want to encode this format to this: 2015-06-15T14%3A45%3A21.982600%2B00%3A00

来源:https://stackoverflow.com/questions/37541436/url-encode-using-python-2-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!