http协议uri编码

Theday
import urllib.parse
import string
import requests

url = 'https://baidu.com/s?'

params = {
    'wd': "中文",
    'key': "baidu",
    'value': "name"
}

str_params = urllib.parse.urlencode(params)
parse_url = url + str_params

end_url = urllib.parse.quote(parse_url, string.printable) # https://baidu.com/s?wd=%E4%B8%AD%E6%96%87&key=baidu&value=name
response = requests.get(end_url)
print(response.content.decode())

阅读 545

singwa服务端学习小组
singwa服务端学习小组 技术共享平台
6 声望
0 粉丝
0 条评论
6 声望
0 粉丝
文章目录
宣传栏