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.2.tar.gz (3.8 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.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: doldol_alarm-0.0.2.tar.gz
  • Upload date:
  • Size: 3.8 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.2.tar.gz
Algorithm Hash digest
SHA256 bb613cc98d0b7633d916f4eae016fdc3758925ebdb4e1856d4f6594c18ba413e
MD5 2604e40e13258517e0e03334a4181604
BLAKE2b-256 15520bbd0d04d06095255cd1b6db8225f02a48da54e088afdbb5770b9ade362d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: doldol_alarm-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c3441757fc1f285ca04d137f1172334776849921f0662d9ce1c056cdb2cc6c76
MD5 edca29a5dc400bf9f34648c6cd9e3930
BLAKE2b-256 049f05914b2aadaa7e36f069c82f1265ebccb3d0be23d0136842d421ea8ab803

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