feat: no nead for async-await now, using single REST endpoint for multiple statuses
This commit is contained in:
parent
d932c42247
commit
ce9191ec97
1 changed files with 6 additions and 6 deletions
12
threads.py
12
threads.py
|
|
@ -84,7 +84,7 @@ def middleware():
|
||||||
def get_status_url(ser, id):
|
def get_status_url(ser, id):
|
||||||
return f'{ser}/api/v1/statuses/{id}'
|
return f'{ser}/api/v1/statuses/{id}'
|
||||||
|
|
||||||
async def fetch_statuses():
|
def fetch_statuses():
|
||||||
query_params = "&id[]=".join(thread_ids)
|
query_params = "&id[]=".join(thread_ids)
|
||||||
response = requests.get(server() + '/api/v1/statuses?id[]=' + query_params )
|
response = requests.get(server() + '/api/v1/statuses?id[]=' + query_params )
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
|
@ -121,8 +121,8 @@ def get_descendants(server, status):
|
||||||
### routes
|
### routes
|
||||||
@threads.route('/')
|
@threads.route('/')
|
||||||
@cache.cached(timeout=300)
|
@cache.cached(timeout=300)
|
||||||
async def home():
|
def home():
|
||||||
statuses = await fetch_statuses()
|
statuses = fetch_statuses()
|
||||||
attribution = get_attribution()
|
attribution = get_attribution()
|
||||||
app = get_app_config()
|
app = get_app_config()
|
||||||
tags = []
|
tags = []
|
||||||
|
|
@ -141,7 +141,7 @@ async def home():
|
||||||
|
|
||||||
@threads.route('/tag/<path:id>')
|
@threads.route('/tag/<path:id>')
|
||||||
@cache.cached(timeout=300)
|
@cache.cached(timeout=300)
|
||||||
async def tag(id):
|
def tag(id):
|
||||||
attribution = get_attribution()
|
attribution = get_attribution()
|
||||||
app = get_app_config()
|
app = get_app_config()
|
||||||
statuses = get_account_tagged_statuses(id)
|
statuses = get_account_tagged_statuses(id)
|
||||||
|
|
@ -164,8 +164,8 @@ def thread(id):
|
||||||
|
|
||||||
@threads.route('/api')
|
@threads.route('/api')
|
||||||
@cache.cached(timeout=300)
|
@cache.cached(timeout=300)
|
||||||
async def api():
|
def api():
|
||||||
return await fetch_statuses();
|
return fetch_statuses();
|
||||||
|
|
||||||
@threads.route('/api/<path:id>')
|
@threads.route('/api/<path:id>')
|
||||||
@cache.cached(timeout=300)
|
@cache.cached(timeout=300)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue