I was trying to execute the following the below codes (copied from the basic tutorial) but kept getting errors 'ServerException: SimFin server error: The specified api key is invalid.' I have installed the simfin as well as have a valid key. What could be the cause of this? Does it not work with python 3.7 or above? Thanks!
import simfin as sf
# Set your SimFin+ API-key for downloading data.
sf.set_api_key('my_API_key')
# Set the local directory where data-files are stored.
# The directory will be created if it does not already exist.
sf.set_data_dir('~/simfin_data/')
# Download the data from the SimFin server and load into a Pandas DataFrame.
df = sf.load_income(variant='annual', market='us')
# Print the first rows of the data.
print(df.head())
This is the full error...
Dataset "us-income-ttm" not on disk.
---------------------------------------------------------------------------
ServerException Traceback (most recent call last)
in
~\Anaconda3\lib\site-packages\simfin\load.py in load(dataset, variant, market, parse_dates, index, refresh_days)
130
131 # Download file if it does not exist on local disk, or if it is too old.
--> 132 _maybe_download_dataset(**dataset_args, refresh_days=refresh_days)
133
134 # Lambda function for converting strings to dates. Format: YYYY-MM-DD
~\Anaconda3\lib\site-packages\simfin\download.py in _maybe_download_dataset(refresh_days, **kwargs)
289 url = _url_dataset(**kwargs)
290
--> 291 return _maybe_download(name=dataset_name, path=path,
292 download_path=download_path,
293 url=url, refresh_days=refresh_days)
~\Anaconda3\lib\site-packages\simfin\download.py in _maybe_download(name, url, path, download_path, refresh_days)
237 # Download the file from the SimFin server.
238 # This is assumed to succeed unless an exception is raised.
--> 239 _download(url=url, download_path=download_path)
240
241 if download_path.endswith('zip'):
~\Anaconda3\lib\site-packages\simfin\download.py in _download(url, download_path)
165
166 # Raise exception with the error message from the server.
--> 167 raise ServerException(error)
168
169 # Or if another error occurred.
ServerException: SimFin server error: The specified api key is invalid.
Comments
it shouldn't be related to the Python version at all.
Your API key is working fine for me (but you shouldn't post it here publicly in the forum, I edited your post now).
If you still have problems, please write an e-mail to info@simfin.com