Metadata-Version: 2.1
Name: jsonrpc-server-py
Version: 0.1
Summary: A simple JSON-RPC server
Home-page: https://github.com/gclluch/jsonrpc-server
Author: Gabriel Lluch
Author-email: gclluch@gmail.com
License: MIT
Project-URL: Documentation, https://github.com/gclluch/jsonrpc-server/blob/main/README.md
Project-URL: Source, https://github.com/gclluch/jsonrpc-server
Project-URL: Tracker, https://github.com/gclluch/jsonrpc-server/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Provides-Extra: dev
Requires-Dist: check-manifest ; extra == 'dev'
Provides-Extra: test
Requires-Dist: coverage ; extra == 'test'

# JSON-RPC Server for Python

A lightweight, easy-to-use JSON-RPC 2.0 server implementation in Python, designed for simplicity and minimal dependencies. This package allows you to quickly set up a JSON-RPC server to handle remote procedure calls in a standardized way, supporting both single and batch requests.

## Features

- Simple and straightforward JSON-RPC 2.0 compliance.
- Supports method registration for handling RPC calls.
- Handles single and batch requests.
- Built-in support for notifications (requests without response).
- Easy integration into existing Python applications.

## Installation

To install the JSON-RPC Server, simply use pip:

```bash
pip install git+https://github.com/gclluch/jsonrpc-server.git
```

## Quick Start

Define the methods you want to expose through JSON-RPC, register your methods with the server, and run the server


```python
from jsonrpc_server import register_method, run

def add(a, b):
    return a + b

register_method('add', add)

if __name__ == "__main__":
    run(address='localhost', port=8000)
```


## Example

Request: 

```bash
{
  "jsonrpc": "2.0",
  "method": "add",
  "params": [1, 2],
  "id": 1
}
```

Result:

```bash
{
  "jsonrpc": "2.0",
  "result": 3,
  "id": 1
}
```

## Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues to improve the project.

## License

This project is licensed under the MIT License - see the LICENSE file for details.
