Skip to content
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

Fix 405 response from suggest requests #7

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

juhoinkinen
Copy link
Member

@UnniKohonen noted that annif-client was giving 405 error. The default usage

$ python3 annif_client.py

was crashing in the suggest step:

* Analyzing a short text from a string
Traceback (most recent call last):
  File "annif_client.py", line 94, in <module>
    results = annif.suggest(project_id='yso-en',
  File "annif_client.py", line 50, in suggest
    req.raise_for_status()
  File "/home/juhoi/git/Annif-client/venv/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: METHOD NOT ALLOWED for url: https://api.annif.org/v1/projects/yso-en/suggest

The default API address has been http://api.annif.org, but nowdays some component in the platform of the API is redirecting http traffic to https. The redirection works for GET requests (list projects and show project information), but not for POST requests (suggest).

Fix for this is to use https address: https://api.annif.org

@juhoinkinen
Copy link
Member Author

Force-pushed because rebased on master (which had the CI/CD pipeline fixed).

@juhoinkinen juhoinkinen added the bug Something isn't working label Aug 22, 2023
@juhoinkinen
Copy link
Member Author

This was working for @UnniKohonen so I'll merge this now.

@juhoinkinen juhoinkinen merged commit ad78db7 into master Aug 23, 2023
10 checks passed
@juhoinkinen juhoinkinen deleted the fix-405-response-from-suggest branch August 23, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant