0
点赞
收藏
分享

微信扫一扫

python requests

import requests
rr=requests.get("https://api.github.com",auth=('user','pass'))
print(rr.status_code)
print(rr.headers['content-type'])

结果:

===================== RESTART: D:/Python/Python37/re5.py =====================

403

application/json; charset=utf-8

>>>

headers={'User-Agent':'   ',}

html=requests.get(url,headers=headers)

html.encoding='utf-8'

data={'entities_only':'true','page':'1'}

htmla=requests.post(url,data=data)

#提示:如果网页有“更多”按钮,但网址不变。打开F12,点“更多”,出现,分析:有post:有新网址及fordata

python requests_python



python requests_json_02


import sys

reload(sys)

sys.setdefaultencoding("utf-8")

强制转换utf-8




举报

相关推荐

0 条评论