Add scripts related to querying / downloading sd blobs
This commit is contained in:
parent
a67aab0797
commit
5dbf9034ec
8 changed files with 540 additions and 2 deletions
scripts
23
scripts/common.py
Normal file
23
scripts/common.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import logging
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def getNames(wallet, names=None):
|
||||
if names:
|
||||
defer.returnValue(names)
|
||||
nametrie = yield wallet.get_nametrie()
|
||||
defer.returnValue(list(getNameClaims(nametrie)))
|
||||
|
||||
|
||||
def getNameClaims(trie):
|
||||
for x in trie:
|
||||
if 'txid' in x:
|
||||
try:
|
||||
yield str(x['name'])
|
||||
except UnicodeError:
|
||||
log.warning('Skippin name %s as it is not ascii', x['name'])
|
Loading…
Add table
Add a link
Reference in a new issue