Safie API client library for Python
A subscription is required to use the Safie API. Please refer to this link for details.
https://developers.safie.link/
pip install pysafie
By receiving authentication code, you can use it as follows.
import pysafie
client_id = 'hogehoge'
client_secret = 'hogehoge'
redirect_uri = 'https://hoge.com/'
authentication_code = 'hogehoge' # Need to get it from the redirected URL
safie = pysafie.Safie(client_id, client_secret, redirect_uri)
safie.get_access_token(authentication_code)
res = safie.get_device_list() # Returns requests' response object
print(res.json())
If you have already stored token information, you can set it when you create an instance.
import pysafie
client_id = 'hogehoge'
client_secret = 'hogehoge'
redirect_uri = 'https://hoge.com/'
access_token = 'hogehoge'
refresh_token = 'hogehoge'
expires_at = 1624247730 # Set the token expiration in unix time
safie = pysafie.Safie(client_id, client_secret, redirect_uri,
access_token, refresh_token, expires_at)
res = safie.get_device_list() # Returns requests' response object
print(res.json())
For now, this library only supports auth, devices, and media_files APIs.
- kndt84
- Future Standard Co., Ltd.
pysafie is under MIT license.