Add basic auth

This commit is contained in:
Ivan Vazhenin
2023-03-12 16:37:41 +03:00
parent 3d999a5fc4
commit fde2d5513e
7 changed files with 149 additions and 4 deletions

30
requests/graphql.py Normal file
View 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']