|
|
|
|
|
|
|
|
json['ops:world-patent-data']['ops:document-inquiry']['ops:inquiry-result']['ops:document-instance'] |
|
|
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'] |
|
|
document_instances = json['ops:world-patent-data']['ops:document-inquiry']['ops:inquiry-result']['ops:document-instance'] |
|
|
try: |
|
|
try: |
|
|
document_instances[1] |
|
|
|
|
|
|
|
|
document_instances[0] |
|
|
for document_instance in document_instances: |
|
|
for document_instance in document_instances: |
|
|
if document_instance['@desc'] == 'Drawing': |
|
|
if document_instance['@desc'] == 'Drawing': |
|
|
drawings_url = ops_url_images + '3.2/rest-services/' + document_instance['@link'] + '?Range=1' |
|
|
drawings_url = ops_url_images + '3.2/rest-services/' + document_instance['@link'] + '?Range=1' |
|
|
|
|
|
|
|
|
except KeyError: |
|
|
except KeyError: |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
if drawings_url is not None: |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
drawings_url[0] |
|
|
|
|
|
|
|
|
# set up API call |
|
|
# set up API call |
|
|
headers = {"Authorization": "Bearer " + access_token, "Accept": "application/tiff"} |
|
|
headers = {"Authorization": "Bearer " + access_token, "Accept": "application/tiff"} |
|
|
|
|
|
|
|
|
base64_bytes = base64.b64encode(png_blob) |
|
|
base64_bytes = base64.b64encode(png_blob) |
|
|
output['image'] = base64_bytes.decode("ascii") |
|
|
output['image'] = base64_bytes.decode("ascii") |
|
|
|
|
|
|
|
|
|
|
|
except KeyError: |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
except KeyError: |
|
|
except KeyError: |
|
|
pass |
|
|
pass |
|
|
|
|
|
|