|
|
|
@ -115,12 +115,14 @@ class Publications(Bureau):
|
|
|
|
|
"""
|
|
|
|
|
shortcode, _ = data.split(".")
|
|
|
|
|
with self.dbenv.begin(db=self.urldb) as txn:
|
|
|
|
|
print("looking up short-code:", shortcode)
|
|
|
|
|
url = txn.get(shortcode.encode('utf-8')).decode()
|
|
|
|
|
self.log.debug("looking up short-code:" + shortcode)
|
|
|
|
|
url = txn.get(shortcode.encode('utf-8'))
|
|
|
|
|
|
|
|
|
|
if not url:
|
|
|
|
|
print("ERROR: no valid URL in db for short code: ", shortcode)
|
|
|
|
|
self.log.warning("no valid URL in db for short code: " + shortcode)
|
|
|
|
|
return
|
|
|
|
|
else:
|
|
|
|
|
url = url.decode()
|
|
|
|
|
|
|
|
|
|
# download
|
|
|
|
|
headers = {'User-Agent': 'Mozilla/5.0'}
|
|
|
|
|