feat: publish event on C_UD for stalls
This commit is contained in:
parent
aba3706a71
commit
5972c44ad1
7 changed files with 305 additions and 40 deletions
21
nostr/nostr_client.py
Normal file
21
nostr/nostr_client.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import httpx
|
||||
from loguru import logger
|
||||
|
||||
from lnbits.app import settings
|
||||
from lnbits.helpers import url_for
|
||||
|
||||
from .event import NostrEvent
|
||||
|
||||
|
||||
async def publish_nostr_event(e: NostrEvent):
|
||||
url = url_for("/nostrclient/api/v1/publish", external=True)
|
||||
data = dict(e)
|
||||
print("### published", dict(data))
|
||||
async with httpx.AsyncClient() as client:
|
||||
try:
|
||||
await client.post(
|
||||
url,
|
||||
json=data,
|
||||
)
|
||||
except Exception as ex:
|
||||
logger.warning(ex)
|
||||
Loading…
Add table
Add a link
Reference in a new issue