-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2553 from jupyter-naas/master
feat: merge master to branch
- Loading branch information
Showing
41 changed files
with
5,415 additions
and
176 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,282 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "latin-packing", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2021-02-23T14:22:16.610471Z", | ||
"iopub.status.busy": "2021-02-23T14:22:16.610129Z", | ||
"iopub.status.idle": "2021-02-23T14:22:16.627784Z", | ||
"shell.execute_reply": "2021-02-23T14:22:16.626866Z", | ||
"shell.execute_reply.started": "2021-02-23T14:22:16.610384Z" | ||
}, | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"<img width=\"8%\" alt=\"Naas\" src=\"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/Naas.png\" style=\"border-radius: 15%\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "compressed-wilson", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"# Brevo - Add contacts to list\n", | ||
"<a href=\"https://bit.ly/3JyWIk6\">Give Feedback</a> | <a href=\"https://github.com/jupyter-naas/awesome-notebooks/issues/new?assignees=&labels=bug&template=bug_report.md&title=Brevo+-+Add+contacts+to+list:+Error+short+description\">Bug report</a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "religious-programmer", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Tags:** #brevo #contacts #lists #create #snippet" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1fe9f56e-561c-4f52-aef8-b861c9462107", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel/)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4c1a2bcc-e330-48dc-b1fd-a19b6734c4ac", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Last update:** 2024-05-30 (Created: 2024-05-30)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "naas-description", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [ | ||
"description" | ||
] | ||
}, | ||
"source": [ | ||
"**Description:** This notebook add contacts to a list in Brevo." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "distinguished-truth", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Input" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "numeric-mediterranean", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Import libraries" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "potential-surfing", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import requests" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f0c7a5bb", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Setup variables\n", | ||
"- `api_key`: Brevo API Key\n", | ||
"- `list_id`: Brevo List ID\n", | ||
"- `emails`: List of emails to be added" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b7f66f6e-03ec-46e2-92fa-df362a3f9b7f", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"api_key = \"YOUR_BREVO_API_KEY\"\n", | ||
"list_id = 20\n", | ||
"emails = []" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "registered-showcase", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Model" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2efabd94-e17c-4f16-bfa0-7ff87d297048", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Get contacts in a list" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e523907a-d34e-421d-a397-63b72880f128", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"def add_contact_to_list(api_key, list_id, emails):\n", | ||
" url = f\"https://api.brevo.com/v3/contacts/lists/{list_id}/contacts/add\"\n", | ||
" payload = {\"emails\": emails}\n", | ||
" headers = {\n", | ||
" \"api-key\": api_key,\n", | ||
" \"accept\": \"application/json\",\n", | ||
" \"content-type\": \"application/json\"\n", | ||
" }\n", | ||
" res = requests.post(url, json=payload, headers=headers)\n", | ||
" if res.status_code == 200:\n", | ||
" return res.json()\n", | ||
" \n", | ||
"result = add_contact_to_list(api_key, list_id, emails)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "lonely-pacific", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2021-07-02T23:32:10.789097Z", | ||
"iopub.status.busy": "2021-07-02T23:32:10.788829Z", | ||
"iopub.status.idle": "2021-07-02T23:32:10.796900Z", | ||
"shell.execute_reply": "2021-07-02T23:32:10.796358Z", | ||
"shell.execute_reply.started": "2021-07-02T23:32:10.789033Z" | ||
}, | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Output" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ef2a8116-b01c-4041-8a6c-4d9d57578e53", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Display result" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "35c1a464-d4e5-44df-bcbb-bd62e1f01187", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"result" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fba4876d-d51c-47eb-bb0e-ba9e876ef115", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.6" | ||
}, | ||
"naas": { | ||
"notebook_id": "460fcce44c2c6bd09950a3fe4d1853962065c598252f280391e4757c29731c06", | ||
"notebook_path": "Brevo/Brevo_Add_contacts_to_list.ipynb" | ||
}, | ||
"papermill": { | ||
"default_parameters": {}, | ||
"environment_variables": {}, | ||
"parameters": {}, | ||
"version": "2.3.3" | ||
}, | ||
"widgets": { | ||
"application/vnd.jupyter.widget-state+json": { | ||
"state": {}, | ||
"version_major": 2, | ||
"version_minor": 0 | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.