Skip to main content

Safie API client library for Python

Project description

pysafie

Safie API client library for Python

Requirement

A subscription is required to use the Safie API. Please refer to this link for details.
https://developers.safie.link/

Installation

pip install pysafie

Usage

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())

Note

For now, this library only supports auth, devices, and media_files APIs.

Author

  • kndt84
  • Future Standard Co., Ltd.

License

pysafie is under MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pysafie-0.3-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page