Generate boiler plate code that integrates an extern API using Python.
时间: 2023-03-08 11:43:13 浏览: 95
我可以提供一个简单的Python代码示例,用于集成外部API: import requests
url = "https://www.example.com/api"
payload = {'key1': 'value1', 'key2': 'value2'}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers)
print(response.text)
阅读全文