我在自定义函数中使用requests
库:
def add_advert(self, json_data):
headers = {'Content-Type': 'application/json'}
return requests.post(self.base_url + self.api_urls["add_advert"],
json=json_data, headers=headers,
auth=(self.api_key, ''))
并调用此函数:
response = api.add_advert(json_data=json_data)
如何显示变量response
的内容
我试过:打印response.content
,打印response.json
假设您要显示的“内容”是响应负载
response.text
或者
response.json()
-.json
是一个函数(假设json负载)相关问题 更多 >
编程相关推荐