【发布时间】:2020-03-11 14:24:24
【问题描述】:
我正在尝试连接到 Gitlab 的 graphql。我已经敲了两个小时头,但还没有找到 Graphql 端点?什么是正确的 graphql 地址?下面是我的python代码
import requests
url = 'https://gitlab.gnome.org/api/graphql'
query = '''
{
group(fullPath: 'World/design') {
id
}
}
'''
headers = {
'Private-Token': '<my-access-token>',
}
response = requests.request("GET", url, json=query, headers=headers)
print(response.text)
任何帮助将不胜感激?
【问题讨论】:
-
他们?你为什么用 body 发送 GET 请求?据我所知,整个
graphql完全在 POST 上运行,当您需要使用 GET 时,查询应作为 url-queryparam 传递。这是文档:graphql.org/learn/serving-over-http -
您的问题解决了吗?我有同样的问题。使用 GraphQL Playground,使用 GitLab 文档中记录的端点:https://
/api/grapql,我收到 500 错误。无法连接到服务器。