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

URL & paths aren't joined correctly #11

Closed
Bubblbu opened this issue Dec 14, 2023 · 6 comments
Closed

URL & paths aren't joined correctly #11

Bubblbu opened this issue Dec 14, 2023 · 6 comments

Comments

@Bubblbu
Copy link

Bubblbu commented Dec 14, 2023

Hey there! Super cool project; saw your post on reddit and wanted to give it a try as it's a perfect use case for my work.

I think I might have come across one small issue that took me a while to debug.

I followed the docs and put together a Service with the following Resource

reporter_api = Service(
    name="NIH RePORTER API",
    url="https://api.reporter.nih.gov/v2",
    resources=[
        Resource(
            name="publications",
            route="/publications",
            handlers=[
                ("POST", "/search", PublicationRequest),
            ],
            headers={"accept": "application/json", "Content-Type": "application/json"},
        )
)

When I tried it I was getting JSONDecodeErrors and it turned out that the /v2 was lost at some point during initialization. I got it working by providing url="https://api.reporter.nih.gov/v2/" instead but wanted to let you know as you'd probably either want to update the docs or address this in the code base.

Anyway! Thanks again for putting this together

@s-bose
Copy link
Owner

s-bose commented Dec 15, 2023

Thank you so much for the report. Yes this is an issue with urljoin behaving oddly with relative paths.
I'm fixing it. Should be out in a jiffy.

s-bose added a commit that referenced this issue Dec 15, 2023
fix: fix path construction clipping out parts of `base_url` (#11)
@s-bose
Copy link
Owner

s-bose commented Dec 15, 2023

Hi! Should be fixed now with v0.1.4. Please upgrade your package. :)

@Bubblbu
Copy link
Author

Bubblbu commented Dec 16, 2023

Awesome! Thanks :)

@s-bose
Copy link
Owner

s-bose commented Dec 16, 2023

Please let me know if the issue is fixed. I'll close it then. :)

@s-bose
Copy link
Owner

s-bose commented Dec 29, 2023

Closing this issue for now. Feel free to reopen this anytime if it's still present.

@s-bose s-bose closed this as completed Dec 29, 2023
@Bubblbu
Copy link
Author

Bubblbu commented Dec 29, 2023

Sorry didn't have time to check if the issue is fixed yet but sounds good! :)

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