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

Migrate client to requests and add get_some_beamline_params #49

Merged
merged 6 commits into from
Aug 13, 2024

Conversation

dperl-dls
Copy link
Collaborator

@dperl-dls dperl-dls commented Jul 9, 2024

Fixes #40 and Fixes #41 and fixes #52
Uses the requests library which automatically manages connection keepalive and adds a method to get a list of specific beamline params

@dperl-dls dperl-dls requested a review from rtuck99 July 9, 2024 10:07
if options
else ""
r = requests.get(
self._url + endpoint + (f"/{item}" if item else ""), options, json=data
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should urlencode path parameters using something like urllib.parse.quote() - looks like requests does not have a convenient way to encode them and only supports query params.

Copy link
Collaborator Author

@dperl-dls dperl-dls Jul 15, 2024

Choose a reason for hiding this comment

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

I don't see how this would really help that much, urllib also doesn't support combining components of the path either? Anyway, could we make that into a new issue since this already fixes some problems? #53

if options
else ""
r = requests.get(
self._url + endpoint + (f"/{item}" if item else ""), options, json=data
Copy link
Collaborator

Choose a reason for hiding this comment

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

json=data? Are we sending json in GET request body? Seems like a bad idea. What is this really doing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, for getting a specific list of beamline params. what do you think is a better way of doing it? query params don't nicely support putting a list in there

@dperl-dls dperl-dls merged commit 9d29a5c into main Aug 13, 2024
4 checks passed
@dperl-dls dperl-dls deleted the migrate_client_to_requests branch August 13, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants