Content-Type space change

Este commit está contenido en:
2024-01-12 12:30:53 +00:00
padre 0e6cfbec38
commit 66fe32e4b0
+8 -29
Ver fichero
@@ -231,22 +231,25 @@ 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'
@@ -491,41 +494,17 @@ def month(Num,get_url,get_url_token,post_url,post_url_token):
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)