prisma-labs / python-graphql-client

Simple GraphQL client for Python 2.7+
MIT License
155 stars 46 forks source link

Is there any way to specify an authorization path, a token for example? #3

Closed eamigo86 closed 7 years ago

eamigo86 commented 7 years ago

I already saw how to do it, nice module, congratulations

sandangel commented 6 years ago

sorry but can you show me an example. I will really appreciate

eamigo86 commented 6 years ago

Hi @sandangel, sorry for the delay, here I show you a simple example:

from graphqlclient import GraphQLClient

client = GraphQLClient('http://localhost:9000/graphql/')
client.token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNTEyODUwMjExLCJlbWFpbCI6Imh1Z29AaXNuc2VjdXJpdHkuY29tIiwib3JpZ19pYXQiOjE1MTI3NjM4MTF9.NLbHf-d257IrjFZ39HJzyvNSdzrlD0J-o8Pl3ybhLvU"

result = client.execute('''
    {
        dbNames{
            dbAlias
            communityName
        }
    }
''')