Skip to main content

API to make request for PWBUS. Developed for the following frameworks Flask, Bottle

Project description

pwbus-web

API to make request for PWBus.

See code in GitHub

Install:

$ pip3 install pwbus-request

Bootle request

@get('/ping')
def ping():
    print("PING (request)")
    sys.stdout.flush()
    try:
        pwbus = PwbusBootleRequest(
            request=request,
            response=response,
            channel="scarlet-web-channel", 
            task_id="pwbus.Pwbus_ping_task"
        )

        headers = pwbus.getHeaders()

        if pwbus.isRetry():
            payload = {}
        else:
            payload = {'value': 'PING'}

        resp = pwbus.post(payload, headers)
        return json.dumps({'success': True, 'data': resp["data"]})

    except:
        traceback.print_exc()
        sys.stdout.flush()
        return json.dumps({'success': False})

Flask request

TODO

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

pwbus-request-0.1.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

pwbus_request-0.1.1-py2.py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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