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

401 response (API key) with local docker hosted server #456

Open
Permafacture opened this issue Sep 7, 2024 · 1 comment
Open

401 response (API key) with local docker hosted server #456

Permafacture opened this issue Sep 7, 2024 · 1 comment

Comments

@Permafacture
Copy link

Describe the bug
Trying to use a local hosted server from the docker container and accessing with the python api. I get a 401 error API key is missing, please provide an API key in the header". This is the same as #407 except the solution there didn't fix it for me.

To Reproduce
Ubuntu 20.04
docker pull downloads.unstructured.io/unstructured-io/unstructured-api:latest
docker run -p 8000:8000 -d --rm --name unstructured-api downloads.unstructured.io/unstructured-io/unstructured-api:latest

then in python:

client = unstructured_client.UnstructuredClient(
    server='free-api',
    server_url=os.getenv("http://0.0.0.0:8000/general/v0/general"),
)
# insert quick start example request here
res = client.general.partition(request=req)  # this raises the error `SDKError: API error occurred: Status 401`
@awalker4
Copy link
Collaborator

Hi there! I believe the issue is that the server param will take precedence over server_url, so the 401 here is the response from our hosted free api. Please give this a try:

client = unstructured_client.UnstructuredClient(
    server_url="http://localhost:8000",
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants