我正在尝试向USGS EarthExplorer广告资源API提交POST请求。这从简单的登录开始。他们有一个测试页面:
https://earthexplorer.usgs.gov/inventory/documentation/test
允许您查看一些格式示例。对于登录示例,我能够提取按下按钮时提交的URL(用户和pw已更改):
但是,我似乎无法弄清楚如何使用请求库在Python中格式化它。我对其他人开放,但我现在正在使用请求。我试过创建一个字典:
creds = {"username": "user",
"password": "pw",
"authType": "",
"catalogId": "EE"}
payload = json.dumps(creds)
当我致电requests.post(url, json=payload)
时,我被告知我的用户名参数不存在。我也尝试了其他关键字,如数据和参数。
我注意到成功的URL中有jsonRequest参数,所以我尝试在那里创建一个字典:
creds2={"jsonRequest": [{"username": "user",
"password": "pw",
"authType": "",
"catalogId": "EE"}]}
但这也不起作用。
有什么建议吗?谢谢!
答案 0 :(得分:1)
You'll have to send a GET request and pass the creds in the query string using the params
argument.
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/launch_screen</item>
</style>