1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-26 20:47:10 +00:00

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

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"] = \