Deepomatic / deepomatic-client-python

Python Client
Other
14 stars 0 forks source link

Can not create Client object if we do not specify env vars #85

Closed ibreschi closed 4 years ago

ibreschi commented 4 years ago

There is exception when we initialize a client without setting either DEEPOMATIC_API_KEY or DEEPOMATIC_APP_ID as environment variables.

In a python console with DEEPOMATIC_API_KEY and DEEPOMATIC_APP_ID unset:

from deepomatic.api.client import Client
client = Client(api_key="XXXXXXXXXX")

Traceback (most recent call last):
  File "/home/ibreschi/.local/lib/python3.6/site-packages/deepomatic/api/client.py", line 67, in __init__
    self.http_helper = HTTPHelper(*args, **kwargs)
  File "/home/ibreschi/.local/lib/python3.6/site-packages/deepomatic/api/http_helper.py", line 56, in __init__
    raise DeepomaticException("Please specify 'app_id' and 'api_key' either by passing those values to the client or by defining the DEEPOMATIC_APP_ID and DEEPOMATIC_API_KEY environment variables.")

If we set either DEEPOMATIC_API_KEY or DEEPOMATIC_APP_ID (or both) as environment variables:

from deepomatic.api.client import Client
client = Client(api_key="XXXXXXXXXX")
# works
maingoh commented 4 years ago

You need to upgrade to the latest version 0.9.1. The script only use api_key for auth which is only available in the latest version of the client