[Python] Python GraphQL gql client authentication

Discussão em 'Python' iniciado por Stack, Março 9, 2025.

  1. Stack

    Stack Membro Participativo

    I´m having a hard time using GraphQL with Python, because the suggested library (gql) is completely undocumented.

    I found out that to provide the API URL, I need to pass an RequestsHTTPTransport object to Client like this:

    client = Client(transport=RequestsHTTPTransport(
    url='https://some.api.com/v3/graphql'))


    but how to provide credentials like the Bearer Key?

    I noticed that RequestsHTTPTransport also accepts an auth param, which is described as:


    :param auth: Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth
    ​

    However, I still can not find out how to create this tuple or callable to work with a Bearer Key. :(

    Continue reading...

Compartilhe esta Página