Skip to main content

돌돌이 파이썬 메신저 알람 기능

Project description

doldol_alarm

doldol_alarm는 Webex 봇을 통해 지정된 Webex 대화방으로 간단하게 메시지를 보낼 수 있도록 도와주는 파이썬 패키지입니다. 코드 실행 중 특정 시점에 알림을 받거나, 로그를 보내는 등의 용도로 활용할 수 있습니다.

주요 기능

  • 간단한 코드로 Webex 대화방에 메시지 전송
  • 클래스 객체를 함수처럼 호출하여 직관적인 사용 가능
  • Webex 봇 토큰을 환경 변수로 안전하게 관리

설치하기

PyPI를 통해 쉽게 설치할 수 있습니다.

pip install doldol_alarm

사전 준비

이 패키지를 사용하기 위해서는 두 가지 정보가 필요합니다.

  1. Webex 룸 ID (Room ID)
    • 봇이 메시지를 보낼 대상 대화방의 고유 ID입니다.
    • 봇을 해당 대화방에 초대한 후, Webex API 등을 통해 확인할 수 있습니다.

사용 방법

아래는 doldol_alarm를 사용하여 Webex 대화방으로 메시지를 보내는 예제 코드입니다.

from doldol_alarm import DDA

# 메시지를 보낼 Webex Room ID
MY_WEBEX_ROOM_ID = "여기에_메시지를_보낼_방의_ID를_입력하세요"

# 1. (권장) 환경변수에 설정된 봇 토큰을 사용하는 방법
#    DoldolAlarm 객체를 생성합니다.
doldol_print = DDA(roomid=MY_WEBEX_ROOM_ID)

# 2. 봇 토큰을 직접 파라미터로 전달하는 방법
# MY_WEBEX_BOT_TOKEN = "여기에_봇_액세스_토큰을_입력하세요"
# doldol_print = doldol_alarm.DoldolAlarm(roomid=MY_WEBEX_ROOM_ID, webex_bot_token=MY_WEBEX_BOT_TOKEN)


# 이제 객체를 함수처럼 호출하여 메시지를 보낼 수 있습니다.
try:
    print("Webex로 알림을 보냅니다.")
    doldol_print("🚀 작업이 시작되었습니다.")

    # ... (여기에 원하는 작업을 수행하는 코드를 작성) ...
    result = 100 / 5
    doldol_print(f"✔️ 작업이 성공적으로 완료되었습니다. 결과: {result}")

except Exception as e:
    # 예외 발생 시 Webex로 에러 메시지 보내기
    doldol_print(f"🚨 에러가 발생했습니다: {e}")

라이선스

이 프로젝트는 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 Distribution

doldol_alarm-0.0.4.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

doldol_alarm-0.0.4-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file doldol_alarm-0.0.4.tar.gz.

File metadata

  • Download URL: doldol_alarm-0.0.4.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for doldol_alarm-0.0.4.tar.gz
Algorithm Hash digest
SHA256 21e52318c3a804c92364f0bf3b75d6d9e2d48e1d26ce1fdf09e41f0973bdf814
MD5 f63da36459672251fe004cc71b0b0259
BLAKE2b-256 42e553f75a2ef081af5dbefa358779c272101a014a0d041a4545fd1d4dc001e2

See more details on using hashes here.

File details

Details for the file doldol_alarm-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: doldol_alarm-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for doldol_alarm-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d7d0f8515cf296fd784360928380c299f388e93762f1259c822c21ba5a39348f
MD5 d14f93f3d7e4d51f6d09214cef20b021
BLAKE2b-256 33bcc0cd576ef21234f39a42bfe38c80f85f6de9747d890e6f5ab32238143c3c

See more details on using hashes here.

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