ในการใช้โมดูลนี้ให้แน่ใจว่าคุณติดตั้ง Python บนเครื่องพร้อมกับแพ็คเกจ curl_cffi
คุณสามารถติดตั้งแพ็คเกจที่จำเป็นโดยใช้ PIP:
pip install curl-cffi temp-gmail
นี่คือตัวอย่างพื้นฐานของวิธีการใช้คลาส Gmail จากโมดูล:
from temp_gmail import GMail
# Creating an instance of the GMail class
gmail_instance = GMail ()
# Creating a temporary email
email_address = gmail_instance . create_email ()
print ( "Generated Email:" , email_address )
# Loading the email list for the new email
emails = gmail_instance . load_list ()
print ( "Emails:" , emails )
# Example: Check for new items with a specific keyword
message_info = gmail_instance . check_new_item ( "welcome" )
print ( "Message Details:" , message_info )
นี่คือภาพรวมโดยย่อของวิธีการบางอย่างที่รวมอยู่ในคลาส Gmail:
- create_email()
> No parameters required.
> Returns the generated email address.
- load_list()
> No parameters required.
> Fetches all messages for the current email account.
- load_item(message_id)
> message_id: ID of the message to retrieve.
> Returns the contents of the specified message.
- check_new_item(keyword)
> keyword: The keyword to search for in messages.
> Searches all messages for the keyword and returns the first message ID with a match.
CURL_CFFI: แพ็คเกจ Python ที่ให้วิธีการโต้ตอบกับ Curl ผ่าน CFFI