graphql-python / gql

A GraphQL client in Python
https://gql.readthedocs.io
MIT License
1.53k stars 178 forks source link

requests_toolbelt isn't listed as an optional dependency although required for logging changes #469

Closed dylanmorroll closed 7 months ago

dylanmorroll commented 7 months ago

Describe the bug When changing the logging level by using the following import line: from gql.transport.requests import log as gql_logger

The following error is raised:

  File ".../lib/python3.11/site-packages/gql/transport/requests.py", line 11, in <module>
    from requests_toolbelt.multipart.encoder import MultipartEncoder
ModuleNotFoundError: No module named 'requests_toolbelt'

To Reproduce Install gql, import gql.transport.requests.log and run.

Expected behavior An error is fine, but checking the wiki, there is no mention of it as an optional dependency.

I would expect the wiki should detail it as an optional dependency, also on the logging page where the information is given.

If possible it would be also nice if the error message of the raised error included this information.

System info (please complete the following information):

dylanmorroll commented 7 months ago

Nevermind I realised what has happened, I just presumed cause in the wiki it only mentions requests and websockets for logging that all http related stuff was in requests.

I changed my logging line to: from gql.transport.aiohttp import log as gql_aiohttp_logger

and now the error has gone and my logging setting is working