alexgolec / tda-api

A TD Ameritrade API client for Python. Includes historical data for equities and ETFs, options chains, streaming order book data, complex order construction, and more.
https://tda-api.readthedocs.io
MIT License
1.27k stars 339 forks source link

`tda-generate-token.py --help` fails with `ImportError: cannot import name 'USE_CLIENT_DEFAULT' from 'httpx'` #275

Open ddouglas87 opened 3 years ago

ddouglas87 commented 3 years ago

I'm reading the guide https://tda-api.readthedocs.io/en/latest/auth.html#fetching-a-token-and-creating-a-client

If you don’t want to create a client and just want to fetch a token, you can use the tda-generate-token.py script that’s installed with the library.

tda-generate-token.py --help

So on my local machine I did pip install tda-api, everything seems fine.

Then I ran tda-generate-token.py --help and the output I get is:

tda-generate-token.py --help
Traceback (most recent call last):
  File "/usr/local/bin/tda-generate-token.py", line 6, in <module>
    import tda
  File "/usr/local/lib/python3.9/site-packages/tda/__init__.py", line 1, in <module>
    from . import auth
  File "/usr/local/lib/python3.9/site-packages/tda/auth.py", line 4, in <module>
    from authlib.integrations.httpx_client import AsyncOAuth2Client, OAuth2Client
  File "/usr/local/lib/python3.9/site-packages/authlib/integrations/httpx_client/__init__.py", line 10, in <module>
    from .oauth2_client import (
  File "/usr/local/lib/python3.9/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 3, in <module>
    from httpx import AsyncClient, Auth, Client, Request, Response, USE_CLIENT_DEFAULT
ImportError: cannot import name 'USE_CLIENT_DEFAULT' from 'httpx' (/usr/local/lib/python3.9/site-packages/httpx/__init__.py)

I'm using Python 3.9.7 running on MacOS 11.2.1.

ddouglas87 commented 3 years ago

Solution: I updated to Python 3.10.0rc1 and it now works.

pssolanki111 commented 2 years ago

@ddouglas87 consider closing the issue ticket now that the issue is resolved.