Skip to content

Commit a85a9d6

Browse files
Update API Key usage examples
1 parent da9ca7a commit a85a9d6

File tree

24 files changed

+25
-48
lines changed

24 files changed

+25
-48
lines changed

USAGE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import sendgrid
77
import os
88

99

10-
sg = sendgrid.SendGridAPIClient(apikey='SENDGRID_API_KEY')
11-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
10+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
1211
```
1312

1413
# Table of Contents
@@ -4261,3 +4260,4 @@ print response.status_code
42614260
print response.response_body
42624261
print response.response_headers
42634262
```
4263+

examples/accesssettings/accesssettings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Retrieve all recent access attempts #

examples/apikeys/apikeys.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Create API keys #

examples/asm/asm.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Create a Group #

examples/browsers/browsers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Retrieve email statistics by browser. #

examples/campaigns/campaigns.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Create a Campaign #

examples/categories/categories.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Retrieve all categories #

examples/clients/clients.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Retrieve email statistics by client type. #

examples/contactdb/contactdb.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Create a Custom Field #

examples/devices/devices.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import os
44

55

6-
sg = sendgrid.SendGridAPIClient(apikey='YOUR_SENDGRID_API_KEY')
7-
# You can also store your API key an .env variable 'SENDGRID_API_KEY'
6+
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
87

98
##################################################
109
# Retrieve email statistics by device type. #

0 commit comments

Comments
 (0)