Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/129.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python GraphQL gql客户端身份验证_Python_Oauth_Graphql_Graphql Python - Fatal编程技术网

Python GraphQL gql客户端身份验证

Python GraphQL gql客户端身份验证,python,oauth,graphql,graphql-python,Python,Oauth,Graphql,Graphql Python,我很难将GraphQL与Python结合使用,因为建议的库:完全没有文档记录 我如何发现,要提供api url,我需要向客户端传递RequestsHTTPTransport对象,如下所示: client = Client(transport=RequestsHTTPTransport(url='https://some.api.com/v3/graphql')) 但是如何提供像承载密钥这样的凭证呢 PS 我注意到它requestshttpttransport还接受一个auth参数,该参数被描述

我很难将GraphQL与Python结合使用,因为建议的库:完全没有文档记录

我如何发现,要提供api url,我需要向客户端传递RequestsHTTPTransport对象,如下所示:

client = Client(transport=RequestsHTTPTransport(url='https://some.api.com/v3/graphql'))
但是如何提供像承载密钥这样的凭证呢

PS 我注意到它requestshttpttransport还接受一个auth参数,该参数被描述为:

:param auth: Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth
然而,我仍然无法找到如何创建此元组或可调用以使用承载密钥:(


感谢您的建议,您可以将其添加到标题中

reqHeaders = {
    'x-api-key' : API_KEY,
    'Authorization': 'Bearer ' + TOKEN_KEY // This is the key
}

_transport = RequestsHTTPTransport(
    url=API_ENDPOINT,
    headers = reqHeaders,
    use_json=True,
)

client = Client(
    transport = _transport,
    fetch_schema_from_transport=True,
)