import requests
import sys
import random
api = {
'number':[
'https://acs.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?data=%7B"itemNumId"%3A"%s"%7D&qq-pf-to=pcqq.group&name="zhgangsan"',
'https://acs.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?data=%7B"itemNumId"%3A"%s"%7D&qq-pf-to=pcqq.group&name="lisi"',
'https://acs.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?data=%7B"itemNumId"%3A"%s"%7D&qq-pf-to=pcqq.group&name="wangwu"',
],
'keyword':{
},
}
data = {
"data":{"itemNumId":"10031645140"},
"qq-pf-to":"pcqq.group",
}
headers = {'content-type': 'application/json'}
strNumId = input( '请输入淘宝读取编号:' )
type = 'number'
apis = len( api.get( type ) )
item = random.randint( 0, apis )
url = api.get( type ).pop( item ).replace( "%s", strNumId )
req = requests.get( url, headers )
reqJson = req.json()
#itemInfo = reqJson.get( 'data' ).get( 'item' )
#print( itemInfo )
shopInfo = reqJson.get( 'data' ).get( 'seller' )
print( shopInfo )
Python初识 python随机调取淘宝api获取数据
最新推荐文章于 2024-09-01 13:47:41 发布