Skip to content
Snippets Groups Projects
Select Git revision
  • d210dd40f780121941a90c970fdf84d84d53a40c
  • main default protected
2 results

Stat.pm

Blame
  • utils.py 529 B
    import json
    
    from openlobby.core.auth import create_access_token
    
    
    def call_api(client, query, input=None, username=None):
        variables = json.dumps({'input': input or {}})
        if username is None:
            res = client.post('/graphql', {'query': query, 'variables': variables})
        else:
            token = create_access_token(username)
            auth_header = 'Bearer {}'.format(token)
            res = client.post('/graphql', {'query': query, 'variables': variables},
                HTTP_AUTHORIZATION=auth_header)
        return res.json()