Skip to content

Commit

Permalink
fix PEP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Aasif Khan authored and Aasif Khan committed Sep 25, 2020
1 parent e83ffa9 commit 39c1c87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion openlibrary/plugins/openlibrary/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,9 @@ def most_recent_change():
def get_cover_id(key):
try:
_, cat, oln = key.split('/')
return requests.get('https://covers.openlibrary.org/%s/query?olid=%s&limit=1' % (cat, oln)).json()[0]
return requests.get(
"https://covers.openlibrary.org/%s/query?olid=%s&limit=1" % (cat, oln)
).json()[0]
except (IndexError, json.decoder.JSONDecodeError, TypeError, ValueError):
return None

Expand Down
8 changes: 6 additions & 2 deletions openlibrary/utils/solr.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ def select(self, query, fields=None, facets=None,
logger.info("solr request: %s ...", url)
if not isinstance(payload, bytes):
payload = payload.encode("utf-8")
headers={"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}
jsonData = requests.post(url, data=payload, headers=headers, timeout=10).json()
headers = {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}
jsonData = requests.post(
url, data=payload, headers=headers, timeout=10
).json()
return self._parse_solr_result(
jsonData,
doc_wrapper=doc_wrapper,
Expand Down

0 comments on commit 39c1c87

Please sign in to comment.