mirror of
https://git.wownero.com/wowlet/wowlet-backend.git
synced 2024-08-15 01:03:13 +00:00
YellWOWpages API - distribute contacts to WS clients
This commit is contained in:
parent
c3138a6fb3
commit
7e64dcd133
7 changed files with 70 additions and 83 deletions
|
@ -167,3 +167,4 @@ from wowlet_backend.tasks.xmrig import XmrigTask
|
|||
from wowlet_backend.tasks.suchwow import SuchWowTask
|
||||
from wowlet_backend.tasks.wowlet import WowletReleasesTask
|
||||
from wowlet_backend.tasks.forum import ForumThreadsTask
|
||||
from wowlet_backend.tasks.yellow import YellWowTask
|
||||
|
|
28
wowlet_backend/tasks/yellow.py
Normal file
28
wowlet_backend/tasks/yellow.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# Copyright (c) 2022, The Monero Project.
|
||||
# Copyright (c) 2022, dsc@xmr.pm
|
||||
|
||||
from dateutil.parser import parse
|
||||
|
||||
import settings
|
||||
from wowlet_backend.utils import httpget
|
||||
from wowlet_backend.tasks import WowletTask
|
||||
|
||||
|
||||
class YellWowTask(WowletTask):
|
||||
"""Fetches yellwowpages usernames/addresses"""
|
||||
def __init__(self, interval: int = 3600):
|
||||
super(YellWowTask, self).__init__(interval)
|
||||
|
||||
self._cache_key = "yellwow"
|
||||
self._cache_expiry = self.interval * 10
|
||||
|
||||
self._websocket_cmd = "yellwow"
|
||||
|
||||
self._http_endpoint = "https://yellow.wownero.com/api/user/"
|
||||
|
||||
async def task(self) -> list[dict]:
|
||||
blob = await httpget(self._http_endpoint)
|
||||
if not isinstance(blob, list) or not blob:
|
||||
raise Exception(f"Invalid JSON response for {self._http_endpoint}")
|
||||
return blob
|
Loading…
Add table
Add a link
Reference in a new issue