Repository navigation
apiKey securityScheme support #600
Description
Activity
- added✨ enhancementNew feature or improvementNew feature or improvement
on Apr 20, 2022 I also am dealing with openapi docs that use Basic HTTP Authentication
securitySchemes: basicAuth: type: http scheme: basic
I'm then adding to my request...
security: - basicAuth: []
openapi-python-clientdoes understand that the request should be an authenticated request, since it defines client parameter in the signature ofsync/async/sync_detailed/async_detailedmethods to be of the typeAuthenticatedClientas opposed to justClient. But, theAuthenticatedClientseems to default to a bearer token (as @jrobbins-LiveData shows).Is it posible to fix by templates?
Yes, it is.
Workaround:
Please follow this https://github.com/openapi-generators/openapi-python-client#using-custom-templates
Edit this line in your custom template as you want.
return {"Authorization": f"Bearer {self.token}", **self.headers} Awesome, thanks for providing a workaround @Nov1kov !
Reacted by Ivan NovikovMaybe it would be a good idea to just pass through the
authparameter tohttpx. This would allow one to easily customize authentication, or use existing "plugins", without modifying the client or template.
Here's the documentation on what is possible using that parameter, and an example of a plugin would be httpx-ntlmSounds like another +1 for #202
- added🍭 OpenAPI ComplianceSupporting a new bit of the OpenAPI specSupporting a new bit of the OpenAPI spec
on Aug 13, 2023 - locked and limited conversation to collaborators
on Aug 13, 2023
I'm using a third-party API which has this
securityScheme:and this path (redacted as it is not my API):
The generated code for this API is:
The desired code is: