Add basic auth
This commit is contained in:
30
requests/graphql.py
Normal file
30
requests/graphql.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from gql import gql, Client
|
||||
from gql.transport.aiohttp import AIOHTTPTransport
|
||||
|
||||
transport = AIOHTTPTransport(url="https://gql.ivazh.ru/graphql/")
|
||||
|
||||
|
||||
def get_classifier():
|
||||
client = Client(transport=transport, fetch_schema_from_transport=True)
|
||||
query = gql(
|
||||
"""
|
||||
query getClassifier {
|
||||
getClassifier(name: "ood")
|
||||
}
|
||||
"""
|
||||
)
|
||||
result = client.execute(query)
|
||||
return result['getClassifier']
|
||||
|
||||
|
||||
def get_catalog():
|
||||
client = Client(transport=transport, fetch_schema_from_transport=True)
|
||||
query = gql(
|
||||
"""
|
||||
query getCatalog {
|
||||
getCatalog(name: "ood")
|
||||
}
|
||||
"""
|
||||
)
|
||||
result = client.execute(query)
|
||||
return result['getClassifier']
|
||||
Reference in New Issue
Block a user