diff options
author | Martin Czygan <martin@archive.org> | 2021-06-01 20:59:07 +0000 |
---|---|---|
committer | Martin Czygan <martin@archive.org> | 2021-06-01 20:59:07 +0000 |
commit | 6d20157b3c9e9694779dc4f13281c78a79a73aa3 (patch) | |
tree | 2fc88252a960a5db117d32ec3c47f6e74c36cbdc /fuzzycat/matching.py | |
parent | f0e6db866a6ebe553b05ea66b890f3d50b08a648 (diff) | |
parent | 8ae5d2945a97a8f4385f301a73c3baaf0d7e1eb4 (diff) | |
download | fuzzycat-6d20157b3c9e9694779dc4f13281c78a79a73aa3.tar.gz fuzzycat-6d20157b3c9e9694779dc4f13281c78a79a73aa3.zip |
Merge branch 'bnewbold-bugfixes' into 'master'
fix tests; dynaconf dependency; handle fatcat API release lookup 404
See merge request webgroup/fuzzycat!3
Diffstat (limited to 'fuzzycat/matching.py')
-rw-r--r-- | fuzzycat/matching.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fuzzycat/matching.py b/fuzzycat/matching.py index 55a5833..683d859 100644 --- a/fuzzycat/matching.py +++ b/fuzzycat/matching.py @@ -7,7 +7,6 @@ import elasticsearch import elasticsearch_dsl import fatcat_openapi_client import requests -from dynaconf import Dynaconf from fatcat_openapi_client import ContainerEntity, DefaultApi, ReleaseEntity from fatcat_openapi_client.rest import ApiException @@ -64,7 +63,13 @@ def match_release_fuzzy( value = getattr(ext_ids, attr) if not value: continue - r = api.lookup_release(**{attr: value}) + try: + r = api.lookup_release(**{attr: value}) + except fatcat_openapi_client.rest.ApiException as err: + if err.status in [404, 400]: + r = None + else: + raise err if r: return [r] |