fix: do not hard fail on missing meta data
This commit is contained in:
parent
1dba2d09d1
commit
0db8e56603
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,4 +4,5 @@ build/
|
||||
*.pyc
|
||||
.venv
|
||||
.clicada
|
||||
dist/
|
||||
dist/
|
||||
.vscode/
|
@ -82,31 +82,21 @@ def execute(ctrl):
|
||||
user_address_store = FileUserStore(ctrl.opener('meta'), ctrl.chain(), user_address_file_label, store_path, int(ctrl.get('FILESTORE_TTL')), encrypter=ctrl.encrypter)
|
||||
|
||||
ctrl.notify('resolving metadata for address {}'.format(user_address_normal))
|
||||
r = None
|
||||
try:
|
||||
r = user_address_store.by_address(user_address_normal, update=ctrl.get('_FORCE'))
|
||||
except MetadataNotFoundError as e:
|
||||
ctrl.ouch('could not resolve metadata for user: {}'.format(e))
|
||||
sys.exit(1)
|
||||
|
||||
ctrl.write("""Phone: {}
|
||||
Network address: {}
|
||||
Chain: {}
|
||||
Name: {}
|
||||
Registered: {}
|
||||
Gender: {}
|
||||
Location: {}
|
||||
Products: {}
|
||||
Tags: {}""".format(
|
||||
ctrl.get('_IDENTIFIER'),
|
||||
add_0x(user_address),
|
||||
ctrl.chain().common_name(),
|
||||
str(r),
|
||||
datetime.datetime.fromtimestamp(r.date_registered).ctime(),
|
||||
r.gender,
|
||||
r.location['area_name'],
|
||||
','.join(r.products),
|
||||
','.join(r.tags),
|
||||
)
|
||||
ctrl.write(f"""Phone: {ctrl.get('_IDENTIFIER')}
|
||||
Network address: {add_0x(user_address)}
|
||||
Chain: {ctrl.chain().common_name()}
|
||||
Name: {str(r)}
|
||||
Registered: {r and datetime.datetime.fromtimestamp(r).ctime()}
|
||||
Gender: {r and r.gender}
|
||||
Location: {r and r.location['area_name']}
|
||||
Products: {r and ','.join(r.products)}
|
||||
Tags: {r and ','.join(r.tags)}"""
|
||||
)
|
||||
|
||||
tx_lines = []
|
||||
|
@ -12,7 +12,7 @@ from cic_types.condiments import MetadataPointer
|
||||
from cic_types.models.person import Person
|
||||
from cic_types.ext.requests import make_request
|
||||
from cic_types.processor import generate_metadata_pointer
|
||||
import requests.exceptions
|
||||
from requests.exceptions import HTTPError
|
||||
import phonenumbers
|
||||
|
||||
# local imports
|
||||
@ -222,7 +222,7 @@ class FileUserStore:
|
||||
try:
|
||||
r = getter.open(ptr)
|
||||
user_address = json.loads(r)
|
||||
except requests.exceptions.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
logg.debug('no address found for phone {}: {}'.format(phone, e))
|
||||
return None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user