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

Uploaded Python 3

File details

Details for the file pysafie-0.3-py3-none-any.whl.

File metadata

  • Download URL: pysafie-0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pysafie-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 549584b8741b0bd8cc9b3f0d5e678d0092139686bc6faa4ad0f77249b756a86e
MD5 d820fc59da250a2351f45b1b8d4c8797
BLAKE2b-256 f170e708c3316fbee2ee40625e7fb2ae92e6d4492af4d4c8404992f9b1f1e9e8

See more details on using hashes here.

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