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

HTTPBasicAuth Feature #180

Open
FoamyGuy opened this issue Apr 1, 2024 · 7 comments
Open

HTTPBasicAuth Feature #180

FoamyGuy opened this issue Apr 1, 2024 · 7 comments

Comments

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Apr 1, 2024

In CPython requests it looks like there is HTTPBasicAuth which handles encoding credentials into the appropriate format. https://requests.readthedocs.io/en/latest/user/authentication/ we could add that class in the adafruit_requests library and then have matching APIs between circuitpython and CPython more closely.

Once implemented this could be used to simplify a few of the examples that make use of basic auth.

This was originally discussed in #167

@justmobilize
Copy link
Collaborator

@FoamyGuy I think that makes sense. Happy to tackle this if you want

@FoamyGuy
Copy link
Contributor Author

FoamyGuy commented Apr 1, 2024

@justmobilize sounds good, you can if you'd like. Thank you!

@justmobilize
Copy link
Collaborator

@FoamyGuy and @dhalbert I've got this working locally, but have a question.

In CPython it's requests.auth.HTTPBasicAuth. Do we want to mimic that and update requests to have multiple files (and include the main one in __init__ so we don't break things)? Or do we want to just do requests.HTTPBasicAuth?

It's not like it's very big, but if we wanted to add more features, allowing things to be broken up makes sense...

@FoamyGuy
Copy link
Contributor Author

Breaking it up from a single file to a directory with multiple files is okay IMO. So long as if it's an incompatible change we bump the major version and update examples / learn guide code that need it.

It does also feel like a natural time to do it if we want to add auth.HTTPBasicAuth and keep it's importing and usage compatible with CPython.

@justmobilize
Copy link
Collaborator

@FoamyGuy do you know if circup handles this? changing from a single file to a directory?

@justmobilize
Copy link
Collaborator

I tested and it doesn't. I hacked it around esp32spi:
image
So it deleted the old version, but couldn't install the new one

@justmobilize
Copy link
Collaborator

@FoamyGuy and @dhalbert I'm thinking of first tackling updating circup to support this switch. Would you both agree?

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