A tool that syncs contacts from MockAPI to Mailchimp.
Video explaining: https://www.loom.com/share/57845be278d2449c91208499bd910765?sid=dc0ad6f2-aa91-4acc-972a-d94363e8fcfb
- Fetches contacts from MockAPI (https://challenge.trio.dev/api/v1/contacts)
- Creates a new list in Mailchimp with the name "Enzo Massaki Ito"
- Syncs contacts to the Mailchimp list
- Provides a simple API endpoint to trigger the sync process
- Python 3.12+
- uv (Python package installer and environment manager)
- Mailchimp API key
uv venv
source .venv/bin/activate
uv pip install -e .Create a .env file in the project root with the following variables:
MAILCHIMP_API_KEY=your_mailchimp_api_key
MAILCHIMP_SERVER_PREFIX=your_mailchimp_server_prefix
Start the server:
uvicorn quicksync.src.main:app --reloadTo sync contacts, make a GET request to /contacts/sync:
curl http://localhost:8000/contacts/syncResponse format:
{
"syncedContacts": 1,
"contacts": [
{
"firstName": "Amelia",
"lastName": "Earhart",
"email": "amelia_earhart@gmail.com"
}
]
}-
Prod app: https://quicksync-bay.vercel.app/
-
Set up your environment and install dependencies:
Ensure you have activated your virtual environment (e.g.,
source .venv/bin/activate) and installed the project in editable mode as described in the "Installation" section. -
Install test-specific dependencies:
The tests require
pytestandpytest-asyncio. If they were not installed as part of the main dependencies, you can install them directly:uv pip install pytest pytest-asyncio
-
Run tests:
From the project root directory, execute:
PYTHONPATH=. pytest
The
PYTHONPATH=.part ensures that Python can correctly locate yourquicksyncpackage during test collection.