udemy-graphql/main.py

23 lines
353 B
Python
Raw Normal View History

2023-12-18 20:36:42 +00:00
from graphene import Schema, ObjectType, String
class Query(ObjectType):
hello = String(name=String(default_value="world"))
def resolve_hello(self, info, name):
return "Hello " + name
schema = Schema(query=Query)
gql = """
{
hello(name: "ghasdf")
}
"""
if __name__ == "__main__":
res = schema.execute(gql)
print(res)