Skip to content

SD2 1406 add error code handling nyckel #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Search for the exact job_id and get only one result or none
  • Loading branch information
juandavidcruzgomez committed Apr 14, 2025
commit eb2f3e35adbb2e95c04a3e58767a36bf33f57dcf
2 changes: 0 additions & 2 deletions edenai_apis/apis/nyckel/nyckel_api.py
Original file line number Diff line number Diff line change
@@ -346,7 +346,6 @@ def image__automl_classification__upload_data_async__launch_job(
post_parameters["data"] = {"annotation.labelName": label}

response = self._session.post(**post_parameters)
print(f"=========> PP_response: {response}")
if file_ is not None:
file_.close()
if response.status_code >= 400:
@@ -369,7 +368,6 @@ def image__automl_classification__upload_data_async__launch_job(
) # retry in case of failure. Because if it fails, the image will be loaded but for the user it's a fail
s.mount("http://", HTTPAdapter(max_retries=retries))
try:
print(f"=========> PP_webhook_token: {self.webhook_token}")
webook_response = s.post(
url=f"https://webhook.site/{self.webhook_token}",
data=json.dumps(data_job_id),
3 changes: 2 additions & 1 deletion edenai_apis/apis/nyckel/nyckel_helpers.py
Original file line number Diff line number Diff line change
@@ -16,9 +16,10 @@ def check_webhook_result(job_id: str, webhook_settings: dict) -> Dict:
"""
webhook_token = webhook_settings["webhook_token"]
api_key = webhook_settings["webhook_api_key"]
query = f'content:"{job_id}"'
webhook_get_url = (
f"https://webhook.site/token/{webhook_token}/requests"
+ f"?sorting=newest&query={urllib.parse.quote_plus('content:'+str(job_id))}"
+ f"?sorting=newest&query={urllib.parse.quote_plus(query)}"
)
webhook_response = requests.get(url=webhook_get_url, headers={"Api-Key": api_key})
response_status = webhook_response.status_code