我是C#编程的初学者。我有使用Python的经验,这正是我试图用C#复制的东西
import requests, json
api_user = "userexample@example.com"
api_key = "keyexample"
url = "https://api.example.com/"
response = requests.get(url, auth=(api_user, api_key))
json_response = response.json()
print(json_response)
那代码是什么样子的?谢谢
您可以使用
HttpClient
库来连接api服务器。 下面是api基本身份验证的示例代码。 最后一定要调用Dispose()
,否则您可能会遇到一些GC问题相关问题 更多 >
编程相关推荐