標籤:odi edit and 請求 erro header ast val running
#!/usr/bin/python
#coding:utf-8
import requests
import sys
import urllib
import json
import chardet
TARGET_HOST = sys.argv[1]
url = [‘http://‘,TARGET_HOST,‘:30003‘,‘/app-wanda-credit-ds/inner/service/dataService/testfetch‘]
url_name = ‘‘.join(url)
payload = {
"id": "ds_mas_cardAuth",
"params_in": [
{
"byLast": "false",
"id": "name",
"value": "於六二"
},
{
"byLast": "false",
"id": "cardNo",
"value": "330421197709281519"
}
,
{
"byLast": "false",
"id": "cardId",
"value": "6217993300067121225"
},
{
"byLast": "false",
"id": "phone",
"value": "13606833183"
}
],
"refProdCode": "P_C_B142"
}
data = json.dumps(payload)
headers = {
‘content-type‘: "application/json",
‘cache-control‘: "no-cache",
‘postman-token‘: "7902aabc-c83a-1ccb-3f45-a8bcce131cd5"
}
response = requests.request("POST", url_name, data=data, headers=headers)
#print(response.text)
result = json.loads(response.text)
status_num = result["rettag"]["status"].encode(‘utf-8‘)
retstatus = result["retstatus"].encode(‘utf-8‘)
if status_num == "000000" and retstatus == "STATUS_SUCCESS":
print " status is %s ds is running"%status_num
else:
print "status is %s ERROR!!!!!!!!!!!"%status_num
python post請求資料案例