| Name | strapi-client JSON | 
| Version | 5.0.4  JSON | 
|  | download | 
| home_page | None | 
| Summary | Interact with Strapi from Python using the REST API | 
            | upload_time | 2025-10-24 11:44:38 | 
            | maintainer | None | 
            
            | docs_url | None | 
            | author | None | 
            
            | requires_python | >=3.10 | 
            
            
            | license | MIT | 
            | keywords | strapi
                
                     cms
                
                     api
                
                     rest | 
            | VCS |  | 
            | bugtrack_url |  | 
            | requirements | No requirements were recorded. | 
            
| Travis-CI | No Travis. | 
            | coveralls test coverage | No coveralls. | 
        
        
            
            # Strapi Client
[](https://pypi.org/project/strapi-client/)
Interact with Strapi from Python using the REST API
## Install
```bash
pip install strapi-client
```
## Documentation
[Full API Reference](https://roslovets-inc.github.io/strapi-client/reference/)
## Examples
### Quick start (sync version):
```python
from strapi_client import StrapiClient
with StrapiClient(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:
    # await strapi.authorize(identifier='user_identifier', password='user_password')  # Optional
    users = client.get_documents('users', filters={'username': {'$eq': 'Pavel'}})
    user_id = users.data[0]['documentId']
    client.update_document('users', user_id, data={'username': 'Mark'})
```
### Quick start (async version):
```python
import asyncio
from strapi_client import StrapiClientAsync
async def main():
    async with StrapiClientAsync(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:
        # await strapi.authorize(identifier='user_identifier', password='user_password')  # Optional
        users = await client.get_documents('users', filters={'username': {'$eq': 'Pavel'}})
        user_id = users.data[0]['documentId']
        await client.update_document('users', user_id, data={'username': 'Mark'})
asyncio.run(main())
```
### Quick start with SmartDocument ORM
```python
import asyncio
from strapi_client import StrapiClientAsync, SmartDocument, MediaImageDocument
class User(SmartDocument):
    __singular_api_id__ = 'user'
    username: str
    first_name: str
    photo: MediaImageDocument
class Session(SmartDocument):
    uid: str
    user: User | None
async def main():
    async with StrapiClientAsync(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:
        # Get with relations and media by ID
        user1 = await User.get_document(client, document_id='YOUR_DOCUMENT_ID')
        print(user1.photo)
        # List documents with automatic population
        sessions = await Session.get_documents(client, sort=['created_at'])
        for session in sessions:
            print(session.user.photo if session.user else 'No user')
        # Find one document
        user1 = await User.get_first_document(client, filters={'username': 'Mark'})
        if user1:
            print(user1)
asyncio.run(main())
```
### Quick start with ActiveDocument ORM (experimental)
Relations and upserts are supported in experimental mode.
```python
import asyncio
from strapi_client import StrapiClientAsync, ActiveDocument, DocumentField
class User(ActiveDocument):
    username: str = DocumentField(unique=True)
    first_name: str
class Session(ActiveDocument):
    uid: str = DocumentField(unique=True)
    user: User | None = DocumentField(default=None, relation=True)
async def main():
    async with StrapiClientAsync(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:
        # Update existing document
        user1 = await User.get_document(client, document_id='YOUR_DOCUMENT_ID')
        user1.first_name = 'Mark'
        await user1.update_document(client)
        # Create or update document with relation
        session1 = await Session(uid='123', user=user1).upsert_document(client)
        await session1.refresh(client)  # populate fields from Strapi
        # Create and delete document
        user2 = await User(username='pavel', first_name='Pavel').create_document(client)
        await user2.delete_document(client)
asyncio.run(main())
```
## Development
### Create new release
Push changes to 'main' branch following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
### Update documentation
`docs` folder is being updated automatically by GitHub Actions when source files are changed.
            
         
        Raw data
        
            {
    "_id": null,
    "home_page": null,
    "name": "strapi-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "strapi, cms, api, rest",
    "author": null,
    "author_email": "Pavel Roslovets <p.v.roslovets@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/47/ff/259a887d6924e6a953f091ee094326d01ab5f150af9c99dc1184ba664dfc/strapi_client-5.0.4.tar.gz",
    "platform": null,
    "description": "# Strapi Client\n\n[](https://pypi.org/project/strapi-client/)\n\nInteract with Strapi from Python using the REST API\n\n## Install\n\n```bash\npip install strapi-client\n```\n\n## Documentation\n\n[Full API Reference](https://roslovets-inc.github.io/strapi-client/reference/)\n\n## Examples\n\n### Quick start (sync version):\n\n```python\nfrom strapi_client import StrapiClient\n\nwith StrapiClient(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:\n    # await strapi.authorize(identifier='user_identifier', password='user_password')  # Optional\n    users = client.get_documents('users', filters={'username': {'$eq': 'Pavel'}})\n    user_id = users.data[0]['documentId']\n    client.update_document('users', user_id, data={'username': 'Mark'})\n```\n\n### Quick start (async version):\n\n```python\nimport asyncio\nfrom strapi_client import StrapiClientAsync\n\n\nasync def main():\n    async with StrapiClientAsync(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:\n        # await strapi.authorize(identifier='user_identifier', password='user_password')  # Optional\n        users = await client.get_documents('users', filters={'username': {'$eq': 'Pavel'}})\n        user_id = users.data[0]['documentId']\n        await client.update_document('users', user_id, data={'username': 'Mark'})\n\n\nasyncio.run(main())\n```\n\n### Quick start with SmartDocument ORM\n\n```python\nimport asyncio\nfrom strapi_client import StrapiClientAsync, SmartDocument, MediaImageDocument\n\n\nclass User(SmartDocument):\n    __singular_api_id__ = 'user'\n    username: str\n    first_name: str\n    photo: MediaImageDocument\n\n\nclass Session(SmartDocument):\n    uid: str\n    user: User | None\n\n\nasync def main():\n    async with StrapiClientAsync(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:\n        # Get with relations and media by ID\n        user1 = await User.get_document(client, document_id='YOUR_DOCUMENT_ID')\n        print(user1.photo)\n\n        # List documents with automatic population\n        sessions = await Session.get_documents(client, sort=['created_at'])\n        for session in sessions:\n            print(session.user.photo if session.user else 'No user')\n\n        # Find one document\n        user1 = await User.get_first_document(client, filters={'username': 'Mark'})\n        if user1:\n            print(user1)\n\n\nasyncio.run(main())\n```\n\n### Quick start with ActiveDocument ORM (experimental)\n\nRelations and upserts are supported in experimental mode.\n\n```python\nimport asyncio\nfrom strapi_client import StrapiClientAsync, ActiveDocument, DocumentField\n\n\nclass User(ActiveDocument):\n    username: str = DocumentField(unique=True)\n    first_name: str\n\n\nclass Session(ActiveDocument):\n    uid: str = DocumentField(unique=True)\n    user: User | None = DocumentField(default=None, relation=True)\n\n\nasync def main():\n    async with StrapiClientAsync(base_url='YOUR_STRAPI_URL', token='YOUR_STRAPI_TOKEN') as client:\n        # Update existing document\n        user1 = await User.get_document(client, document_id='YOUR_DOCUMENT_ID')\n        user1.first_name = 'Mark'\n        await user1.update_document(client)\n\n        # Create or update document with relation\n        session1 = await Session(uid='123', user=user1).upsert_document(client)\n        await session1.refresh(client)  # populate fields from Strapi\n\n        # Create and delete document\n        user2 = await User(username='pavel', first_name='Pavel').create_document(client)\n        await user2.delete_document(client)\n\n\nasyncio.run(main())\n```\n\n## Development\n\n### Create new release\n\nPush changes to 'main' branch following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).\n\n### Update documentation\n\n`docs` folder is being updated automatically by GitHub Actions when source files are changed.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Interact with Strapi from Python using the REST API",
    "version": "5.0.4",
    "project_urls": {
        "Changelog": "https://github.com/Roslovets-Inc/strapi-client/blob/main/CHANGELOG.md",
        "Documentation": "https://roslovets-inc.github.io/strapi-client/",
        "Homepage": "https://github.com/Roslovets-Inc/strapi-client",
        "Issues": "https://github.com/Roslovets-Inc/strapi-client/issues",
        "Repository": "https://github.com/Roslovets-Inc/strapi-client"
    },
    "split_keywords": [
        "strapi",
        " cms",
        " api",
        " rest"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b03b5fb4c743c8aaba737ede653697944c1a936e11ccf665aa29210629a4ebc2",
                "md5": "b48fe0c3b9cafb70b2ae180b3ea146d9",
                "sha256": "0995609e2caad94157927beb2078152a2e6a55699b1493e7a279b4eea1fe4912"
            },
            "downloads": -1,
            "filename": "strapi_client-5.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b48fe0c3b9cafb70b2ae180b3ea146d9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 24790,
            "upload_time": "2025-10-24T11:44:37",
            "upload_time_iso_8601": "2025-10-24T11:44:37.662745Z",
            "url": "https://files.pythonhosted.org/packages/b0/3b/5fb4c743c8aaba737ede653697944c1a936e11ccf665aa29210629a4ebc2/strapi_client-5.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "47ff259a887d6924e6a953f091ee094326d01ab5f150af9c99dc1184ba664dfc",
                "md5": "d2f14d7b6e4b845d76c2ee8e3fc30e03",
                "sha256": "c19f1f1ffad5c3838034e232857be8fabb7204323f7c5c636d4c2a8923740fe1"
            },
            "downloads": -1,
            "filename": "strapi_client-5.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "d2f14d7b6e4b845d76c2ee8e3fc30e03",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 26359,
            "upload_time": "2025-10-24T11:44:38",
            "upload_time_iso_8601": "2025-10-24T11:44:38.870099Z",
            "url": "https://files.pythonhosted.org/packages/47/ff/259a887d6924e6a953f091ee094326d01ab5f150af9c99dc1184ba664dfc/strapi_client-5.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-24 11:44:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Roslovets-Inc",
    "github_project": "strapi-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "strapi-client"
}