Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Brevo/Brevo_Get_all_the_lists.ipynb
2973 views
Kernel: Python 3

Naas

Brevo - Get all the lists

Give Feedback | Bug report

Tags: #brevo #contacts #lists #get #snippet

Last update: 2024-05-30 (Created: 2024-05-30)

Description: This notebook get all the lists in Brevo.

Input

Import libraries

import requests import pandas as pd

Setup variables

  • api_key: Brevo API Key

api_key = "YOUR_BREVO_API_KEY"

Model

Get all lists

def get_all_lists(api_key): url = "https://api.brevo.com/v3/contacts/lists" headers = { "accept": "application/json", "api-key": api_key } res = requests.get(url, headers=headers) res.raise_for_status() if res.status_code == 200: return res.json() data = get_all_lists(api_key) data.get("lists")[0]

Output

Display results

df = pd.DataFrame(data.get("lists")) print("Rows:", len(df)) df