Skip to content

Conversation

@Coniferish
Copy link
Contributor

@Coniferish Coniferish commented Feb 6, 2024

Final PR for closing #30

This PR adds a decorator to the partition method of the General class to catch if a 401 error is being raised while server_url is None and add a warning message.

Testing

from unstructured_client.models import shared
from unstructured_client import UnstructuredClient

FAKE_KEY = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

client = UnstructuredClient(
    api_key_auth=FAKE_KEY,
)
        
filename = "_sample_docs/layout-parser-paper-fast.pdf"
        
with open(filename, "rb") as f:
   files=shared.Files(
        content=f.read(),
        file_name=filename,
   )

req = shared.PartitionParameters(
    files=files,
)

client.general.partition(req)

@Coniferish Coniferish force-pushed the jj/suggest_url_if_401 branch 2 times, most recently from 89f09e6 to eb5db40 Compare February 6, 2024 16:12
@Coniferish Coniferish force-pushed the jj/suggest_url_if_401 branch from eb5db40 to 7d5ad36 Compare February 6, 2024 16:19
@Coniferish Coniferish requested review from awalker4 and scanny February 6, 2024 16:45
@Coniferish Coniferish marked this pull request as ready for review February 6, 2024 16:46
Copy link

@scanny scanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few remarks. Code looks fine to me.

@Coniferish Coniferish requested a review from scanny February 6, 2024 22:58
Copy link

@scanny scanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a couple formatting issues I marked. Approving in advance.

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

Successfully merging this pull request may close these issues.

3 participants