I have a nodejs end point which will be called by a job with a POST HTTP call containing the details of the job data in JSON format?how do I listen to a webhook (https address) from python client to get the the job data?
import asyncio
import websockets
async def hello():
uri = 'https://company/api/bats_hook'
async with websockets.connect(uri) as websocket:
await websocket.send("Hello world!")
await websocket.recv()
asyncio.get_event_loop().run_until_complete(hello())
ERROR:-
Traceback (most recent call last):
File "/Users/username/.pyenv/versions/3.7.2/lib/python3.7/site-packages/websockets/uri.py", line 63, in parse_uri
assert parsed.scheme in ["ws", "wss"]
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "ibait_hook_listen.py", line 23, in <module>
asyncio.get_event_loop().run_until_complete(hello())
File "/Users/username/.pyenv/versions/3.7.2/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "ibait_hook_listen.py", line 19, in hello
async with websockets.connect(uri) as websocket:
File "/Users/username/.pyenv/versions/3.7.2/lib/python3.7/site-packages/websockets/client.py", line 416, in __init__
wsuri = parse_uri(uri)
File "/Users/username/.pyenv/versions/3.7.2/lib/python3.7/site-packages/websockets/uri.py", line 68, in parse_uri
raise InvalidURI(uri) from exc
websockets.exceptions.InvalidURI: https://company.com/api/bats_hook isn't a valid URI
UPDATE:I am looking to listen over http ,NOT on websocket
from how do I listen to a webhook (https address end point) from python client?
Have you resolved this problem, because i'm having the same issue!
ReplyDelete