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
- 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.2.0.tar.gz
(3.4 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.2.0.tar.gz.
File metadata
- Download URL: logrelay-0.2.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddb0376dd1fd146bfe51b149b037894f768ff0cd59edb4f4ca60f4e13c372281
|
|
| MD5 |
8424b6b78e88b8378f2a5a992c41f11a
|
|
| BLAKE2b-256 |
0d686612945abf42477ddd37bf4ac88aeba392239c1633e378e8e1861f0f8f15
|
File details
Details for the file logrelay-0.2.0-py3-none-any.whl.
File metadata
- Download URL: logrelay-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51b60ef43740d48fdbfe93ff003dd7b06e7df19f3b05d03c03e66a8b6fe681e2
|
|
| MD5 |
76bd2915cbdda5203855b8ff5b154f35
|
|
| BLAKE2b-256 |
8925bc5099774c1120b92213e80000f33941b47f07a6721680d92496883e92f7
|