Skip to main content

Work with Strapi from Python via REST API

Project description

PyStrapi

CI Build and release PyPI version pyversions

Work with Strapi from Python via REST API

Install

pip install pystrapi

Examples

Quick start:

import asyncio
from pystrapi import StrapiClient

async def main():
    strapi = StrapiClient(api_url=strapi_url)
    await strapi.authorize(your_identifier, your_password) # optional
    users = await strapi.get_entries('users', filters={'username': {'$eq': 'Pavel'}})
    user_id = users['data'][0]['id']
    await strapi.update_entry('users', user_id, data={'username': 'Mark'})

asyncio.run(main())

Development

Install environment:

python -m venv .env
source .env/bin/activate
poetry install

Lint

Run prospector:

prospector

Unit tests

pytest test/unittests

Integration tests

Run Strapi test server (see instructions), and run integration tests:

pytest test/integration

Create new release

Push changes to 'main' branch following Conventional Commits.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pystrapi-4.5.0.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

pystrapi-4.5.0-py3-none-any.whl (14.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page