2019-08-21 19:28:30 +02:00
|
|
|
import asyncio
|
2021-07-06 23:53:40 +02:00
|
|
|
from lbry.wallet.network import ClientSession
|
2020-01-01 02:08:19 +01:00
|
|
|
from lbry.wallet.rpc.jsonrpc import RPCError
|
2019-08-21 19:28:30 +02:00
|
|
|
import logging
|
|
|
|
import json
|
|
|
|
import sys
|
|
|
|
|
2020-01-01 02:08:19 +01:00
|
|
|
logging.getLogger('lbry.wallet').setLevel(logging.CRITICAL)
|
2019-08-21 19:28:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
try:
|
|
|
|
hostname = sys.argv[1]
|
|
|
|
except IndexError:
|
2020-02-11 22:13:55 +01:00
|
|
|
hostname = 'spv11.lbry.com'
|
2019-08-21 19:28:30 +02:00
|
|
|
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
client = ClientSession(network=None, server=(hostname, 50001))
|
|
|
|
error = None
|
|
|
|
args = {
|
|
|
|
'any_tags': ['art'],
|
|
|
|
'not_tags': ['xxx', 'porn', 'mature', 'nsfw', 'titan'],
|
|
|
|
'order_by': ["name"],
|
|
|
|
'offset': 3000,
|
|
|
|
'limit': 200,
|
|
|
|
'no_totals': False,
|
|
|
|
}
|
|
|
|
|
|
|
|
start = loop.time()
|
|
|
|
try:
|
|
|
|
await client.create_connection()
|
|
|
|
try:
|
|
|
|
await client.send_request('blockchain.claimtrie.search', args)
|
|
|
|
except RPCError as err:
|
|
|
|
error = err
|
|
|
|
finally:
|
|
|
|
await client.close()
|
|
|
|
finally:
|
|
|
|
print(json.dumps({
|
|
|
|
"time": loop.time() - start,
|
|
|
|
"error": error.__str__() if error else None,
|
|
|
|
"args": args,
|
|
|
|
}, indent=4))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
asyncio.run(main())
|