使用requsets包构造eve的HMAC请求

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

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