Created
May 5, 2019 22:13
-
-
Save sunny/3594ac48b45362f8d795001d742c44be to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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