مولد قائمة الأسماء السانتا سانتا التخصيص
الغرض من هذا البرنامج النصي هو:
تعيين كل مشتري قائمة أجهزة استقبال الهدايا لأحداث سانتا السرية. يمكن للمستخدم تحديد عدد الهدايا التي يجب أن يشتريها كل مشتر ، وسيضمن البرنامج أنه لا يوجد أي مشتري يرسم نفس الاسم مرتين.
أرسل رسائل بريد إلكتروني إلى جميع المشاركين السرية في سانتا يخبرونهم بمن يشتري هدية.
ارسم شجرة عيد الميلاد وقم بتضمينها في البريد الإلكتروني للاحتفال. شجرة عيد الميلاد هي سلسلة من الأحرف التالية: [،] ، = ، ~.
مثال على شكل البريد الإلكتروني:
git clone https://github.com/tylerlum/DrawNames.git
cd DrawNames
pip install -e .
python run_draw.py --help
usage: run_draw.py [--name_to_email_dict NAME_TO_EMAIL_DICT]
[--name_to_nickname_dict NAME_TO_NICKNAME_DICT]
[--n_recipients_per_buyer N_RECIPIENTS_PER_BUYER]
[--email_subject_line EMAIL_SUBJECT_LINE]
[--email_used_to_send EMAIL_USED_TO_SEND] [-h]
optional arguments:
--name_to_email_dict NAME_TO_EMAIL_DICT
(Dict[str, str], default={'Tyler':
'[email protected]', 'OtherTyler':
'[email protected]'}) Tyler
--name_to_nickname_dict NAME_TO_NICKNAME_DICT
(Dict[str, str], default={'Tyler': 'Tygertron',
'OtherTyler': 'SwoleDude'}) Tyler
--n_recipients_per_buyer N_RECIPIENTS_PER_BUYER
(int, default=1)
--email_subject_line EMAIL_SUBJECT_LINE
(str, default=Sibling Secret Santa Draw 2023)
--email_used_to_send EMAIL_USED_TO_SEND
(Union[str, NoneType],
[email protected])
-h, --help show this help message and exit
ملحوظة:
من الأسهل بكثير تعديل الوسائط الافتراضية في run_draw.py
مما هو عليه لاستخدام سطر الأوامر مباشرة.
سيحتاج معظم المستخدمين إلى تعديل معظم الحجج إلى حالة الاستخدام المحددة الخاصة بهم
تأكد من name_to_nickname_dict
و name_to_email_dict
لها نفس المفاتيح
python run_draw.py
================================================================================
args = {'email_subject_line': 'Sibling Secret Santa Draw 2023',
'email_used_to_send': '[email protected]',
'n_recipients_per_buyer': 1,
'name_to_email_dict': {'OtherTyler': '[email protected]',
'Tyler': '[email protected]'},
'name_to_nickname_dict': {'OtherTyler': 'SwoleDude', 'Tyler': 'Tygertron'}}
================================================================================
--------------------------------------------------------------------------------
Reminder: to send emails, [email protected] must have app password set up.
If not set up, refer to https://support.google.com/mail/answer/185833?hl=en-GB or search for 'Sign in using app passwords'
--------------------------------------------------------------------------------
Enter the app password for [email protected]:
Thank you. Password was correct.
Names have been drawn!
Is this a valid assignment? True
Hi Tygertron! You will be buying a lovely present for: SwoleDude. :)
-Tyler Bot
NICKNAMES:
Tyler: Tygertron
OtherTyler: SwoleDude
[]
[~]
[~~]
[~~~]
[~~~~]
[~~~~~]
[~~~~~~]
[~~~~~~~]
[~~~~~~~~]
[~~~~~~~~~]
[~~~~~~~~~~]
[]
[]
[]
Email sent
Hi SwoleDude! You will be buying a lovely present for: Tygertron. :)
-Tyler Bot
NICKNAMES:
Tyler: Tygertron
OtherTyler: SwoleDude
[]
[~]
[~~]
[~~~]
[~~~~]
[~~~~~]
[~~~~~~]
[~~~~~~~]
[~~~~~~~~]
[~~~~~~~~~]
[~~~~~~~~~~]
[]
[]
[]
Email sent
Email sent
python run_draw.py
================================================================================
args = {'email_subject_line': 'Sibling Secret Santa Draw 2023',
'email_used_to_send': '[email protected]',
'n_recipients_per_buyer': 1,
'name_to_email_dict': {'OtherTyler': '[email protected]',
'Tyler': '[email protected]'},
'name_to_nickname_dict': {'OtherTyler': 'SwoleDude', 'Tyler': 'Tygertron'}}
================================================================================
--------------------------------------------------------------------------------
Reminder: to send emails, [email protected] must have app password set up.
If not set up, refer to https://support.google.com/mail/answer/185833?hl=en-GB or search for 'Sign in using app passwords'
--------------------------------------------------------------------------------
Enter the app password for [email protected]:
Traceback (most recent call last):
File "run_draw.py", line 115, in <module>
main()
File "run_draw.py", line 69, in main
email_sender = EmailSender(user=email_used_to_send, password=app_password)
File "<string>", line 5, in __init__
File "/home/tylerlum/github_repos/DrawNames/DrawNames/email_utils.py", line 38, in __post_init__
self.passwordcheck()
File "/home/tylerlum/github_repos/DrawNames/DrawNames/email_utils.py", line 33, in passwordcheck
server.login(self.user, self.password)
File "/home/tylerlum/miniconda3/envs/rlgpu/lib/python3.7/smtplib.py", line 735, in login
raise last_exception
File "/home/tylerlum/miniconda3/envs/rlgpu/lib/python3.7/smtplib.py", line 726, in login
initial_response_ok=initial_response_ok)
File "/home/tylerlum/miniconda3/envs/rlgpu/lib/python3.7/smtplib.py", line 647, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more atn5.7.8 https://support.google.com/mail/?p=BadCredentials ju17-20020a170903429100b001c0a4146961sm4804704plb.19 - gsmtp')