{ "info": { "author": "Twyla Engineering", "author_email": "software@twyla.ai", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# Asyncio GraphQL Client\nAn asyncio GraphQL client built on top of aiohttp and graphql-core-next. The client by default introspects schemas and validates all queries prior to dispatching to the server.\n\n## Installation\n`pip install aiographql-client`\n\n## Example Usage\nHere are some example usages of this client implementation. These examples use the [Hasura GraphQL Engine](https://hasura.io/).\n\n### Simple Query\n```py\nasync def get_bots():\n client = GraphQLClient(\n endpoint=\"http://localhost:8080/v1alpha1/graphql\",\n headers={\"x-hasura-admin-secret\": \"myadminsecretkey\"},\n )\n request = GraphQLRequest(\n query=\"\"\"\n query get_bots {\n chatbot {\n id, bot_name\n }\n }\n \"\"\"\n )\n transaction = await client.post(request)\n\n # display the query used\n print(transaction.request.query)\n\n # dump the response data\n print(transaction.response.data)\n```\n\n### Query Subscription\n```py\nasync def get_bots():\n client = GraphQLClient(\n endpoint=\"http://localhost:8080/v1alpha1/graphql\",\n headers={\"x-hasura-admin-secret\": \"myadminsecretkey\"},\n )\n request = GraphQLRequest(\n query=\"\"\"\n subscription get_bot_updates {\n chatbot {\n id, bot_name\n }\n }\n \"\"\"\n )\n \n # configure callbacks, here we simply print the event message when a data event\n # (`GraphQLSubscriptionEvent`) is received.\n callbacks = CallbackRegistry()\n callbacks.register(\n GraphQLSubscriptionEventType.DATA, lambda event: print(event.message)\n )\n \n subscription: GraphQLSubscription = await client.subscribe(request, callbacks)\n await subscription.task\n```\n\n### Query Validation Failures\nIf your query is invalid, thanks to graphql-core-next, we get a detailed exception in the traceback.\n\n```\naiographql.client.exceptions.GraphQLClientValidationException: Query validation failed\n\nCannot query field 'ids' on type 'chatbot'. Did you mean 'id'?\n\nGraphQL request (4:13)\n3: chatbot {\n4: ids, bot_names\n ^\n5: }\n\nCannot query field 'bot_names' on type 'chatbot'. Did you mean 'bot_name' or 'bot_language'?\n\nGraphQL request (4:18)\n3: chatbot {\n4: ids, bot_names\n ^\n5: }\n\n```\n\n### Sample Requests\n#### Using `variables` and `operationName`\n```py\nGraphQLRequest(\n query=\"\"\"\n query get_bot_created($id: Int) {\n chatbot(where: {id: {_eq: $id}}) {\n id, created\n }\n }\n query get_bot_name($id: Int) {\n chatbot(where: {id: {_eq: $id}}) {\n id, bot_name\n }\n }\n \"\"\",\n variables={'id': '109'},\n operationName='get_bot_name'\n)\n```\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/twyla-ai/aiographql-client", "keywords": "", "license": "MIT", "maintainer": "Twyla Engineering", "maintainer_email": "software@twyla.ai", "name": "aiographql-client", "package_url": "https://pypi.org/project/aiographql-client/", "platform": "", "project_url": "https://pypi.org/project/aiographql-client/", "project_urls": { "Homepage": "https://github.com/twyla-ai/aiographql-client", "Repository": "https://github.com/twyla-ai/aiographql-client" }, "release_url": "https://pypi.org/project/aiographql-client/0.3.0/", "requires_dist": [ "cafeteria-asyncio (>=0.1.0,<0.2.0)", "aiohttp (>=3.5,<4.0)", "graphql-core-next (>=1.1,<2.0)" ], "requires_python": ">=3.7,<4.0", "summary": "An asyncio GraphQL client built on top of aiohttp and graphql-core-next", "version": "0.3.0" }, "last_serial": 5972052, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "d19a548fe53156514566ebbbd77becd1", "sha256": "b4a9e6a9144bb4baea812a110cb864aec71ca504cd5efdb8af90a6a266803257" }, "downloads": -1, "filename": "aiographql_client-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d19a548fe53156514566ebbbd77becd1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 7980, "upload_time": "2019-07-26T11:05:31", "url": "https://files.pythonhosted.org/packages/26/34/33c24fc60663125b01d3ed3e8d629de31c063e187b4587ce0f37ac3f04a7/aiographql_client-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31949c7aa8a62518ef337b973e0d410c", "sha256": "e9d610d49e2c6c0bb7d2c2d81ef45b1b0d081f36ca49faa9c3fd6036310bc095" }, "downloads": -1, "filename": "aiographql-client-0.3.0.tar.gz", "has_sig": false, "md5_digest": "31949c7aa8a62518ef337b973e0d410c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 7089, "upload_time": "2019-07-26T11:05:30", "url": "https://files.pythonhosted.org/packages/fa/13/cb12d73c0d6e7e60d09f8d9e09c3001402802c58f078405db441f962b16d/aiographql-client-0.3.0.tar.gz" } ], "0.3.0a0": [ { "comment_text": "", "digests": { "md5": "e891f65c14b381eecbccb636b6a78c0a", "sha256": "2ca9ccb3f308f8d157b6186c03b81540ef02757481430c3e82fede21982f0f2c" }, "downloads": -1, "filename": "aiographql_client-0.3.0a0-py3-none-any.whl", "has_sig": false, "md5_digest": "e891f65c14b381eecbccb636b6a78c0a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 7998, "upload_time": "2019-07-26T10:58:37", "url": "https://files.pythonhosted.org/packages/09/f6/98a69517e4220ffb12b91cfa8bffb1682360d340c3bcd61da9d0211995fd/aiographql_client-0.3.0a0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a4338c34759c9df317cf006a4c529b1c", "sha256": "e0213117b21c9df49bbd725394483038dfb413d7fb351f608ece3dfb262968cc" }, "downloads": -1, "filename": "aiographql-client-0.3.0a0.tar.gz", "has_sig": false, "md5_digest": "a4338c34759c9df317cf006a4c529b1c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 7088, "upload_time": "2019-07-26T10:58:35", "url": "https://files.pythonhosted.org/packages/8e/d6/8b48dd8aba86cf56abf7d11c211dab653c857a95106cd6f4fa3cac019d6c/aiographql-client-0.3.0a0.tar.gz" } ], "0.4.0a0": [ { "comment_text": "", "digests": { "md5": "49a004c44c57b4f304fb44702ab39e57", "sha256": "4819b7caf2e5ea443796d10d680f216f80b075ae66ee8ad6430c29e2a014c31b" }, "downloads": -1, "filename": "aiographql_client-0.4.0a0-py3-none-any.whl", "has_sig": false, "md5_digest": "49a004c44c57b4f304fb44702ab39e57", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 8227, "upload_time": "2019-09-12T23:35:38", "url": "https://files.pythonhosted.org/packages/5a/ee/1bcf134766fe5d8e626e72572e99409f0b545cd91f4a3df549047171ec03/aiographql_client-0.4.0a0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc04549edbbd2bea37e0198f7bf79c95", "sha256": "92060c9a5f2b96fdd92c707bf42815efa7f8de5d388e9ccb61e660348d8f3809" }, "downloads": -1, "filename": "aiographql-client-0.4.0a0.tar.gz", "has_sig": false, "md5_digest": "bc04549edbbd2bea37e0198f7bf79c95", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 7355, "upload_time": "2019-09-12T23:35:37", "url": "https://files.pythonhosted.org/packages/d0/a0/f3993aa306876de11780a50241275bc6577ab23b5a0cf1bdb11099fcc6bb/aiographql-client-0.4.0a0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d19a548fe53156514566ebbbd77becd1", "sha256": "b4a9e6a9144bb4baea812a110cb864aec71ca504cd5efdb8af90a6a266803257" }, "downloads": -1, "filename": "aiographql_client-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d19a548fe53156514566ebbbd77becd1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 7980, "upload_time": "2019-07-26T11:05:31", "url": "https://files.pythonhosted.org/packages/26/34/33c24fc60663125b01d3ed3e8d629de31c063e187b4587ce0f37ac3f04a7/aiographql_client-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31949c7aa8a62518ef337b973e0d410c", "sha256": "e9d610d49e2c6c0bb7d2c2d81ef45b1b0d081f36ca49faa9c3fd6036310bc095" }, "downloads": -1, "filename": "aiographql-client-0.3.0.tar.gz", "has_sig": false, "md5_digest": "31949c7aa8a62518ef337b973e0d410c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 7089, "upload_time": "2019-07-26T11:05:30", "url": "https://files.pythonhosted.org/packages/fa/13/cb12d73c0d6e7e60d09f8d9e09c3001402802c58f078405db441f962b16d/aiographql-client-0.3.0.tar.gz" } ] }