我试图更好地理解API世界,我试图从Earth Explorer API下载信息,而我要做的第一件事就是登录。为此,我写了以下内容:
import requests
import requests
usuario = 'xxxxx'
clave = 'xxxxxxxx'
input_data= {"username":usuario,"password":clave,"catalogId":"EE"}
test=requests.post('https://earthexplorer.usgs.gov/inventory/json/v/1.4.1/login',data=input_data)
print(test.text)
print(test.status_code)
但出现此错误:
{"errorCode":"INPUT_FORMAT","error":"A required field 'username' was not found in the request object",
"data":null,"api_version":"1.4.1","access_level":"guest","catalog_id":"default","executionTime":0.10880804061889648}
200
据此,我尚未提交用户名,但是我只是提交了,不是吗?data=input_data
?>
我试图更好地理解API世界,我试图从Earth Explorer API下载信息,而我要做的第一件事就是登录。为此,我写了...
非常感谢大家,但实际上我通过安装ugsc api得到了结果。