Commit 82982b23 authored by Luciano Cauzzi's avatar Luciano Cauzzi

auth refactor + exist query with dynamic content

parent ec5d8491
......@@ -57,7 +57,7 @@ class AppPyramidManager:
return False
return True
def exists(self, doc) -> Optional[str]:
def exists(self, query_header, query_id) -> Optional[str]:
try:
url = "{}/{}/_search".format(self.__base_url__, self.__res_url__)
......@@ -65,8 +65,8 @@ class AppPyramidManager:
payload = "{\n\t\"_source\": {\n " \
"\"includes\": \"*\",\n " \
"\"excludes\": \"attachments\"\n " \
"},\n \"query\": {\n \"terms\": {\n \"numero_cronologico\": [ \"" \
+ doc.progressive_number + "\"] \n }\n }\n}"
"},\n \"query\": {\n \"terms\": {\n \"" + query_header + "\": [ \"" \
+ query_id + "\"] \n }\n }\n}"
s = self.__network_manager__.get_session()
response = s.get(url, data=payload, headers=headers, timeout=AppPyramidManager.TIMEOUT)
json_obj = json.loads(response.text)
......@@ -99,6 +99,6 @@ class AppPyramidManager:
def __get_auth_header__(self):
return {
'AUTHORIZATION': self.__app_token__.token,
'Content-Type': "application/json"
}
'AUTHORIZATION': self.__app_token__.token,
'Content-Type': "application/json"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment