Skip to main content

Netlify Python Client SDK

GitHub release (latest by date) CI PyPI - Python Version PyPI - License

This is a partial client library designed to wrap the Netlify APIs for python client users.

Full openapi docs: https://open-api.netlify.com/.

This client library is not affiliated with Netlify in any way and provides no guarantees of support or compatibility for Netlify APIs.

User Guide

This section is intended for developers who want to use the library to make requests to Netlify.

Installation

netlify-python currently supports python 3.10+.

Recommended installation through PIP via pypi.

pip install netlify-python

You can also install using uv:

uv add netlify-python

or Poetry:

poetry add netlify-python

Usage

This client currently only supports Personal Access Tokens. Navigate to User Settings > Applications > Personal Access Tokens and create a new access token. This is the token you'll use in your initialization of the client.

This created a client that can send http requests.

from netlify import NetlifyClient

client = NetlifyClient(access_token="my-access-token")

client.get_current_user()  # Get current user information
client.create_site_deploy("site-id", "path/to/zip/file.zip")

Note that all types are exposed via py.typed so if you are setup with a Pylance server or are using mypy/ty, you can get types automatically from the objects in this library.

API

This client has minimal support for Netlify APIs based on community need. The following endpoints are currently supported:

SDK method API HTTP Method API Path
get_current_user() GET /api/v1/user
create_site(request: CreateSiteRequest) POST create_site(...)
list_sites() GET /api/v1/sites
get_site(site_id: str) GET /sites/{site_id}
delete_site(site_id: str) DELETE /api/v1/sites/{site_id}
create_site_in_team(account_slug: str, request: CreateSiteRequest) POST /api/v1/{account_slug}/sites
list_site_files(site_id: str) GET /api/v1/sites/{site_id}/files
get_site_file_by_path_name(site_id: str, file_path: str) GET /api/v1/sites/{site_id}/files/{file_path}
create_site_deploy() POST /api/v1/sites/{site_id}/deploys
get_site_deploy() GET /api/v1/sites/{site_id}/deploys/{deploy_id}

For Developers

This section is for developers who want to improve this library. The default development version is on 3.14 but we are currently supporting all python versions >= 3.10.

This library should be developed directly with pip using a venv.

Development Dependencies

Make sure that you have pyenv. You can test this by checking your python version after opening this directory. If you need to target a specific version of python you should overwrite your .python-version file and ensure you have the specific version installed.

pyenv install
python --version

Make sure your active python version has virtualenv setup via:

python -m pip install virtualenv

Create and activate your venv

python -m venv venv
. venv/bin/activate

Starting development

Everything here out should be executed inside the active venv.

Install your dependencies:

pip install .[dev]

Setup pre-commits:

pre-commit install

You should be good to go now.

Running tests

Tests are supported via pytest:

pytest

Building the package

Get your build dependencies in place:

pip install .[build]

Then build the package:

python -m build

Release files for netlify-python 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netlify-python 0.4.1
File Size Uploaded
netlify_python-0.4.1.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for netlify-python 0.4.1
File Interpreter ABI Platform
netlify_python-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.2 kB

Release files / netlify_python-0.4.1.tar.gz

Download URL netlify_python-0.4.1.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
184ba9ae0c9cbf1fcf715210620068df4315369a9f411a54cfef85f8c189111f
BLAKE2b-256 checksum
How to use checksums
3664eccbf9135e539403e66e958f6efbd2c9f53433df5ab3014a90831c41fce1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / netlify_python-0.4.1-py3-none-any.whl

Download URL netlify_python-0.4.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71cf404be25c28697aa39e44e0db39f0d196c585ac35cf9c8552c3fa9cb0b173
BLAKE2b-256 checksum
How to use checksums
e4954ed74dc6180c293cdabaf2f0a2bce1f87204dc5a578f757b2bd7989d68d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page