Bare-bones python library for the official Netlify API
Project description
Netlify Python Client SDK
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netlify_python-0.4.1.tar.gz.
File metadata
- Download URL: netlify_python-0.4.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
184ba9ae0c9cbf1fcf715210620068df4315369a9f411a54cfef85f8c189111f
|
|
| MD5 |
32a24e2c693474bb20a79b3a8df88868
|
|
| BLAKE2b-256 |
3664eccbf9135e539403e66e958f6efbd2c9f53433df5ab3014a90831c41fce1
|
File details
Details for the file netlify_python-0.4.1-py3-none-any.whl.
File metadata
- Download URL: netlify_python-0.4.1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71cf404be25c28697aa39e44e0db39f0d196c585ac35cf9c8552c3fa9cb0b173
|
|
| MD5 |
dfa284038ae9f02f631d669f04babfe1
|
|
| BLAKE2b-256 |
e4954ed74dc6180c293cdabaf2f0a2bce1f87204dc5a578f757b2bd7989d68d8
|