|
@@ -231,21 +231,24 @@ def day(Num,get_url,get_url_token,post_url,post_url_token):
|
231
|
231
|
print(result)
|
232
|
232
|
result.to_json('forcast.json', orient="records")
|
233
|
233
|
|
|
234
|
+
|
234
|
235
|
with open('forcast.json', 'r') as json_file:
|
235
|
236
|
json_load = json.load(json_file)
|
236
|
237
|
#url = "https://demo.bizgaze.app/apis/v4/bizgaze/integrations/demandforecast/saveforecast/List"
|
237
|
|
- url=post_url
|
|
238
|
+ url=post_url
|
238
|
239
|
|
239
|
|
- payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
|
240
|
+ payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
|
241
|
+ print(payload)
|
240
|
242
|
#print(payload)
|
241
|
|
- headers = {
|
|
243
|
+ headers = {
|
242
|
244
|
#'Authorization': 'stat 263162e61f084d3392f162eb7ec39b2c',#demo
|
243
|
245
|
'Authorization': post_url_token,#test
|
244
|
|
- #'Content-Type': 'application/json'
|
245
|
|
- }
|
246
|
|
- response = requests.request("POST", url, headers=headers, data=payload)
|
247
|
|
- print("##############################################################")
|
248
|
|
- print(response.text)
|
|
246
|
+ 'Content-Type': 'application/json'
|
|
247
|
+ }
|
|
248
|
+ response = requests.request("POST", url, headers=headers, data=payload)
|
|
249
|
+ # print("##############################################################")
|
|
250
|
+ print(response.text)
|
|
251
|
+
|
249
|
252
|
|
250
|
253
|
return 'done'
|
251
|
254
|
|
|
@@ -488,44 +491,20 @@ def month(Num,get_url,get_url_token,post_url,post_url_token):
|
488
|
491
|
with open('forcast.json', 'r') as json_file:
|
489
|
492
|
json_load = json.load(json_file)
|
490
|
493
|
#url = "https://demo.bizgaze.app/apis/v4/bizgaze/integrations/demandforecast/saveforecast/List"
|
491
|
|
- url=post_url
|
|
494
|
+ url=post_url
|
492
|
495
|
|
493
|
|
- payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
|
496
|
+ payload = json.dumps(json_load)#.replace("]", "").replace("[", "")
|
|
497
|
+ print(payload)
|
494
|
498
|
#print(payload)
|
495
|
|
- headers = {
|
|
499
|
+ headers = {
|
496
|
500
|
#'Authorization': 'stat 263162e61f084d3392f162eb7ec39b2c',#demo
|
497
|
501
|
'Authorization': post_url_token,#test
|
498
|
|
- # 'Content-Type': 'application/json'
|
499
|
|
- }
|
500
|
|
- response = requests.request("POST", url, headers=headers, data=payload)
|
|
502
|
+ 'Content-Type': 'application/json'
|
|
503
|
+ }
|
|
504
|
+ response = requests.request("POST", url, headers=headers, data=payload)
|
501
|
505
|
# print("##############################################################")
|
502
|
|
- # print(response.text)
|
503
|
|
-
|
504
|
|
- # filePath='path.csv'
|
505
|
|
-
|
506
|
|
-
|
507
|
|
- # if os.path.exists(filePath):
|
508
|
|
- # print('file exist')
|
509
|
|
- # #userdata = pd.DataFrame(data)
|
510
|
|
- # result.to_csv('path.csv', mode='a',index=False, header=False)
|
511
|
|
-
|
512
|
|
- # else:
|
513
|
|
- # print("file as it doesn't exists")
|
514
|
|
- # #result = pd.DataFrame(data)
|
515
|
|
- # result.to_csv('path.csv', index=False)
|
516
|
|
-
|
517
|
|
-
|
518
|
|
-
|
519
|
|
- # result=pd.read_csv('path.csv')
|
520
|
|
- # result.to_json('forcast.json', orient="records")
|
521
|
|
- # import json
|
522
|
|
-
|
523
|
|
- # # open the JSON file and read its contents
|
524
|
|
- # with open(r'forcast.json', 'r') as f:
|
525
|
|
- # json_data = json.load(f)
|
|
506
|
+ print(response.text)
|
526
|
507
|
|
527
|
|
- # print the JSON data
|
528
|
|
- #print(json_data)
|
529
|
508
|
|
530
|
509
|
#output={"response":"success","result":json_data}
|
531
|
510
|
#print(output)
|