当前位置:首页 > python > 正文内容

权大师商标查询api

zhangsir3年前 (2022-10-17)python464
'''
data:2022-10-15
autor:zhangsir
权大师商标查询api
'''
import requests
import json
import time
import hashlib
#时间戳
t = time.time()
ht = int(round(t * 1000))
#请求头
headers={
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
    "content-type":"application/json"
}
#请求参数
data = { 
    "q": "28441247", 
    "field": "data_id", 
    "ip": "192.168.16.101", 
    "pageSize": "25",
    "appKey": "xxxxxxxxxxxxxxxxxxx",#官方提供 
    "page": "0", 
    "signMethod": "md5", 
    "timestamp": ht
}
#字典升序排序
a2 = sorted(data.items(), key=lambda x: x[0])
a3 = dict(a2)
#转字符串
a4 = []
for x in a3:
    a4.append(x+str(a3[x]))
a5 = ''.join(a4)
#签名算法字符串
a6 = "xxxxxxxxxxxxxxxxxxxx"+a5+"xxxxxxxxxxxxxxxxxxxx"
#MD5加密
md = hashlib.md5(a6.encode())
#请求网址
url = "https://phoenix.quandashi.com/brand/brandSearch"
#请求参数
a8 = {
    "q": "28441247", 
    "field": "data_id", 
    "ip": "192.168.16.101", 
    "sign": md.hexdigest().upper(), 
    "pageSize": "25",
    "appKey": "xxxxxxxxxxxxxxxxxxx",#官方提供 
    "page": "0", 
    "signMethod": "md5", 
    "timestamp": ht
}
#字典转json
k = json.dumps(a8)
print(k)
#请求
a = requests.post(url=url,data=k,headers=headers)
b = a.text
#打印
print(b)


zhangsir版权f2防采集https://mianka.xyz

扫描二维码推送至手机访问。

版权声明:本文由zhangsir or zhangmaam发布,如需转载请注明出处。

本文链接:https://mianka.xyz/post/43.html

标签: python
分享给朋友:

“权大师商标查询api” 的相关文章

python之seleniumwire获取network(网络)信息

python之seleniumwire获取请求头参数import time from seleniumwire import webdriver # 创建Chrome驱动程序的新实例 driver = webdriver...

解决Django的request.POST获取不到请求参数的问题

这个是Django自身的问题:只要在请求头的添加"content-type":'application/x-www-form-urlencoded'就行。...

python 爬虫 报错:UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0x8b in position”解决方案

发现报错“UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1:invalid start byte”,方法一:根据报错提示,错误原因有一条是这样的:“'Accept-Encodi...

python 给电脑设置闹钟

python会自动触发windows桌面通知,提示重要事项,比如说:您已工作两小时,该休息了我们可以设定固定时间提示,比如隔10分钟、1小时等用到的第三方库:win10toast - 用于发送桌面通知的工具from win10toast import ToastNoti...

python selenium 使用代理ip

代码如下:from selenium import webdriver chromeOptions = webdriver.ChromeOptions() chromeOptions.add_argument("--proxy-serv...