소스 검색

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…
취소
저장