Last active
March 27, 2023 20:35
-
-
Save sunny/7b1fe9b9db81467886e3ec954f21a64e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example GraphQL call using https://github.com/prisma/python-graphql-client | |
from sgqlc.endpoint.http import HTTPEndpoint | |
import base64 | |
query = ''' | |
{ | |
creationsBatch(limit: 3) { | |
results { | |
name(locale: EN) | |
url | |
creator { | |
nick | |
} | |
} | |
} | |
} | |
''' | |
variables = {} | |
user = 'USER' | |
password = 'PASSWORD' | |
token = base64.b64encode(str.encode(user + ':' + password)).decode() | |
headers = { | |
'Authorization': 'Basic ' + token, | |
'User-Agent': 'GraphQL API client' | |
} | |
url = 'https://cults3d.com/graphql' | |
endpoint = HTTPEndpoint(url, headers) | |
data = endpoint(query, variables) | |
data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment