From: Radek Czajka Date: Thu, 28 May 2020 11:13:40 +0000 (+0200) Subject: YT: Make sure responses ok. X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/92b8c94392a9c0c19cce15251cd64f91d2786270?ds=inline;hp=a07174f03214b000dcd01c31b6d397a85b15e82f YT: Make sure responses ok. --- diff --git a/src/apiclient/models.py b/src/apiclient/models.py index cc40143..49403f0 100644 --- a/src/apiclient/models.py +++ b/src/apiclient/models.py @@ -57,11 +57,14 @@ class YouTubeToken(models.Model): 'x-upload-content-type': 'application/octet-stream', } if resumable_file_path else {} ) + response.raise_for_status() if resumable_file_path: location = response.headers['Location'] with open(resumable_file_path, 'rb') as f: - return session.put( + response = session.put( url=location, data=StreamingIterator(file_size, f), headers={"Content-Type": "application/octet-stream"}, ) + response.raise_for_status() + return response