|
@@ -17,6 +17,10 @@ def auth_post():
|
|
|
auth_headers = {
|
|
auth_headers = {
|
|
|
"Content-Type": "application/json, charset=UTF-8"
|
|
"Content-Type": "application/json, charset=UTF-8"
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+#json为dict时,如果不指定content-type,默认为application/json
|
|
|
|
|
+#json为str时,如果不指定content-type,默认为application/json
|
|
|
|
|
+
|
|
|
auth_original = requests.request('post', url_auth, json=auth_body, headers=auth_headers)
|
|
auth_original = requests.request('post', url_auth, json=auth_body, headers=auth_headers)
|
|
|
access_token_original = auth_original.json()
|
|
access_token_original = auth_original.json()
|
|
|
access_token = access_token_original['access_token']
|
|
access_token = access_token_original['access_token']
|
|
@@ -28,6 +32,10 @@ def post_x-www-form():
|
|
|
init_headers = {'content-type': 'application/x-www-form-urlencoded'}
|
|
init_headers = {'content-type': 'application/x-www-form-urlencoded'}
|
|
|
init_url = "http://192.1.1.1:8080/init"
|
|
init_url = "http://192.1.1.1:8080/init"
|
|
|
params = {"account_ids":Ids[0]}
|
|
params = {"account_ids":Ids[0]}
|
|
|
|
|
+
|
|
|
|
|
+#data为dict时,如果不指定content-type,默认为application/x-www-form-urlencoded,相当于普通form表单提交的形式
|
|
|
|
|
+#data为str时,如果不指定content-type,默认为text/plain
|
|
|
|
|
+
|
|
|
resp = requests.post(init_url, data=params, headers=init_headers)
|
|
resp = requests.post(init_url, data=params, headers=init_headers)
|
|
|
print(resp.text)
|
|
print(resp.text)
|
|
|
|
|
|