Backup all your Sendgrid templates on file system or on a S3 bucket.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file backup-sendgrid-templates-0.9.0.tar.gz.
File metadata
- Download URL: backup-sendgrid-templates-0.9.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a73fe50b68bad3165da0da46c8a53bbb83085a96e1b04c5d3cfe3db4f7aeb34d
|
|
| MD5 |
b0ee1907ebfc98f1ce80ab5df2b34c94
|
|
| BLAKE2b-256 |
34a6968c540772d3551e01cef7d8ac03ff77c966b66eb9ea8594f1f40175d652
|
File details
Details for the file backup_sendgrid_templates-0.9.0-py3-none-any.whl.
File metadata
- Download URL: backup_sendgrid_templates-0.9.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
234e46895045927cff894fae70c8801a9120400609fe05e17c2086bda3eb7a54
|
|
| MD5 |
040e8095f871a25cd2dde0a368e568f4
|
|
| BLAKE2b-256 |
04e50fec80afa89d4ba3bc14d420573d9ec06eaacde39ae2ab4b58848afbb439
|