[问题] response 200

楼主: hosayhosay (猫猫)   2021-01-08 20:09:34
各位前辈好
小弟想询问编译后为何只出现response 200
没有其余的内容
底下为小弟的程式码(虾皮购物网站、get方法、json资料格式)
import requests
import json
url='https://shopee.tw/api/v2/search_items/?by=relevancy&fe_categoryids=66&limit=50&newest=0&order=desc&page_type=search&version=2'
res=requests.get(url)
data=json.loads(res.text)
headers={'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
,'cookie': '_zcl_bu=1.1.1703142435.169803700;
_fbp=fb.1.1606053700352.2145177171; SPC_IA=-1; SPC_EC=-;
SPC_F=eqkczzF7GC7EC9BOYr7ccxAqYEn6jLBxP;
REC_T_ID=3daf3a3a-2ccb-11eb-b8e4-b49691461586; SPC_U=-;
__BWfp=c1606053703554x6065432f1;
_gcl_aw=GCL.1607779383.EAIaIQobChMIyNHZ9sTI7QIVgmSLCh2JwAVnEAAYASAAEgIYv_D_BwE;
_gac_UA-61915057-6=1.1607859384.EAIaIQobChMIyNHZ9sTI7QIVgmSLCh2JwAVnEAAYASAAEgIYv_D_BwE;
_med=refer; csrftoken=2O9hf0OIiMugeoyqGJgk23uWKIL3yuRF;
SPC_SI=bfftoctw1.TuwglYXBwsxRM5QeN0VeNvhWFVm7at5Z; welcomePkgShown=true;
AMP_TOKEN=%24NOT_FOUND; _gsd=GA1.2.609059211.1609960561;
SPC_CT_b37b2656="1609961007.fi2BaAkHZLySw1tqX3LkRip//2Sl4Atv3yvzNr+uCSA=";
SPC_R_T_ID="P6EAG/URl+eMjd23Xb51OVaTiWuptFhfmQchguKiZmwD8KWiJuCPpo8NRj7ZbbC776koVuEt43gbP6Wrqz2/gYIaKcTAExA54yLvF0eEm4c=";
SPC_T_IV="pFl4d54jv5hZVEvYoUI3pQ=="; SPC_R_T_IV="pFl4d54jv5hZVEvYoUI3pQ==";
SPC_T_ID="P6EAG/URl+eMjdR3cb51OVaTiWuptFhfmQchguKiZmwD8KWiJuCPpo8NRj7ZbbC776koVuEt43gbP6Wrqz2/gYIaKcTAExA54yLvF0eEm4c=";
_ga_RPSBE3TQZZ=GS1.1.1609920559.9.1.1609961613.0;
_ga=GA1.1.959695778.1606056702'}
jj=requests.get(url=url,headers=headers,json=data)
import pandas
df=pandas.DataFrame(jj)
print(jj)
作者: Luluemiko (露露)   2021-01-08 20:43:00
为什么要发送2次request
作者: aidansky0989 (alta)   2021-01-08 21:48:00
乱写一通,去看requests官网
作者: ddavid (谎言接线生)   2021-01-09 06:13:00
这个真的不行,随便Google一篇requests呼叫API教学吧
楼主: hosayhosay (猫猫)   2021-01-09 07:10:00
谢谢几位的指教。不过response200是服务器回传的状态,表示请求成功,现在问题是除了显示response200以外,没有爬取资料的呈现。
作者: moodoa3583 (金牌台灣啤酒)   2021-01-09 15:03:00
requests get 之后看你需要什么样的内容在后面加上 .text 或 .content (不确定你要的是不是这个
作者: alvinlin (林矜业)   2021-01-10 01:22:00
要打 jj.text 或 jj.content 才有
作者: TakiDog (多奇狗)   2021-01-10 05:40:00
你把cookie贴出来是不怕被盗吗= =

Links booklink

Contact Us: admin [ a t ] ucptt.com