Skip to content

Commit

Permalink
Merge pull request #2553 from jupyter-naas/master
Browse files Browse the repository at this point in the history
feat: merge master to branch
  • Loading branch information
FlorentLvr authored Jun 28, 2024
2 parents 35a1432 + f52cb91 commit 4bb2313
Show file tree
Hide file tree
Showing 41 changed files with 5,415 additions and 176 deletions.
Binary file added .github/assets/logos/Gmail.jpg
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
48 changes: 24 additions & 24 deletions .github/push_templates_to_algolia.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
"id": "aa0e3e6f-1260-4452-8abf-7c084e26c8a4",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-04T20:13:21.102729Z",
"iopub.status.busy": "2024-06-04T20:13:21.102524Z",
"iopub.status.idle": "2024-06-04T20:13:21.177565Z",
"shell.execute_reply": "2024-06-04T20:13:21.176866Z"
"iopub.execute_input": "2024-06-26T14:45:50.165871Z",
"iopub.status.busy": "2024-06-26T14:45:50.165675Z",
"iopub.status.idle": "2024-06-26T14:45:50.239561Z",
"shell.execute_reply": "2024-06-26T14:45:50.238851Z"
},
"papermill": {},
"tags": []
Expand Down Expand Up @@ -95,10 +95,10 @@
"id": "cfa97168-63eb-4e8c-89c3-0a5d26f47740",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-04T20:13:21.181077Z",
"iopub.status.busy": "2024-06-04T20:13:21.180689Z",
"iopub.status.idle": "2024-06-04T20:13:21.184472Z",
"shell.execute_reply": "2024-06-04T20:13:21.183772Z"
"iopub.execute_input": "2024-06-26T14:45:50.242534Z",
"iopub.status.busy": "2024-06-26T14:45:50.242325Z",
"iopub.status.idle": "2024-06-26T14:45:50.245721Z",
"shell.execute_reply": "2024-06-26T14:45:50.245142Z"
},
"papermill": {},
"tags": []
Expand Down Expand Up @@ -141,10 +141,10 @@
"id": "7a9c86c2-931d-4113-abbc-31b3f517b6c4",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-04T20:13:21.187585Z",
"iopub.status.busy": "2024-06-04T20:13:21.187107Z",
"iopub.status.idle": "2024-06-04T20:13:21.270632Z",
"shell.execute_reply": "2024-06-04T20:13:21.269941Z"
"iopub.execute_input": "2024-06-26T14:45:50.248101Z",
"iopub.status.busy": "2024-06-26T14:45:50.247908Z",
"iopub.status.idle": "2024-06-26T14:45:50.331306Z",
"shell.execute_reply": "2024-06-26T14:45:50.330628Z"
},
"tags": []
},
Expand Down Expand Up @@ -178,10 +178,10 @@
"id": "c50e96b2-4403-413c-a99a-9243be0c0a04",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-04T20:13:21.273212Z",
"iopub.status.busy": "2024-06-04T20:13:21.273005Z",
"iopub.status.idle": "2024-06-04T20:13:22.859327Z",
"shell.execute_reply": "2024-06-04T20:13:22.858648Z"
"iopub.execute_input": "2024-06-26T14:45:50.333898Z",
"iopub.status.busy": "2024-06-26T14:45:50.333689Z",
"iopub.status.idle": "2024-06-26T14:45:51.736980Z",
"shell.execute_reply": "2024-06-26T14:45:51.736359Z"
},
"tags": []
},
Expand Down Expand Up @@ -230,10 +230,10 @@
"id": "da661ba3-fd15-4abc-bd4f-d13ae77b82b0",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-04T20:13:22.862540Z",
"iopub.status.busy": "2024-06-04T20:13:22.861938Z",
"iopub.status.idle": "2024-06-04T20:13:25.760688Z",
"shell.execute_reply": "2024-06-04T20:13:25.760005Z"
"iopub.execute_input": "2024-06-26T14:45:51.739500Z",
"iopub.status.busy": "2024-06-26T14:45:51.739301Z",
"iopub.status.idle": "2024-06-26T14:45:54.631355Z",
"shell.execute_reply": "2024-06-26T14:45:54.630613Z"
},
"tags": []
},
Expand All @@ -260,10 +260,10 @@
"id": "f1482a8f-4ce5-4e04-93c8-ddd883375d67",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-04T20:13:25.763454Z",
"iopub.status.busy": "2024-06-04T20:13:25.763058Z",
"iopub.status.idle": "2024-06-04T20:13:25.874830Z",
"shell.execute_reply": "2024-06-04T20:13:25.874185Z"
"iopub.execute_input": "2024-06-26T14:45:54.634057Z",
"iopub.status.busy": "2024-06-26T14:45:54.633849Z",
"iopub.status.idle": "2024-06-26T14:45:54.747378Z",
"shell.execute_reply": "2024-06-26T14:45:54.746686Z"
},
"tags": []
},
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ dmypy.json
.github/documentation/documentation_update.py

# template data files
YahooFinance/STOCK_CLUSTERS.csv
*.csv
*.html
*.xz

# template outputs
Expand Down
282 changes: 282 additions & 0 deletions Brevo/Brevo_Add_contacts_to_list.ipynb
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
}
Loading

0 comments on commit 4bb2313

Please sign in to comment.