在 django 上启用 graphine
url(r'^graphql', csrf_exempt(GraphQLView.as_view(graphiql=settings.DEBUG))),
执行一些查询并查看它是否正常工作
在 Chrome 浏览器上,转到graphiQL端点:http://localhost:8000/graphql?在浏览器中打开“开发者工具”并转到“网络”选项卡。
再次执行您的查询。现在它出现在请求列表中。现在鼠标右键单击它并复制它“复制为CURL ”。现在您可以将其复制粘贴到安装了 curl 的 linux 终端。或者就像在您的情况下,您可以尝试扣除那里的内容,并尝试在您的 IDE 中重用它,例如 Insomnia 或 Postman 等客户端。例如,您可能会发现与graphiQL enpoint 上的会话一起使用的授权最终不是您想要的……
curl 'http://localhost:8000/graphql?' -H 'Origin: http://localhost:8000' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8,de;q=0.7' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Cookie: _ga=GA1.1.1578283610.1528109563; _gid=GA1.1.920024733.1541592686; csrftoken=EGBeegFoyMVl8j1fQbuEBG587nOFP2INwv7Q0Ee6HeHHmsLOPUwRonzun9Y6pOjV; sessionid=4u9vngcnmjh927a9avpssvc4oq9qyqoe' -H 'Connection: keep-alive' -H 'X-CSRFToken: EGBeegFoyMVl8j1fQbuEBG587nOFP2INwv7Q0Ee6HeHHmsLOPUwRonzun9Y6pOjV' --data-binary '{"query":"{\n allStatistics(projectId: 413581, first:25) {\n pageInfo {\n startCursor\n endCursor\n hasPreviousPage\n hasNextPage\n }\n edges {\n cursor\n node {\n id\n clickouts\n commissionCanc\n commissionConf\n commissionLeads\n commissionOpen\n eventDate\n extractTstamp\n hash\n leads\n pageviews\n projectId\n transactionsCanc\n transactionsConf\n transactionsOpen\n }\n }\n }\n}\n","variables":null,"operationName":null}' --compressed