karaden-prg-python


Namekaraden-prg-python JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/karaden-prg/karaden-prg-python
SummaryPython library for the Karaden API
upload_time2024-03-23 02:22:03
maintainerNone
docs_urlNone
authorcpaas-dev-admin-om
requires_python>=3.7
licenseMIT license
keywords karaden communication platform as a service cpaas sms api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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`にそれぞれ設定します。
```python
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を設定することができます。
```python
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通信時にタイムアウトが発生する可能性があります。<br />
何度も同じような現象が起こる際は、ファイルサイズの調整もしくは`RequestOptions`からタイムアウトの時間を増やして、再度実行してください。
```python
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)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/karaden-prg/karaden-prg-python",
    "name": "karaden-prg-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "karaden, communication platform as a service, cpaas, sms, api",
    "author": "cpaas-dev-admin-om",
    "author_email": "cpaas-dev-admin-om@nttcoms.com",
    "download_url": "https://files.pythonhosted.org/packages/4c/2e/0aa432a0695498254e02a3eaa93f8473da3fff475744befe46df7a0a0926/karaden-prg-python-1.2.0.tar.gz",
    "platform": null,
    "description": "# Karaden Python\u30e9\u30a4\u30d6\u30e9\u30ea\nKaraden Python\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u3001Python\u3067\u66f8\u304b\u308c\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089Karaden API\u3078\u7c21\u5358\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u624b\u6bb5\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n\u305d\u308c\u306b\u306fAPI\u30ec\u30b9\u30dd\u30f3\u30b9\u304b\u3089\u52d5\u7684\u306b\u521d\u671f\u5316\u3059\u308bAPI\u30ea\u30bd\u30fc\u30b9\u306e\u4e00\u9023\u306e\u30af\u30e9\u30b9\u5b9a\u7fa9\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u305f\u3081\u3001Karaden API\u306e\u5e45\u5e83\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u4e92\u63db\u6027\u304c\u3042\u308a\u307e\u3059\u3002\n## \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\n\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5909\u66f4\u3057\u306a\u3044\u306a\u3089\u3070\u3001\u3053\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002\n\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u7528\u3057\u305f\u3044\u3060\u3051\u306a\u3089\u3070\u3001\u4e0b\u8a18\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\u3059\u3002\n```\npip install --upgrade karaden-prg-python\n```\n\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3044\u306e\u3067\u3042\u308b\u306a\u3089\u3070\u3001\u4e0b\u8a18\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\n```\npython setup.py install\n```\n## \u52d5\u4f5c\u74b0\u5883\nPython 3.7\uff5e3.10\n## \u4f7f\u3044\u65b9\n\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u3001Karaden\u3067\u30c6\u30ca\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u6bce\u306b\u767a\u884c\u3067\u304d\u308b\u30c8\u30fc\u30af\u30f3\u3092\u767a\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n\u4f5c\u6210\u3057\u305f\u30c6\u30ca\u30f3\u30c8ID\uff08\u30c6\u30ca\u30f3\u30c8ID\u306f\u30c6\u30ca\u30f3\u30c8\u9078\u629e\u753b\u9762\u3067\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\uff09\u306f\u3001`Config.tenant_id`\u306b\u3001\u767a\u884c\u3057\u305f\u30c8\u30fc\u30af\u30f3\u306f`Config.api_key`\u306b\u305d\u308c\u305e\u308c\u8a2d\u5b9a\u3057\u307e\u3059\u3002\n```python\nfrom karaden.config import Config\nfrom karaden.param.message_create_params import MessageCreateParams\nfrom karaden.model.message import Message\n\nConfig.api_key = '<\u30c8\u30fc\u30af\u30f3>'\nConfig.tenant_id = '<\u30c6\u30ca\u30f3\u30c8ID>'\nparams = (\n    MessageCreateParams\n    .new_builder()\n    .with_service_id(1)\n    .with_to('09012345678')\n    .with_body('\u672c\u6587')\n    .build()\n)\nmessage = Message.create(params)\n```\n### \u30ea\u30af\u30a8\u30b9\u30c8\u6bce\u306e\u8a2d\u5b9a\n\u540c\u4e00\u306e\u30d7\u30ed\u30bb\u30b9\u3067\u8907\u6570\u306e\u30ad\u30fc\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u6bce\u306b\u30ad\u30fc\u3084\u30c6\u30ca\u30f3\u30c8ID\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n```python\nparams = (\n    MessageDetailParams\n    .new_builder()\n    .with_id('<\u30e1\u30c3\u30bb\u30fc\u30b8ID>')\n    .build()\n)\nrequest_options = (\n    RequestOptions.new_builder()\n    .with_api_key('<\u30c8\u30fc\u30af\u30f3>')\n    .with_tenant_id('<\u30c6\u30ca\u30f3\u30c8ID>')\n    .build()\n)\nmessage = Message.detail(params, request_options)\n```\n### \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u306b\u3064\u3044\u3066\n\u901a\u4fe1\u3092\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u3084\u5b9f\u884c\u74b0\u5883\u306e\u901a\u4fe1\u901f\u5ea6\u306b\u3088\u3063\u3066\u306fHTTP\u901a\u4fe1\u6642\u306b\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<br />\n\u4f55\u5ea6\u3082\u540c\u3058\u3088\u3046\u306a\u73fe\u8c61\u304c\u8d77\u3053\u308b\u969b\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u306e\u8abf\u6574\u3082\u3057\u304f\u306f`RequestOptions`\u304b\u3089\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u306e\u6642\u9593\u3092\u5897\u3084\u3057\u3066\u3001\u518d\u5ea6\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n```python\nrequest_options = (\n    RequestOptions.new_builder()\n    .with_api_key('<\u30c8\u30fc\u30af\u30f3>')\n    .with_tenant_id('<\u30c6\u30ca\u30f3\u30c8ID>')\n    .with_connection_timeout(<\u79d2>)\n    .with_read_timeout(<\u79d2>)\n    .build()\n)\nbulk_message = BulkMessageService.create('<\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9>', request_options)\n```\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Python library for the Karaden API",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://github.com/karaden-prg/karaden-prg-python"
    },
    "split_keywords": [
        "karaden",
        " communication platform as a service",
        " cpaas",
        " sms",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5c965921189b5f19eb6d298c6e389212d7e3079d8306115ff01b48bedbb88f8",
                "md5": "b07d78a9d2d356d0619207431aeee189",
                "sha256": "1d6d80b1cb7df764adc317e85bbbaa61df152b80bedb499e9de37a802c61afec"
            },
            "downloads": -1,
            "filename": "karaden_prg_python-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b07d78a9d2d356d0619207431aeee189",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 33549,
            "upload_time": "2024-03-23T02:22:01",
            "upload_time_iso_8601": "2024-03-23T02:22:01.556640Z",
            "url": "https://files.pythonhosted.org/packages/f5/c9/65921189b5f19eb6d298c6e389212d7e3079d8306115ff01b48bedbb88f8/karaden_prg_python-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c2e0aa432a0695498254e02a3eaa93f8473da3fff475744befe46df7a0a0926",
                "md5": "b71c0b4e9b3642575528d45199bf45aa",
                "sha256": "706b663286d26ea87f72511d21abac51102ac5b4b3c85284be27ceb3d44bd264"
            },
            "downloads": -1,
            "filename": "karaden-prg-python-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b71c0b4e9b3642575528d45199bf45aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16569,
            "upload_time": "2024-03-23T02:22:03",
            "upload_time_iso_8601": "2024-03-23T02:22:03.587888Z",
            "url": "https://files.pythonhosted.org/packages/4c/2e/0aa432a0695498254e02a3eaa93f8473da3fff475744befe46df7a0a0926/karaden-prg-python-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-23 02:22:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "karaden-prg",
    "github_project": "karaden-prg-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "karaden-prg-python"
}
        
Elapsed time: 0.81431s