addisonlynch / iexfinance

Python SDK for IEX Cloud
https://addisonlynch.github.io/iexfinance
Apache License 2.0
648 stars 136 forks source link

The IEX Cloud API key must be provided either through the token variable or through the environmental variable IEX_TOKEN. #257

Closed P4k0p4N closed 3 years ago

P4k0p4N commented 3 years ago

Summary (include Python version)

I am working on an environment with Python 3.6 on a Mac OSX running Catalina I have the environment variable IEX_TOKEN in place I can ingest iex data via Zipline, So It works.

Date/time of issue

2021-01-27

Expected behavior

Just installed it and testing iexfinance, first time I try using it

Actual behavior


IEXAuthenticationError Traceback (most recent call last)

in 1 IEX_TOKEN='sk_c0d093f1ae704b05983a5b64dffcd54c' ----> 2 stocks.get_ipo_calendar() ~/anaconda3/envs/zipline/lib/python3.6/site-packages/iexfinance/stocks/__init__.py in get_ipo_calendar(period, **kwargs) 158 Desired period (options are "upcoming-ipos" and "today-ipos") 159 """ --> 160 return IPOReader(period, **kwargs).fetch() 161 162 ~/anaconda3/envs/zipline/lib/python3.6/site-packages/iexfinance/stocks/ipocalendar.py in __init__(self, period, **kwargs) 11 raise ValueError("Please enter a valid period.") 12 self.period = period ---> 13 super(IPOReader, self).__init__(**kwargs) 14 15 @property ~/anaconda3/envs/zipline/lib/python3.6/site-packages/iexfinance/base.py in __init__(self, **kwargs) 79 if not self.token or not isinstance(self.token, str): 80 raise auth_error( ---> 81 "The IEX Cloud API key must be provided " 82 "either through the token variable or " 83 "through the environmental variable " IEXAuthenticationError: The IEX Cloud API key must be provided either through the token variable or through the environmental variable IEX_TOKEN.
P4k0p4N commented 3 years ago

I also try passing the token as argument in the function, did not work either. error message API token not valid. As I said it is valid.

cmazzoni87 commented 3 years ago

I am also experiencing this issue, I don't understand why did the issuer closed it without any explanation.

cmazzoni87 commented 3 years ago

os.environ["IEX_TOKEN"] = "" fixes the issue