清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
1 2 3 4 5 6 7 8 9 10 11 12 | import requests from requests.auth import AuthBase class TokenAuth(AuthBase): def __init__(self,username,token): self.username=username self.token=token def __call__(self,r): r.headers['Authorization']=self.username+':'+self.token return r r=requests.get('http://localhost:5000',auth=TokenAuth('name','abcdefghijklmn')) print r.status_code |