@@ -10,17 +10,30 @@ Mailosaur lets you automate email and SMS tests as part of software development
1010
1111This guide provides several key sections:
1212
13+ - [ Mailosaur - Python library · ] ( #mailosaur---python-library-- )
1314 - [ Get Started] ( #get-started )
15+ - [ Installation] ( #installation )
16+ - [ Set your API key] ( #set-your-api-key )
17+ - [ Create your code] ( #create-your-code )
18+ - [ API Reference] ( #api-reference )
1419 - [ Creating an account] ( #creating-an-account )
1520 - [ Test email addresses with Mailosaur] ( #test-email-addresses-with-mailosaur )
1621 - [ Find an email] ( #find-an-email )
22+ - [ What is this code doing?] ( #what-is-this-code-doing )
1723 - [ Find an SMS message] ( #find-an-sms-message )
1824 - [ Testing plain text content] ( #testing-plain-text-content )
25+ - [ Extracting verification codes from plain text] ( #extracting-verification-codes-from-plain-text )
1926 - [ Testing HTML content] ( #testing-html-content )
27+ - [ Working with HTML using Beautiful Soup] ( #working-with-html-using-beautiful-soup )
2028 - [ Working with hyperlinks] ( #working-with-hyperlinks )
29+ - [ Links in plain text (including SMS messages)] ( #links-in-plain-text-including-sms-messages )
2130 - [ Working with attachments] ( #working-with-attachments )
2231 - [ Working with images and web beacons] ( #working-with-images-and-web-beacons )
32+ - [ Remotely-hosted images] ( #remotely-hosted-images )
33+ - [ Triggering web beacons] ( #triggering-web-beacons )
2334 - [ Spam checking] ( #spam-checking )
35+ - [ Development] ( #development )
36+ - [ Contacting us] ( #contacting-us )
2437
2538You can find the full [ Mailosaur documentation] ( https://mailosaur.com/docs/ ) on the website.
2639
@@ -32,11 +45,21 @@ If you get stuck, just contact us at support@mailosaur.com.
3245pip install --upgrade mailosaur
3346```
3447
35- Then import the library into your code. The value for ` YOUR_API_KEY ` is covered in the next step ([ creating an account] ( #creating-an-account ) ):
48+ ### Set your API key
49+
50+ Get your API key from the Mailosaur Dashboard and set it as an environment variable:
51+
52+ ``` sh
53+ export MAILOSAUR_API_KEY=' your-api-key-here'
54+ ```
55+
56+ ### Create your code
57+
58+ Then import the library and create a client:
3659
3760``` py
3861from mailosaur import MailosaurClient
39- mailosaur = MailosaurClient(" YOUR_API_KEY " )
62+ mailosaur = MailosaurClient()
4063```
4164
4265### API Reference
@@ -80,7 +103,7 @@ In automated tests you will want to wait for a new email to arrive. This library
80103from mailosaur import MailosaurClient
81104from mailosaur.models import SearchCriteria
82105
83- mailosaur = MailosaurClient(" API_KEY " )
106+ mailosaur = MailosaurClient()
84107
85108# See https://mailosaur.com/app/project/api
86109server_id = " abc123"
@@ -96,7 +119,7 @@ print(email.subject) # "Hello world!"
96119
97120### What is this code doing?
98121
99- 1 . Sets up an instance of ` MailosaurClient ` with your API key .
122+ 1 . Sets up an instance of ` MailosaurClient ` using the ` MAILOSAUR_API_KEY ` environment variable .
1001232 . Waits for an email to arrive at the server with ID ` abc123 ` .
1011243 . Outputs the subject line of the email.
102125
@@ -110,7 +133,7 @@ If your account has [SMS testing](https://mailosaur.com/sms-testing/) enabled, y
110133from mailosaur import MailosaurClient
111134from mailosaur.models import SearchCriteria
112135
113- mailosaur = MailosaurClient(" API_KEY " )
136+ mailosaur = MailosaurClient()
114137
115138# See https://mailosaur.com/app/project/api
116139server_id = " abc123"
0 commit comments