fffelix-jan / emailsanta-py

Python library to "send a letter to Santa" using emailsanta.com and receive a properly-formatted plaintext reply
GNU Affero General Public License v3.0
1 stars 0 forks source link

'SantaEmail' object has no attribute 'replytext' #2

Closed ReloadingBee closed 1 year ago

ReloadingBee commented 1 year ago

I tried getting the reply text, but it didn't work.

print(mySantaLetterToSend.replytext)

There's just no such a thing as .reply text. Please help

fffelix-jan commented 1 year ago
# Try this
myReplyFromSanta = SantaReply(mySantaLetterToSend)  # get your reply "from Santa"!
print(myReplyFromSanta.replyText)    # this prints the plaintext reply
fffelix-jan commented 1 year ago

I made this library in a hurry. I think I should clean things up (fix camel casing of variables to snake casing, rework the process so that the reply doesn't get created in the object constructor, since that seems a little weird), or just make my own library that doesn't depend on emailSanta.com. Thanks for your interest in my library! I didn't expect anyone to use it actually. Merry Christmas (and don't forget that Santa Claus isn't real)! 🎅

fffelix-jan commented 1 year ago

Here is what I did and the output I got (using the Python interactive prompt):

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from emailsanta import *
>>> # assuming you already imported everything
>>> mySantaLetterToSend = SantaEmail(
...     "Rudolph",      # name
...     1,              # gender (in this case it is boy)
...     4,              # age
...     "New York",     # city
...     "United States",# country
...     3,              # how good have you been? (in this case it's really really good!)
...     "carrots",      # your first present
...     "food",         # your second present
...     "phone",        # your third present
...     comment="Hi Santa, this is a test.",    # any additional comments for Santa
... )
>>> # continued from above
>>> myReplyFromSanta = SantaReply(mySantaLetterToSend)  # get your reply "from Santa"!
>>> print(myReplyFromSanta.replyText)    # this prints the plaintext reply

New York, United States

Wednesday, December 7, 2022

#1, Rudolph Way
North Pole, Canada
HO HO HO

Merrrryyyy Christmas Rudolph!!

Hurray! My days are always extra special when one of my favorite boys in New York surprises me with a wonderful letter. The Internet sure is wonderful because now I can get emails from New York and around the world in the blink of an eye. Even Rudolph gets emails... from pets! Why, here's Rudolph right now! HO!! Ho!! ho!! He just asked me to say 'Hi!' to you!

My goodness, Rudolph! You are growing up so fast! Here you are 4 years old already! It seems like only last year you were 3 years old. I'm excited to find out how old you'll be next year! Do you know what else I'm getting excited about? CHRISTMAS! Are you getting a teensy bit excited about Christmas too? Or are you really excited, like Rudolph is?

I see you put down that you've been a REALLY REALLY good boy. I had another meeting with the head of the Noddy N. Nice Elf Detective Agency not too long ago. Sherlock Elf said you've been a REALLY REALLY good boy too!

Let's see what you put in your letter for Christmas wishes: 1. carrots; 2. food and; 3. phone. Yummy, some food! Mrs. Claus always reminds me that 'stressed' is just 'desserts' spelled backwards! I think that is very true at Christmastime, don't you?

Did you know I had to get rid of my phone? Every time I phoned the elves they thought my name was 'Santa Calls'! HO!! Ho!! ho!!

I love to read your emails, Rudolph. You, your family and friends can send me as many as you like. You can also get a friendly reminder from my elves to come back and visit me again next year. Then you can send me even more emails. HHHOL!

Time for me to go have a quick hop in the shower. For some reason my beard is full of cookie crumbs! Now where could those have come from? Take care Rudolph and don't forget to come back and visit me here at emailSanta.com on Christmas Eve!! And remember... only 18 more sleeps until Christmas!!

 Wishing You A Very Merry Christmas,
 Santa Claus

#1, Rudolph Way
North Pole, Canada
HO HO HO

Wednesday, December 7, 2022

New York, United States

Dear Santa Claus,

My name is Rudolph. I am a boy and I am already 4 years old!! I live in the great city of New York. Of course, that's in United States but I'll bet you knew that! This year I've been so good that I should be the angel on top of the tree!

Santa Claus, some things I might like for Christmas this year are:
🎁 carrots;
🎁 food; and,
🎁 phone.

Santa Claus, here is my special message to you... Hi Santa, this is a test.

Love, Rudolph

>>>