Merge branch 'bugfix/2-fail-on-unavailable-resource' of snegov/nevernote into master
This commit is contained in:
commit
fe6c0c74a7
@ -21,8 +21,12 @@ def get_text(url):
|
|||||||
|
|
||||||
def get_embedded_binary(url):
|
def get_embedded_binary(url):
|
||||||
"""Download content from URL and return bytes if target is image"""
|
"""Download content from URL and return bytes if target is image"""
|
||||||
response = requests.get(url)
|
try:
|
||||||
response.raise_for_status()
|
response = requests.get(url)
|
||||||
|
response.raise_for_status()
|
||||||
|
except requests.exceptions.RequestException:
|
||||||
|
return ''
|
||||||
|
|
||||||
ctype = response.headers.get('Content-Type')
|
ctype = response.headers.get('Content-Type')
|
||||||
data = response.content
|
data = response.content
|
||||||
b64pict = base64.b64encode(data).decode()
|
b64pict = base64.b64encode(data).decode()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user