Error log relay using various methods (LINE, Mail, etc.)
Project description
LogRelay
LogRelayは、ログメッセージをLINE, Slack, Discord, メールに転送するためのライブラリです。 ※ 現在はLINEのみで順次追加予定です。
プロジェクト情報
- 名前: logrelay
- バージョン: 0.1.0
- 説明: エラーログをLINEやメールなどの方法でリレーするライブラリ
- 依存関係:
- requests>=2.32.3
- README: README.md
- Pythonバージョン: >= 3.8
インストール
pip install logrelay
使用方法 (LINE)
環境変数
- LINE Developers でチャネルを作成
- プロバイダー(または新規作成)を選択
- Messaging API チャネルを作成
- 「チャネルアクセストークン(長期)」 を取得
- トップ > ユーザー名 > サービス名 > Messaging API設定 > チャネルアクセストークン > チャネルアクセストークン(長期)
- QRコードをスマートフォンで読み込み友だち追加する
- トップ > ユーザー名 > サービス名 > Messaging API設定 > ボット情報 > QRコード
- 「あなたのユーザーID」を取得
- トップ > ユーザー名 > サービス名 > チャネル基本設定 > 基本情報 > あなたのユーザーID
- 環境変数に値を割り当てる
- line_access_token: チャネルアクセストークン(長期)
- user_id: あなたのユーザーID
使用例
import requests
from logrelay import LogRelay
line_access_token = "YOUR_LINE_ACCESS_TOKEN"
user_id = "TARGET_USER_ID"
log_relay = LogRelay(line_access_token, user_id)
try:
response = requests.get("https://example.com/api")
response.raise_for_status()
except requests.exceptions.RequestException as e:
error_message = f"<Example_Service>Error: {str(e)}"
log_relay.send_line_message(error_message)
print(error_message)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logrelay-0.1.1.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logrelay-0.1.1.tar.gz.
File metadata
- Download URL: logrelay-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68b5ccdf2da5d619406ef3f8c7ad509409a6da7e16aa6f8e53a63c2f90e25b8f
|
|
| MD5 |
4175318aff308a91470db90e2fcebc76
|
|
| BLAKE2b-256 |
69fe16a566fd2caf9d4d28d02e8266b96aad8f3f166820e612b6c1ac197d2d06
|
File details
Details for the file logrelay-0.1.1-py3-none-any.whl.
File metadata
- Download URL: logrelay-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66fcf7801f1d2ce878a434433da2529f8b5f6d11192bb48c9ae9544cb10b91c4
|
|
| MD5 |
c9df0a59180255480643df04e163c449
|
|
| BLAKE2b-256 |
255b9b422937b4152b50e3a2a9550510d04453566aa16d537a60f4afd64a7df1
|