chora


Namechora JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryDeploy a mock server for use in testing.
upload_time2025-07-26 16:17:30
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseMIT
keywords server mock
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # chora

> **Warning:** chora is intended for development and testing only. Do not use
this server in production environments.  If you _do_ use this in production, and
get your ass handed to you, please don't come crying to me.

chora is a mock HTTP server for Python that serves responses based on your file
system structure. It's designed for testing and development, allowing you to
quickly simulate APIs or static content by simply organizing files and
directories.

## Features

- File-based routing: Map HTTP endpoints to files and folders.
- Supports multiple HTTP methods: Serve different responses for GET, POST, etc., using file naming conventions.
- Easy to configure: No code changes needed—just update the file system.
- Great for testing: Quickly mock APIs for frontend or integration tests.

## How It Works

- Each directory represents a route.
- Files inside directories represent responses, statuses, and headers for specific HTTP methods and endpoints.
- Dynamic request handling is done with a special HANDLE script.
- The server reads the file system to determine how to respond to incoming requests.

### Example Structure

```text
example/
├── users/
│   └── GET/
│   │    ├── HEADERS                  # Custom headers for GET /users
│   │    ├── DATA                     # Response body for GET /users
│   │    └── STATUS                   # HTTP status code for GET /users
│   └── POST/
│   │    ├── HEADERS                  # Custom headers for POST /users/
│   │    ├── DATA                     # Response body for POST /users/
│   │    └── STATUS                   # HTTP status code for POST /users/
│   └── PUT/
│        └── HANDLE                   # Custom handler for PUT /users/
└── status/
    └── POST/
        ├── HEADERS                   # Custom headers for POST /status
        ├── DATA                      # Response body for POST /status
        └── STATUS                    # HTTP status code for POST /status
```

A request to GET /users will return the contents of users/GET/DATA, with
headers from users/GET/HEADERS and status from users/GET/STATUS.

A request to PUT /users will execute the HANDLE script, with $1 containing the folder
with the details of the request.  The script is expected to introspect that and supply
a path to a folder containing the DATA, HEADERS and STATUS files.

## Installation

pip install chora

## Usage

chora --root ./example --port 8080

- --root: Path to the directory containing your mock API structure.
- --port: Port to run the server on (default: 8000).

## Customization

- Add new endpoints by creating directories and files.
- Use subdirectories for nested routes.

## License

MIT

## Author

pbhandari (<pbhandari@pbhandari.ca>)

