Skip to content

Instantly share code, notes, and snippets.

@sunny
Created May 5, 2019 22:13
Show Gist options
  • Save sunny/3594ac48b45362f8d795001d742c44be to your computer and use it in GitHub Desktop.
Save sunny/3594ac48b45362f8d795001d742c44be to your computer and use it in GitHub Desktop.
from sgqlc.endpoint.http import HTTPEndpoint
import base64
query = '''
{
creations(limit: 20, offset: 0) {
name
url
}
}
'''
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