backup-sendgrid-templates-0.9.0
توضیحات
Backup all your Sendgrid templates on file system or on a S3 bucket.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | backup-sendgrid-templates-0.9.0 |
| نام | backup-sendgrid-templates |
| نسخه کتابخانه | 0.9.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Sergio Morstabilini |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/backup-sendgrid-templates/ |
| مجوز | MIT License Copyright (c) 2022 backupSendgridTemplates Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
# 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 destination
- `SENDGRID_TEMPLATES_BASE_PATH` - the path where to store files on your file system
The Sendgrid api key must have full access (more info [here](https://docs.sendgrid.com/ui/account-and-settings/api-keys)).
## 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
نیازمندی
| مقدار | نام |
|---|---|
| >=6.9.7 | sendgrid |
| >=1.14.56 | boto3 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl backup-sendgrid-templates-0.9.0:
pip install backup-sendgrid-templates-0.9.0.whl
نصب پکیج tar.gz backup-sendgrid-templates-0.9.0:
pip install backup-sendgrid-templates-0.9.0.tar.gz