Skip to main content

Python sync/async client for the WebMediator API

Project description

webmediator

Python sync/async client for the WebMediator API.

Example 1: request/response

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

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...

Example 3: File upload/download

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...

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

webmediator-1.0.1.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file webmediator-1.0.1.tar.gz.

File metadata

  • Download URL: webmediator-1.0.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.2

File hashes

Hashes for webmediator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d4f6aa2948beda80b8589b32856c8ebfab2959bc7e74b86a1eaffde7b686c6d6
MD5 4939682221c863089ae98d83963abb0a
BLAKE2b-256 d3602bec78b7dc4758d2df0a2c33e578a32b5cf986b90e2d353d308f086373b1

See more details on using hashes here.

Supported by

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