Преглед на файлове

fixing issue with image calls

solr_update
Simon Bowie преди 2 години
родител
ревизия
bd8af65498
променени са 1 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. +6
    -2
      web/app/ops.py

+ 6
- 2
web/app/ops.py Целия файл

@@ -119,7 +119,7 @@ def get_images(doc_ref):
json['ops:world-patent-data']['ops:document-inquiry']['ops:inquiry-result']['ops:document-instance']
document_instances = json['ops:world-patent-data']['ops:document-inquiry']['ops:inquiry-result']['ops:document-instance']
try:
document_instances[1]
document_instances[0]
for document_instance in document_instances:
if document_instance['@desc'] == 'Drawing':
drawings_url = ops_url_images + '3.2/rest-services/' + document_instance['@link'] + '?Range=1'
@@ -130,7 +130,8 @@ def get_images(doc_ref):
except KeyError:
pass

if drawings_url is not None:
try:
drawings_url[0]

# set up API call
headers = {"Authorization": "Bearer " + access_token, "Accept": "application/tiff"}
@@ -144,6 +145,9 @@ def get_images(doc_ref):
base64_bytes = base64.b64encode(png_blob)
output['image'] = base64_bytes.decode("ascii")

except KeyError:
pass

except KeyError:
pass


Loading…
Отказ
Запис