对于get请求
url = "http://api.map.baidu.com/geocoder/v2/?address=百度大厦&output=json&ak=yourak"
sk = "yoursk"
按照官网python写法改下就好,urllib.quote urllib.quote_plus分别表示部分字符不编码的urlencode和全部编码的urlencode
post请求
按照post参数首字母从小到大排列组成url,其他与get相同,如:
创建表:http://api.map.baidu.com/geodata/v3/geotable/create
geotype = 1
is_published = 1
name = table333
ak = yourak
则基础url为:/geodata/v3/geotable/create?ak=yourak&geotype=1&is_published=1&name=table3
rawStr = baseurl
string encode_url = CHttpclient::UrlEncode_safe(rawStr); //一些字符不变的urlencode
encode_url += "yoursk";
string second_encode = CHttpclient::UrlEncode(encode_url); //全部字符urlencode
md5(second_encode)
网友评论