For more information, see the project homepage: <https://github.com/pbhandari/chora>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "chora",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "server, mock",
    "author": null,
    "author_email": "pbhandari <pbhandari@pbhandari.ca>",
    "download_url": "https://files.pythonhosted.org/packages/c0/ab/b29ad355f4f026486a2813e50a1adf893baada2bdd48142d98872c40c4bb/chora-0.3.0.tar.gz",
    "platform": null,
    "description": "# chora\n\n> **Warning:** chora is intended for development and testing only. Do not use\nthis server in production environments.  If you _do_ use this in production, and\nget your ass handed to you, please don't come crying to me.\n\nchora is a mock HTTP server for Python that serves responses based on your file\nsystem structure. It's designed for testing and development, allowing you to\nquickly simulate APIs or static content by simply organizing files and\ndirectories.\n\n## Features\n\n- File-based routing: Map HTTP endpoints to files and folders.\n- Supports multiple HTTP methods: Serve different responses for GET, POST, etc., using file naming conventions.\n- Easy to configure: No code changes needed\u2014just update the file system.\n- Great for testing: Quickly mock APIs for frontend or integration tests.\n\n## How It Works\n\n- Each directory represents a route.\n- Files inside directories represent responses, statuses, and headers for specific HTTP methods and endpoints.\n- Dynamic request handling is done with a special HANDLE script.\n- The server reads the file system to determine how to respond to incoming requests.\n\n### Example Structure\n\n```text\nexample/\n\u251c\u2500\u2500 users/\n\u2502   \u2514\u2500\u2500 GET/\n\u2502   \u2502    \u251c\u2500\u2500 HEADERS                  # Custom headers for GET /users\n\u2502   \u2502    \u251c\u2500\u2500 DATA                     # Response body for GET /users\n\u2502   \u2502    \u2514\u2500\u2500 STATUS                   # HTTP status code for GET /users\n\u2502   \u2514\u2500\u2500 POST/\n\u2502   \u2502    \u251c\u2500\u2500 HEADERS                  # Custom headers for POST /users/\n\u2502   \u2502    \u251c\u2500\u2500 DATA                     # Response body for POST /users/\n\u2502   \u2502    \u2514\u2500\u2500 STATUS                   # HTTP status code for POST /users/\n\u2502   \u2514\u2500\u2500 PUT/\n\u2502        \u2514\u2500\u2500 HANDLE                   # Custom handler for PUT /users/\n\u2514\u2500\u2500 status/\n    \u2514\u2500\u2500 POST/\n        \u251c\u2500\u2500 HEADERS                   # Custom headers for POST /status\n        \u251c\u2500\u2500 DATA                      # Response body for POST /status\n        \u2514\u2500\u2500 STATUS                    # HTTP status code for POST /status\n```\n\nA request to GET /users will return the contents of users/GET/DATA, with\nheaders from users/GET/HEADERS and status from users/GET/STATUS.\n\nA request to PUT /users will execute the HANDLE script, with $1 containing the folder\nwith the details of the request.  The script is expected to introspect that and supply\na path to a folder containing the DATA, HEADERS and STATUS files.\n\n## Installation\n\npip install chora\n\n## Usage\n\nchora --root ./example --port 8080\n\n- --root: Path to the directory containing your mock API structure.\n- --port: Port to run the server on (default: 8000).\n\n## Customization\n\n- Add new endpoints by creating directories and files.\n- Use subdirectories for nested routes.\n\n## License\n\nMIT\n\n## Author\n\npbhandari (<pbhandari@pbhandari.ca>)\n\nFor more information, see the project homepage: <https://github.com/pbhandari/chora>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Deploy a mock server for use in testing.",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/pbhandari/chora",
        "Issues": "https://github.com/pbhandari/chora/issues",
        "Releases": "https://github.com/pbhandari/chora/releases"
    },
    "split_keywords": [
        "server",
        " mock"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d1fcf01c042a26a97f9eb04dbf976bf0f1e77b366e629a668b43e393aa370af7",
                "md5": "2252e2896a1ad869594a6b2c7c4c9fd4",
                "sha256": "d762d6049c63216307ae5badd3f0cb2f9a75aba76ae25b9efb558fdde1f227d2"
            },
            "downloads": -1,
            "filename": "chora-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2252e2896a1ad869594a6b2c7c4c9fd4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 7959,
            "upload_time": "2025-07-26T16:17:28",
            "upload_time_iso_8601": "2025-07-26T16:17:28.577602Z",
            "url": "https://files.pythonhosted.org/packages/d1/fc/f01c042a26a97f9eb04dbf976bf0f1e77b366e629a668b43e393aa370af7/chora-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c0abb29ad355f4f026486a2813e50a1adf893baada2bdd48142d98872c40c4bb",
                "md5": "1a2138a64656eca58f8cc2780de110df",
                "sha256": "d0d8b58c0c2e94d938ecdc35f230236d360bae032e6fe833d84ebfda853a1e8b"
            },
            "downloads": -1,
            "filename": "chora-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1a2138a64656eca58f8cc2780de110df",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 16152,
            "upload_time": "2025-07-26T16:17:30",
            "upload_time_iso_8601": "2025-07-26T16:17:30.265424Z",
            "url": "https://files.pythonhosted.org/packages/c0/ab/b29ad355f4f026486a2813e50a1adf893baada2bdd48142d98872c40c4bb/chora-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-26 16:17:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pbhandari",
    "github_project": "chora",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "chora"
}
        
Elapsed time: 1.93225s