我想改变我的函数读取代码的方式,这样我就可以导入一个具有更简单的托管变量的类。
我已经导入了所有要编辑的库。
class http_request(object):
def __init__(self, website_address, valuedictionary):
self.website_address = website_address
self.valuedictionary = valuedictionary
def get(self):
return requests.get(website_address, params=valuedictionary)
def post(self):
return requests.post(website_address, data=valuedictionary)
def postContext(self):
return requests.post(website_address, data=valuedictionary).context
def getContext(self):
return requests.get(website_address, params=valuedictionary).context
htay = http_request(web_add, payload)
print str(htay.postContext)
我得到这个作为我的回应:“< main .http_request object at 0x8735cec>> 的绑定方法 http_request.get”
有任何想法吗?