Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ce7040

Browse files
author
Steve Jalim
committed
Amend: httplib PUT doesn't allow for a data payload, so put the API key as a querystring; also provide the Content-Length header, else the request gets a 411 Length Required
1 parent197346f commit9ce7040

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎zencoder/core.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,15 @@ def put(self, url, body=None):
121121
"""
122122
Executes an HTTP PUT request for the given URL
123123
"""
124+
_headers=self.headers.copy()
125+
ifbody:
126+
content_length=str(len(body))
127+
else:
128+
content_length=0
129+
_headers['Content-Length']=str(content_length)
124130
response,content=self.http.request(url,method="PUT",
125131
body=body,
126-
headers=self.headers)
132+
headers=_headers)
127133

128134
returnself.process(response,content)
129135

@@ -307,15 +313,13 @@ def resubmit(self, job_id):
307313
"""
308314
Resubmits a job
309315
"""
310-
data= {'api_key':self.api_key}
311-
returnself.put(self.base_url+'/%s/resubmit'%str(job_id),data=data)
316+
returnself.put(self.base_url+'/%s/resubmit?api_key=%s'% (str(job_id),self.api_key))
312317

313318
defcancel(self,job_id):
314319
"""
315320
Cancels a job
316321
"""
317-
data= {'api_key':self.api_key}
318-
returnself.put(self.base_url+'/%s/cancel'%str(job_id),data=data)
322+
returnself.put(self.base_url+'/%s/cancel?api_key=%s'% (str(job_id),self.api_key))
319323

320324
defdelete(self,job_id):
321325
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp