Content-Type space change
This commit is contained in:
@@ -231,21 +231,24 @@ def day(Num,get_url,get_url_token,post_url,post_url_token):
|
|||||||
print(result)
|
print(result)
|
||||||
result.to_json('forcast.json', orient="records")
|
result.to_json('forcast.json', orient="records")
|
||||||
|
|
||||||
|
|
||||||
with open('forcast.json', 'r') as json_file:
|
with open('forcast.json', 'r') as json_file:
|
||||||
json_load = json.load(json_file)
|
json_load = json.load(json_file)
|
||||||
#url = "https://demo.bizgaze.app/apis/v4/bizgaze/integrations/demandforecast/saveforecast/List"
|
#url = "https://demo.bizgaze.app/apis/v4/bizgaze/integrations/demandforecast/saveforecast/List"
|
||||||
url=post_url
|
url=post_url
|
||||||
|
|
||||||
payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
||||||
|
print(payload)
|
||||||
#print(payload)
|
#print(payload)
|
||||||
headers = {
|
headers = {
|
||||||
#'Authorization': 'stat 263162e61f084d3392f162eb7ec39b2c',#demo
|
#'Authorization': 'stat 263162e61f084d3392f162eb7ec39b2c',#demo
|
||||||
'Authorization': post_url_token,#test
|
'Authorization': post_url_token,#test
|
||||||
#'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
response = requests.request("POST", url, headers=headers, data=payload)
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
print("##############################################################")
|
# print("##############################################################")
|
||||||
print(response.text)
|
print(response.text)
|
||||||
|
|
||||||
|
|
||||||
return 'done'
|
return 'done'
|
||||||
|
|
||||||
@@ -488,44 +491,20 @@ def month(Num,get_url,get_url_token,post_url,post_url_token):
|
|||||||
with open('forcast.json', 'r') as json_file:
|
with open('forcast.json', 'r') as json_file:
|
||||||
json_load = json.load(json_file)
|
json_load = json.load(json_file)
|
||||||
#url = "https://demo.bizgaze.app/apis/v4/bizgaze/integrations/demandforecast/saveforecast/List"
|
#url = "https://demo.bizgaze.app/apis/v4/bizgaze/integrations/demandforecast/saveforecast/List"
|
||||||
url=post_url
|
url=post_url
|
||||||
|
|
||||||
payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
||||||
|
print(payload)
|
||||||
#print(payload)
|
#print(payload)
|
||||||
headers = {
|
headers = {
|
||||||
#'Authorization': 'stat 263162e61f084d3392f162eb7ec39b2c',#demo
|
#'Authorization': 'stat 263162e61f084d3392f162eb7ec39b2c',#demo
|
||||||
'Authorization': post_url_token,#test
|
'Authorization': post_url_token,#test
|
||||||
# 'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
response = requests.request("POST", url, headers=headers, data=payload)
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
# print("##############################################################")
|
# print("##############################################################")
|
||||||
# print(response.text)
|
print(response.text)
|
||||||
|
|
||||||
# filePath='path.csv'
|
|
||||||
|
|
||||||
|
|
||||||
# if os.path.exists(filePath):
|
|
||||||
# print('file exist')
|
|
||||||
# #userdata = pd.DataFrame(data)
|
|
||||||
# result.to_csv('path.csv', mode='a',index=False, header=False)
|
|
||||||
|
|
||||||
# else:
|
|
||||||
# print("file as it doesn't exists")
|
|
||||||
# #result = pd.DataFrame(data)
|
|
||||||
# result.to_csv('path.csv', index=False)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# result=pd.read_csv('path.csv')
|
|
||||||
# result.to_json('forcast.json', orient="records")
|
|
||||||
# import json
|
|
||||||
|
|
||||||
# # open the JSON file and read its contents
|
|
||||||
# with open(r'forcast.json', 'r') as f:
|
|
||||||
# json_data = json.load(f)
|
|
||||||
|
|
||||||
# print the JSON data
|
|
||||||
#print(json_data)
|
|
||||||
|
|
||||||
#output={"response":"success","result":json_data}
|
#output={"response":"success","result":json_data}
|
||||||
#print(output)
|
#print(output)
|
||||||
|
|||||||
Fai riferimento in un nuovo problema
Block a user