Skip to main content

Python library for the Karaden API

Project description

Karaden Pythonライブラリ

Karaden Pythonライブラリは、Pythonで書かれたアプリケーションからKaraden APIへ簡単にアクセスするための手段を提供します。 それにはAPIレスポンスから動的に初期化するAPIリソースの一連のクラス定義が含まれているため、Karaden APIの幅広いバージョンと互換性があります。

インストール方法

パッケージを変更しないならば、このソースコードは必要ありません。 パッケージを使用したいだけならば、下記を実行するだけです。

pip install --upgrade karaden-prg-python

ソースコードからインストールしたいのであるならば、下記を実行します。

python setup.py install

動作環境

Python 3.7~3.10

使い方

このライブラリを使用するには、Karadenでテナントを作成し、プロジェクト毎に発行できるトークンを発行する必要があります。 作成したテナントID(テナントIDはテナント選択画面で表示されています)は、Config.tenant_idに、発行したトークンはConfig.api_keyにそれぞれ設定します。

from karaden.config import Config
from karaden.param.message_create_params import MessageCreateParams
from karaden.model.message import Message

Config.api_key = '<トークン>'
Config.tenant_id = '<テナントID>'
params = (
    MessageCreateParams
    .new_builder()
    .with_service_id(1)
    .with_to('09012345678')
    .with_body('本文')
    .build()
)
message = Message.create(params)

リクエスト毎の設定

同一のプロセスで複数のキーを使用する必要がある場合、リクエスト毎にキーやテナントIDを設定することができます。

params = (
    MessageDetailParams
    .new_builder()
    .with_id('<メッセージID>')
    .build()
)
request_options = (
    RequestOptions.new_builder()
    .with_api_key('<トークン>')
    .with_tenant_id('<テナントID>')
    .build()
)
message = Message.detail(params, request_options)

タイムアウトについて

通信をするファイルサイズや実行環境の通信速度によってはHTTP通信時にタイムアウトが発生する可能性があります。
何度も同じような現象が起こる際は、ファイルサイズの調整もしくはRequestOptionsからタイムアウトの時間を増やして、再度実行してください。

request_options = (
    RequestOptions.new_builder()
    .with_api_key('<トークン>')
    .with_tenant_id('<テナントID>')
    .with_connection_timeout(<>)
    .with_read_timeout(<>)
    .build()
)
bulk_message = BulkMessageService.create('<ファイルパス>', request_options)

Project details


Download files

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

Source Distribution

karaden_prg_python-1.2.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

karaden_prg_python-1.2.1-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file karaden_prg_python-1.2.1.tar.gz.

File metadata

  • Download URL: karaden_prg_python-1.2.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for karaden_prg_python-1.2.1.tar.gz
Algorithm Hash digest
SHA256 686f9255fe5c2acfed7f91b25418a062aaa36e03d0e8039cb6cc6a72ef336d23
MD5 d664c9b5ab4890ba5fb3804bcff390fe
BLAKE2b-256 98fe9261387048f6cd67028222cf90113fc14c876fd68cc6bca18607b2da412b

See more details on using hashes here.

Provenance

The following attestation bundles were made for karaden_prg_python-1.2.1.tar.gz:

Publisher: release.yml on karaden-prg/karaden-prg-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file karaden_prg_python-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for karaden_prg_python-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f9a41e6af42bd41570da82244313ad8329323419ae77599ed82863b492a9773
MD5 3f3168b50bc1d22cb9eda8889b06138a
BLAKE2b-256 f1a3a88fee41c8fcfb20071001cc6f8ae312eea63a6d3e7454eb3c107b4c63da

See more details on using hashes here.

Provenance

The following attestation bundles were made for karaden_prg_python-1.2.1-py3-none-any.whl:

Publisher: release.yml on karaden-prg/karaden-prg-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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