fnp
/
audio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set license constants.
[audio.git]
/
src
/
apiclient
/
models.py
diff --git
a/src/apiclient/models.py
b/src/apiclient/models.py
index
ae8c74a
..
07f804f
100644
(file)
--- a/
src/apiclient/models.py
+++ b/
src/apiclient/models.py
@@
-37,24
+37,27
@@
class YouTubeToken(models.Model):
token_updater=self.token_updater
)
token_updater=self.token_updater
)
- def call(self, method, url, params=None,
data=None, media
_data=None):
+ def call(self, method, url, params=None,
json=None, data=None, resumable
_data=None):
params = params or {}
params = params or {}
- params['uploadType'] = 'resumable'
+ if resumable_data:
+ params['uploadType'] = 'resumable'
session = self.get_session()
response = session.request(
method=method,
url=url,
session = self.get_session()
response = session.request(
method=method,
url=url,
- json=data,
+ json=json,
+ data=data,
params=params,
headers={
params=params,
headers={
- 'X-Upload-Content-Length': str(len(
media
_data)),
+ 'X-Upload-Content-Length': str(len(
resumable
_data)),
'x-upload-content-type': 'application/octet-stream',
'x-upload-content-type': 'application/octet-stream',
- }
- )
- location = response.headers['Location']
- return session.put(
- url=location,
- data=media_data,
- headers={"Content-Type": "application/octet-stream"},
+ } if resumable_data else {}
)
)
+ if resumable_data:
+ location = response.headers['Location']
+ return session.put(
+ url=location,
+ data=resumable_data,
+ headers={"Content-Type": "application/octet-stream"},
+ )