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

HTTPX: add send method #554

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

HTTPX: add send method #554

wants to merge 1 commit into from

Conversation

lspgn
Copy link

@lspgn lspgn commented Jun 23, 2023

Hello,
Thank you for this library.
In some cases documented by HTTPX, when using directly the send method, the bearer token is not passed.
This change adds a method with a similar signature to request and stream with an auth parameter (those two can likely be removed too).

The only thing I have not fully tested is self.ensure_active_token(self.token) as it's in a non async function.

Thank you

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

  • You consent that the copyright of your pull request source code belongs to Authlib's author.

if not self.token:
raise MissingTokenError()

self.ensure_active_token(self.token)
Copy link
Author

@lspgn lspgn Jun 23, 2023

Choose a reason for hiding this comment

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

Replacing with the following fixes the issue but not sure about the solution

            loop = asyncio.get_running_loop()
            asyncio.ensure_future(self.ensure_active_token(self.token), loop=loop)

@lepture
Copy link
Owner

lepture commented Jul 20, 2023

@lspgn thanks for your work. Maybe you need to add a test case for send method.

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.

None yet

2 participants