{"id":14975982,"url":"https://github.com/prodigyeducation/python-graphql-client","last_synced_at":"2025-04-05T20:09:43.328Z","repository":{"id":44381242,"uuid":"235252234","full_name":"prodigyeducation/python-graphql-client","owner":"prodigyeducation","description":"Simple module for making requests to a graphQL server in python.","archived":false,"fork":false,"pushed_at":"2024-04-07T08:23:35.000Z","size":74,"stargazers_count":80,"open_issues_count":14,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T19:07:01.763Z","etag":null,"topics":["graphql","graphql-client","python","python-graphql-client"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/python-graphql-client/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prodigyeducation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-21T03:59:41.000Z","updated_at":"2024-07-31T19:26:39.000Z","dependencies_parsed_at":"2024-06-18T15:33:10.308Z","dependency_job_id":"8a87ec28-98a7-4a7b-83bb-22ef3fb2ff34","html_url":"https://github.com/prodigyeducation/python-graphql-client","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodigyeducation%2Fpython-graphql-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodigyeducation%2Fpython-graphql-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodigyeducation%2Fpython-graphql-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodigyeducation%2Fpython-graphql-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prodigyeducation","download_url":"https://codeload.github.com/prodigyeducation/python-graphql-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393574,"owners_count":20931813,"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":["graphql","graphql-client","python","python-graphql-client"],"created_at":"2024-09-24T13:53:05.072Z","updated_at":"2025-04-05T20:09:43.296Z","avatar_url":"https://github.com/prodigyeducation.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n![Python CI Checks](https://github.com/prodigyeducation/python-graphql-client/workflows/Python%20CI%20Checks/badge.svg)\n![Upload Python Package](https://github.com/prodigyeducation/python-graphql-client/workflows/Upload%20Python%20Package/badge.svg)\n\n# Python GraphQL Client\n\n\u003e Simple package for making requests to a graphql server.\n\n\u003c!-- Badges here. --\u003e\n\n## Installation\n\n```bash\npip install python-graphql-client\n```\n\n## Usage\n\n### Queries \u0026 Mutations\n\n```py\nfrom python_graphql_client import GraphqlClient\n\n# Instantiate the client with an endpoint.\nclient = GraphqlClient(endpoint=\"https://countries.trevorblades.com\")\n\n# Create the query string and variables required for the request.\nquery = \"\"\"\n    query countryQuery($countryCode: String) {\n        country(code:$countryCode) {\n            code\n            name\n        }\n    }\n\"\"\"\nvariables = {\"countryCode\": \"CA\"}\n\n# Synchronous request\ndata = client.execute(query=query, variables=variables)\nprint(data)  # =\u003e {'data': {'country': {'code': 'CA', 'name': 'Canada'}}}\n\n\n# Asynchronous request\nimport asyncio\n\ndata = asyncio.run(client.execute_async(query=query, variables=variables))\nprint(data)  # =\u003e {'data': {'country': {'code': 'CA', 'name': 'Canada'}}}\n```\n\n### Subscriptions\n\n```py\nfrom python_graphql_client import GraphqlClient\n\n# Instantiate the client with a websocket endpoint.\nclient = GraphqlClient(endpoint=\"wss://www.your-api.com/graphql\")\n\n# Create the query string and variables required for the request.\nquery = \"\"\"\n    subscription onMessageAdded {\n        messageAdded\n    }\n\"\"\"\n\n# Asynchronous request\nimport asyncio\n\nasyncio.run(client.subscribe(query=query, handle=print))\n# =\u003e {'data': {'messageAdded': 'Error omnis quis.'}}\n# =\u003e {'data': {'messageAdded': 'Enim asperiores omnis.'}}\n# =\u003e {'data': {'messageAdded': 'Unde ullam consequatur quam eius vel.'}}\n# ...\n```\n\n## Advanced Usage\n\n### Disable SSL verification\n\nSet the keyword argument `verify=False` ether when instantiating the `GraphqlClient` class.\n\n```py\nfrom python_graphql_client import GraphqlClient\n\nclient = GraphqlClient(endpoint=\"wss://www.your-api.com/graphql\", verify=False)\n```\n\nAlternatively, you can set it when calling the `execute` method.\n\n```py\nfrom python_graphql_client import GraphqlClient\n\nclient = GraphqlClient(endpoint=\"wss://www.your-api.com/graphql\"\nclient.execute(query=\"\u003cYour Query\u003e\", verify=False)\n```\n\n### Custom Authentication\n\n```py\nfrom requests.auth import HTTPBasicAuth\nfrom python_graphql_client import GraphqlClient\n\nauth = HTTPBasicAuth('fake@example.com', 'not_a_real_password')\nclient = GraphqlClient(endpoint=\"wss://www.your-api.com/graphql\", auth=auth)\n```\n\n### Custom Headers\n```py\nfrom python_graphql_client import GraphqlClient\n\nheaders = { \"Authorization\": \"Token SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV\" }\nclient = GraphqlClient(endpoint=\"wss://www.your-api.com/graphql\", headers=headers)\n```\n\n## Roadmap\n\nTo start we'll try and use a Github project board for listing current work and updating priorities of upcoming features.\n\n## Contributing\n\nRead the [Contributing](docs/CONTRIBUTING.md) documentation for details on the process for submitting pull requests to the project. Also take a peek at our [Code of Conduct](docs/CODE_OF_CONDUCT.md).\n\n## Authors and Acknowledgement\n\nKudos to @xkludge, @DaleSeo, and @mattbullock for getting this project started.\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprodigyeducation%2Fpython-graphql-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprodigyeducation%2Fpython-graphql-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprodigyeducation%2Fpython-graphql-client/lists"}