
생일 알림 신청서
이 프로그램은 사람이 일주일 안에 생일을 가지고 있는지 확인하고 선택적으로 다른 그룹에 알림을 보냅니다. 입력을 검증하고 이메일을 보내는 데 필요한 기능이 포함됩니다. 이 저장소에는 bdayreminder.py가 이러한 기능을 포함하는 동안 Tests.py가 패키지를 테스트하는 2 개의 모듈이 포함되어 있습니다. 앱 또는 기능, 테스트, CRON 작업 및 기타 필드의 사용을보기 전에 라이브러리, 패키지 및 추가 모듈 가져 오기 요구 사항을 참조하십시오.
Python 3.9.12는 패키지 모듈, 가져온 라이브러리 및 정의 된 기능을 올바르게 실행하려면 필요합니다. Dotnet, Pytest와 같은 여러 라이브러리의 수입도 필요합니다. 필요한 버전은 여기에서 발견되며 언급되지 않은 버전은 중고 파이썬 버전과 함께 제공됩니다. 또한 더 진행하기 전에 환경 변수 및 인증을 검사하십시오. 프로그램을 올바르게 사용하려면 사용법에 표시된대로 제안 된 파이썬이 아닌 Python3을 실행해야 할 수도 있습니다. 1
1 Python 또는 Python3은 컴퓨터에 Python을 설치하는 방법에 따라 다릅니다.
이메일을 보내려면 환경 변수를 설정해야합니다. 로컬로이를하려면 .env 파일을 만들고 다음과 같이 유효한 값으로 두 개의 ENV 변수를 추가하십시오 .
USR=<youremail>
PSW=<yourpassword> or <token>
1 Gmail에서 보내면 적절한 환경 가변 비밀번호를 설정하려면 토큰을 만들어야합니다. 인증 섹션에서 이에 대한 추가 정보.
환경 변수에서 Gmail 이메일을 설정 한 후 이메일을 보낼 수 있으려면 토큰을 만들어야합니다. 수행 방법에 대한 자세한 내용은 여기에서 확인할 수 있습니다.
요구 사항이 충족되면 앱 패키지가 디렉토리에서 설정되고 터미널이 실행됩니다. 4 가지 옵션 1,2,3이 있습니다.
>>> python bdayreminder.py <data_file_path>
Choose 1 to validate if input data file is correct or 2 to check for upcoming birthdays and send respective emails
>>> 1
ERROR: Invalid email for Laura Dreyfuss at row 6
ERROR: Empty name field is for email [email protected] at row 7
ERROR: Invalid date for Anna Higgins at row 11. Date given is 02-30
ERROR: Date is in the future for Tom Brady at row 12. Date given is 2075-10-22
ERROR: Invalid email for Ching Yeung Michael Tam at row 19
'''
'''
>>> python bdayreminder.py <data_file_path>
Choose 1 to validate if input data file is correct or 2 to check for upcoming birthdays and send respective emails
>>> 2
Kai Yuen Leung will have birthday in a week.
Patrick Kienzle will have birthday in a week.
Emails sent successfully.
>>> python bdayreminder.py <data_file_path> 3
Choose 1 to validate if input data file is correct or 2 to check for upcoming birthdays and send respective emails
>>> 3
Please choose either 1 or 2
>>> 1
ERROR: Invalid email for Laura Dreyfuss at row 6
ERROR: Empty name field is for email [email protected] at row 7
ERROR: Invalid date for Anna Higgins at row 11. Date given is 02-30
ERROR: Date is in the future for Tom Brady at row 12. Date given is 2075-10-22
ERROR: Invalid email for Ching Yeung Michael Tam at row 19
>>> python bdayreminder.py <data_file_path> 1
ERROR: Invalid email for Laura Dreyfuss at row 6
ERROR: Empty name field is for email [email protected] at row 7
ERROR: Invalid date for Anna Higgins at row 11. Date given is 02-30
ERROR: Date is in the future for Tom Brady at row 12. Date given is 2075-10-22
ERROR: Invalid email for Ching Yeung Michael Tam at row 19
>>> python bdayreminder.py <data_file_path> 2
Kai Yuen Leung will have birthday in a week.
Patrick Kienzle will have birthday in a week.
Emails sent successfully.
1 <data_file_path>는 이 -dataSets/data_20.csv처럼 보이지만 디렉토리에서 보입니다. 나를위한 전체 경로는 /users/aurimasnausedas/documents/python/birthdayreminderapp/datasets/data_20.csv입니다
2 기본 모듈은 콘솔에서 실행될 때 두 가지 인수를합니다.
3 예제에 사용 된 데이터는 2022 년 6 월 23 일 에 data_20.csv였습니다.
모듈 내에서 발견 된 함수 개요 -BdayReminder.py :
함수에 대한 자세한 설명은 모듈 -BdayReminder.py에서 찾을 수 있습니다.
사용할 수있는 세 가지 데이터 세트가 있습니다. 이들은 20 명의 수신자 중 DATA_20, 50 명의 수신자의 DATA_50, 80 명의 수신자 중 DATA_80입니다.
모듈 내에서 발견 된 함수의 개요 - tests.py :
추출 된 프로그램/앱 폴더로 탐색함으로써 -tests.py가 보유하고있는 곳의 폴더가 있고 하나는이 테스트 명령을 실행할 수 있습니다.
>>> pyflakes .
>>> pyflakes Tests/tests.py
>>> python -m pytest Tests/tests.py
몇 가지 오류가 발생할 수 있습니다.
>>> python bdayreminder.py Datasets/data_20.json 1
Traceback (most recent call last):
File "/Users/aurimasnausedas/Documents/Python/BirthdayReminderApp/bdayreminder.py", line 237, in <module>
run(arg_path, cron_input)
File "/Users/aurimasnausedas/Documents/Python/BirthdayReminderApp/bdayreminder.py", line 215, in run
raise Exception('ERROR: Wrong data format file')
Exception: ERROR: Wrong data format file
>>> python bdayreminder.py Datasets/data_13.csv 1
Traceback (most recent call last):
File "/Users/aurimasnausedas/Documents/Python/BirthdayReminderApp/bdayreminder.py", line 237, in <module>
run(arg_path, cron_input)
File "/Users/aurimasnausedas/Documents/Python/BirthdayReminderApp/bdayreminder.py", line 199, in run
raise Exception('ERROR: File doesn't exist')
Exception: ERROR: File doesn't exist
>>> python bdayreminder.py Datasets/data_20.csv versada
Argument passed not an integer
더 많은 것이 가장 일반적 일 것입니다.
Mac 터미널 실행에서 Cron 작업을 구축하려면 :
>>> crontab -e
터미널에 들어갈 때 Cronjob의 구문은 다음과 같이 보일 수 있습니다 : 1,2,3
>>> 0 6 * * * cd <directory_to_app> && <directory_to_python> bdayreminder.py <data_file_path> 2
[Optional] >>> 0 6 * * * cd <directory_to_app> && <directory_to_python> bdayreminder.py <data_file_path> 2 >> Public/birthdays.txt
1 <directory_to_app> - 생일 레미나 랩 폴더와 같은/user/aurimasnausedas/documents/python/girthdayreminderApp과 같은 디렉토리 여야합니다.
2 <directory_to_python> 과 같은/사용자/aurimasnausedas/opt/miniconda3/envs/symmetric/bin/python과 같은 컴퓨터에 Python을 설치 한 위치 여야합니다.
3 <data_file_path>는 /사용자/aurimasnausedas/documents/python/girthdayreminderapp와 같은 앱 디렉토리의 데이터 세트 여야합니다.
CRON 작업에 대한 구문 사용자 정의는 여기에서 확인할 수 있습니다.
공용 폴더에는 세 가지 파일이 포함됩니다.
생일 알림 응용 프로그램의 로고는 여기에서 찾을 수 있습니다.
MIT 라이센스