Skip to content

Feature: get the encoded data ready for sending (for async interop) #142

Open
@kervel

Description

@kervel

Hello,
It would be nice to be able to just get the encoded push request so we could use another http library for sending the request. Our motivation is to do this in an async framework, but there could be others.

Now we do this by monkeypatching the library:

import pywebpush
pywebpush.WebPusher.as_curl = lambda self, endpoint, data, headers: {'endpoint': endpoint, 'data': data, 'headers': headers}

then we can just pass curl=True to any function and get the data we want. But it would be nicer to do this in an official way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions