Incorrect use of Authorization header

This commit is contained in:
Yohann D'ANELLO 2020-10-03 15:41:49 +02:00
parent 91aeb28c3a
commit 263b4cff77
1 changed files with 2 additions and 1 deletions

View File

@ -97,7 +97,8 @@ class MediaAdminForm(ModelForm):
req.add_header("Authorization", os.getenv("ISBNDB_KEY")) req.add_header("Authorization", os.getenv("ISBNDB_KEY"))
with urllib.request.urlopen(req) as url: with urllib.request.urlopen(req) as url:
data = json.loads(url.read().decode()) data = json.loads(url.read().decode())
self.cleaned_data["title"] = data["title_long"] print(data)
self.cleaned_data["title"] = data["title"]
self.cleaned_data["published_date"] = data["date_published"][:10] self.cleaned_data["published_date"] = data["date_published"][:10]
self.cleaned_data["number_of_pages"] = data["pages"] self.cleaned_data["number_of_pages"] = data["pages"]
self.cleaned_data["authors"] = \ self.cleaned_data["authors"] = \