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

Allow extra headers #2971

Open
kliem opened this issue May 15, 2024 · 1 comment
Open

Allow extra headers #2971

kliem opened this issue May 15, 2024 · 1 comment

Comments

@kliem
Copy link

kliem commented May 15, 2024

I need to call my github instance with additional custom headers.

E.g. there are authorizations methods that use other headers than Authorization.

@EnricoMi
Copy link
Collaborator

EnricoMi commented May 31, 2024

This is not possible right now.

Given these headers are specifically need for authorization, the use of Auth should be refactored for your use case.

Instead of (in Requester)

        if self.__auth is not None:
            requestHeaders["Authorization"] = f"{self.__auth.token_type} {self.__auth.token}"

the Auth should integrate like

        if self.__auth is not None:
            self.__auth.authenticate(requestHeaders)

where default implementation would be

    def authenticate(headers):
        headers["Authorization"] = f"{self.__auth.token_type} {self.__auth.token}"

You could then implement your own Auth setting any header that you need for authentication.

Could be combined with #2811

        if self.__auth is not None:
            self.__auth.authenticate(session)

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