WIP openapi spec for cic-cache-server
This commit is contained in:
@@ -23,6 +23,7 @@ re_transactions_all_bloom = r'/tx/(\d+)?/?(\d+)/?(\d+)?/?(\d+)?/?'
|
||||
re_transactions_account_bloom = r'/tx/user/((0x)?[a-fA-F0-9]+)(/(\d+)(/(\d+))?)?/?'
|
||||
re_transactions_all_data = r'/txa/(\d+)/?(\d+)?/?(\d+)?/?(\d+)?/?'
|
||||
re_transactions_account_data = r'/txa/user/((0x)?[a-fA-F0-9]+)(/(\d+)(/(\d+))?)?/?'
|
||||
re_default_limit = r'/defaultlimit/?'
|
||||
|
||||
DEFAULT_LIMIT = 100
|
||||
|
||||
@@ -64,6 +65,14 @@ def parse_query_any(r):
|
||||
return (offset, limit, block_offset, block_end,)
|
||||
|
||||
|
||||
def process_default_limit(session, env):
|
||||
r = re.match(re_default_limit, env.get('PATH_INFO'))
|
||||
if not r:
|
||||
return None
|
||||
|
||||
return ('application/json', str(DEFAULT_LIMIT).encode('utf-8'),)
|
||||
|
||||
|
||||
def process_transactions_account_bloom(session, env):
|
||||
r = re.match(re_transactions_account_bloom, env.get('PATH_INFO'))
|
||||
if not r:
|
||||
|
||||
@@ -12,6 +12,7 @@ import cic_cache.cli
|
||||
from cic_cache.db import dsn_from_config
|
||||
from cic_cache.db.models.base import SessionBase
|
||||
from cic_cache.runnable.daemons.query import (
|
||||
process_default_limit,
|
||||
process_transactions_account_bloom,
|
||||
process_transactions_account_data,
|
||||
process_transactions_all_bloom,
|
||||
@@ -49,6 +50,7 @@ def application(env, start_response):
|
||||
process_transactions_all_bloom,
|
||||
process_transactions_account_bloom,
|
||||
process_transactions_account_data,
|
||||
process_default_limit,
|
||||
]:
|
||||
r = None
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user