Skip to content
Snippets Groups Projects
Commit 3871d603 authored by Daalen, Tim van's avatar Daalen, Tim van
Browse files

Agenso file-path update

parent 097d3130
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
import requests
import json
credentials_filepath = "credentials.json"
credentials_filepath = "/home/adlink/inference/credentials.json"
login_url = "https://dss.optima-h2020.eu/api/v1/login"
upload_url = "https://dss.optima-h2020.eu/api/v1/sightings"
bulk_upload_url = "https://dss.optima-h2020.eu/api/v1/sightings/bulk"
......
......@@ -33,16 +33,16 @@ class send_AGENSO_data(Thread):
self.send_batch(data_batch, file_path)
sleep(self.send_interval) #secs
else:
error_filepath = self.get_base_filepath(file_path)
error_filepath, ext = self.get_base_filepath(file_path)
move(file_path, error_filepath)
def get_base_filepath(self, file_path):
base_filename, ext = os.path.splitext(os.path.basename(file_path))
error_filepath = os.path.join(self.error_folder, base_filename)
return error_filepath
return (error_filepath, ext)
def send_batch(self, data_batch, file_path):
error_filepath = self.get_base_filepath(file_path)
error_filepath, ext = self.get_base_filepath(file_path)
data_json = json.dumps({"items":data_batch})
(upl_status, reply) = self.agenso.batch_upload(data_json)
......@@ -55,7 +55,7 @@ class send_AGENSO_data(Thread):
print(reply[i][0])
print(data_batch[i])
fautive_message = data_batch[i]
f_file_path = base_filepath + "_" + str(i) + ext
f_file_path = error_filepath + "_" + str(i) + ext
data_tofile(fautive_message, f_file_path)
os.remove(file_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment