mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
corrected handling with http response headers
This commit is contained in:
parent
f1ce7c0cf9
commit
8dddfb9c05
@ -85,7 +85,7 @@ class LitResStore(BasicStoreConfig, StorePlugin):
|
|||||||
|
|
||||||
sRes = SearchResult()
|
sRes = SearchResult()
|
||||||
sRes.drm = SearchResult.DRM_UNLOCKED
|
sRes.drm = SearchResult.DRM_UNLOCKED
|
||||||
sRes.detail_item = data.xpath(xp_template.format('hub_id'))
|
sRes.detail_item = data.xpath(xp_template.format('hub_id'))
|
||||||
sRes.title = data.xpath('string(.//title-info/book-title/text()|.//publish-info/book-name/text())')
|
sRes.title = data.xpath('string(.//title-info/book-title/text()|.//publish-info/book-name/text())')
|
||||||
# aut = concat('.//title-info/author/first-name', ' ')
|
# aut = concat('.//title-info/author/first-name', ' ')
|
||||||
authors = data.xpath('.//title-info/author/first-name/text()|'
|
authors = data.xpath('.//title-info/author/first-name/text()|'
|
||||||
@ -121,7 +121,7 @@ def format_price_in_RUR(price):
|
|||||||
|
|
||||||
def ungzipResponse(r,b):
|
def ungzipResponse(r,b):
|
||||||
headers = r.info()
|
headers = r.info()
|
||||||
if headers['Content-Encoding']=='gzip':
|
if headers.get('Content-Encoding', '')=='gzip':
|
||||||
import gzip
|
import gzip
|
||||||
gz = gzip.GzipFile(fileobj=r, mode='rb')
|
gz = gzip.GzipFile(fileobj=r, mode='rb')
|
||||||
data = gz.read()
|
data = gz.read()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user