Metadata-Version: 2.4
Name: webmediator
Version: 1.0.0
Summary: Python sync/async client for the WebMediator API
Home-page: https://github.com/mustaddon/webmediator.git
Author: Leonid Salavatov
Author-email: mustaddon@gmail.com
Keywords: WebMediator,CQRS,Mediator,ApiClient
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# webmediator
Python sync/async client for the WebMediator API.


## Example 1: request/response
```python
import webmediator

client = webmediator.Client('https://localhost:7263/mediator')

response = client.send('Ping', {'Message':'EXAMPLE' })
print(response)
```
*Console output:*
```
type: Pong, data: {'Message': 'EXAMPLE PONG'}
```

## Example 2: Async request/response
```python
import webmediator
import asyncio

async def main():
    client = webmediator.AsyncClient('http://localhost:5263/mediator')

    response = await client.send('Ping', {'Message':'EXAMPLE' })
    print(response)

if __name__ == "__main__":
    asyncio.get_event_loop().run_until_complete(main())
```
[More code...](https://github.com/mustaddon/WebMediator/tree/main/WebMediator.Client.Python/dev_async.py)


## Example 3: File upload/download
```python
import webmediator

client = webmediator.Client('https://localhost:7263/mediator')

with open('example.txt','rb') as file: 
    client.send('FileUpload', { 'Name': file.name, 'Content': file })

with client.send('FileDownload', { 'Name': file.name }) as response:
    content = response.data.read()
    print(content)
```
[More code...](https://github.com/mustaddon/WebMediator/tree/main/WebMediator.Client.Python/dev.py)

