{"id":22970791,"url":"https://github.com/labteral/easygraphql","last_synced_at":"2025-08-13T11:33:48.768Z","repository":{"id":57425100,"uuid":"231763949","full_name":"labteral/easygraphql","owner":"labteral","description":"A minimal library to interact with GraphQL from Python","archived":false,"fork":false,"pushed_at":"2023-11-29T13:56:51.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-08T16:12:44.197Z","etag":null,"topics":["auth","graphql","headers","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/labteral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-04T13:01:48.000Z","updated_at":"2023-11-29T13:56:55.000Z","dependencies_parsed_at":"2022-09-19T06:31:01.481Z","dependency_job_id":null,"html_url":"https://github.com/labteral/easygraphql","commit_stats":null,"previous_names":["brunneis/easygraphql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Feasygraphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Feasygraphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Feasygraphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Feasygraphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labteral","download_url":"https://codeload.github.com/labteral/easygraphql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229759832,"owners_count":18119874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","graphql","headers","python"],"created_at":"2024-12-14T22:14:38.945Z","updated_at":"2024-12-14T22:14:39.387Z","avatar_url":"https://github.com/labteral.png","language":"Python","readme":"# easygraphql\nA minimal library to interact with GraphQL from Python\n\n## Installation\n```bash\npip install easygraphql\n```\n\n## Usage\n\n### Instantiation\n```python\nfrom easygraphql import GraphQL\n\ngraphql = GraphQL('https://example.org/graphql')\nquery = '''\n    query {\n        hello\n    }\n'''\ndata, errors = graphql.execute(query)\n```\n\n### Authentication\nYou can set global headers that will be added to all your GraphQL operations: \n```python\ngraphql.set_headers({'Authorization': 'Bearer xxxxx'})\n```\n\nYou can also unset them:\n```python\ngraphql.unset_headers()\n```\n\nOr directly provide them on every execution:\n```python\ndata, errors = graphql.execute(query, headers={'Authorization': 'Bearer xxxxx'})\n```\n\n## Examples\n\n### Query without variables\n```python\nfrom easygraphql import GraphQL\n\ngraphql = GraphQL('https://swapi-graphql.netlify.com/.netlify/functions/index')\nquery = '''\n    query {\n        allFilms {\n            films {\n                title\n                director\n            }\n        }\n    }\n'''\ndata, errors = graphql.execute(query)\n```\n\n```json\n{\n    \"allFilms\": {\n        \"films\": [\n            {\n                \"title\": \"A New Hope\",\n                \"director\": \"George Lucas\"\n            },\n            {\n                \"title\": \"The Empire Strikes Back\",\n                \"director\": \"Irvin Kershner\"\n            },\n            {\n                \"title\": \"Return of the Jedi\",\n                \"director\": \"Richard Marquand\"\n            },\n            {\n                \"title\": \"The Phantom Menace\",\n                \"director\": \"George Lucas\"\n            },\n            {\n                \"title\": \"Attack of the Clones\",\n                \"director\": \"George Lucas\"\n            },\n            {\n                \"title\": \"Revenge of the Sith\",\n                \"director\": \"George Lucas\"\n            },\n            {\n                \"title\": \"The Force Awakens\",\n                \"director\": \"J. J. Abrams\"\n            }\n        ]\n    }\n}\n```\n\n### Query with variables\n```python\nfrom easygraphql import GraphQL\n\ngraphql = GraphQL('https://swapi-graphql.netlify.com/.netlify/functions/index')\nquery = '''\n    query GetFilm($id: ID!){\n        film(id: $id) {\n            title\n            director\n        }\n    }\n'''\nvariables = {\"id\": \"ZmlsbXM6MQ==\"}\ndata, errors = graphql.execute(query, variables)\n```\n\n```json\n{\n    \"film\": {\n        \"title\": \"A New Hope\",\n        \"director\": \"George Lucas\"\n    }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabteral%2Feasygraphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabteral%2Feasygraphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabteral%2Feasygraphql/lists"}