Skip to content

feat: bearer auth #111

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Conversation

joscha
Copy link

@joscha joscha commented Feb 27, 2025

This adds a very simple Bearer authentication class.

Happy to add docs, if accepted.

@@ -39,8 +39,13 @@ Before creating an issue please make sure that it was not already reported.
#### Code

1) Create a new branch based on `develop` branch.
* Optional: create and enable virtualenv:
Copy link
Author

Choose a reason for hiding this comment

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

I used a virtualenv here as I didn't want to pollute my local machine with extra packages. Thought it might be useful for others, too.

2) Fetch all dev dependencies.
* Install required python modules using `pip`: **python -m pip install .[testing]**
* Install required python modules using `pip`: **python -m pip install ".[testing]"**
Copy link
Author

Choose a reason for hiding this comment

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

my shell (zsh) didn't like the [ and ] without quoting them.

@@ -43,6 +43,7 @@ issues = "https://github.com/Colin-b/httpx_auth/issues"

[project.optional-dependencies]
testing = [
"pytest==8.3.4",
Copy link
Author

Choose a reason for hiding this comment

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

I am not sure why this was missing here, I assume it comes with pytest-cov in whatever version is deemed suitable there.

@@ -55,12 +56,15 @@ testing = [
"pytest-asyncio==0.25.*",
]

[tool.setuptools]
py-modules = [
"httpx_auth"
Copy link
Author

Choose a reason for hiding this comment

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

this is needed for:

Processing /Users/joscha/dev/httpx_auth
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [93 lines of output]
      No `packages` or `py_modules` configuration, performing automatic discovery.
      `flat-layout` detected -- analysing .
      discovered packages -- ['httpx_auth', 'myenv', 'httpx_auth._oauth2', 'myenv.bin', 'myenv.include', 'myenv.lib']

possibly related to the virtualenv?

@@ -0,0 +1,3 @@
[pytest]
asyncio_mode = auto
Copy link
Author

Choose a reason for hiding this comment

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

Without this, I get:

INTERNALERROR> pytest.PytestConfigWarning: Unknown config option: asyncio_default_fixture_loop_scope

@@ -0,0 +1,3 @@
[pytest]
asyncio_mode = auto
asyncio_default_fixture_loop_scope = "function"
Copy link
Author

Choose a reason for hiding this comment

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

and without this I get:
Screenshot 2025-02-27 at 1 18 34 pm

Copy link

@joscha
Copy link
Author

joscha commented Mar 6, 2025

^ ping @Colin-b

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.

1 participant