backupSendgridTemplates
Backup the dynamic templates of a Sendgrid account.
Backup files can be stored on your local file system or a S3 bucket.
Requirements
- python 3.8 or higher
Installation
Create and activate a virtual environment. Then
python -m pip install backup-sendgrid-templates
Setup
Some environment variables are required:
SENDGRID_API_KEY- Sendgrid API key with full access (https://app.sendgrid.com/settings/api_keys)SENDGRID_TEMPLATES_BUCKET_NAME- the name of your bucket if you want to use S3 as destinationSENDGRID_TEMPLATES_BASE_PATH- the path where to store files on your file system
The Sendgrid api key must have full access (more info here).
Usage
Run at command line
> backup_sg_on_file_system # to create the backup files on your local file system
> backup_sg_on_s3 # to create the backup files on a S3 bucket
Run inside a script
from backup_sendgrid_templates.service import BackupSendgridTemplatesService
from backup_sendgrid_templates.strategies import FileSystemStrategy, S3Strategy
BackupSendgridTemplatesService(strategy=FileSystemStrategy()).run()
# or BackupSendgridTemplatesService(strategy=S3Strategy()).run()
Two files are created for each template: a .json file containing the template metadata (like name, subject, etc.) and an HTML file with the template content.
Restoring a template
Create a new template on the Sendgrid website.
In the design page, open the Build tab and expand the advanced section.
Click on Import Drag & Drop HTML and paste the html content retrieved from the backup.
References
Send an email using a Sendgrid dinamyc transactional template: https://docs.sendgrid.com/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates
Sendgrid API: https://docs.sendgrid.com/for-developers/sending-email/api-getting-started
Official Python wrapper by Sendgrid: https://github.com/sendgrid/sendgrid-python
Metadata
Release files for backup-sendgrid-templates 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| backup-sendgrid-templates-0.9.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| backup_sendgrid_templates-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.7 kB
Release files / backup-sendgrid-templates-0.9.0.tar.gz
| Download URL | backup-sendgrid-templates-0.9.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a73fe50b68bad3165da0da46c8a53bbb83085a96e1b04c5d3cfe3db4f7aeb34d
|
|
BLAKE2b-256 checksum How to use checksums |
34a6968c540772d3551e01cef7d8ac03ff77c966b66eb9ea8594f1f40175d652
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / backup_sendgrid_templates-0.9.0-py3-none-any.whl
| Download URL | backup_sendgrid_templates-0.9.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
234e46895045927cff894fae70c8801a9120400609fe05e17c2086bda3eb7a54
|
|
BLAKE2b-256 checksum How to use checksums |
04e50fec80afa89d4ba3bc14d420573d9ec06eaacde39ae2ab4b58848afbb439
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|