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

Commitd57c7f6

Browse files
committed
make headers a property method on HTTPBackend
1 parent8d8e19d commitd57c7f6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎zencoder/core.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ def content_length(self, body):
5656
"""
5757
returnstr(len(body))ifbodyelse"0"
5858

59+
@property
60+
defheaders(self):
5961
ifself.as_xml:
60-
self.headers= {'Content-Type':'application/xml',
61-
'Accepts':'application/xml'}
62+
return {'Content-Type':'application/xml',
63+
'Accepts':'application/xml'}
6264
else:
63-
self.headers= {'Content-Type':'application/json',
64-
'Accepts':'application/json'}
65+
return {'Content-Type':'application/json',
66+
'Accepts':'application/json'}
6567

6668
defencode(self,data):
6769
"""
@@ -117,6 +119,7 @@ def post(self, url, body=None):
117119
"""
118120
Executes an HTTP POST request for the given URL
119121
"""
122+
headers=self.headers
120123
headers['Content-Length']=self.content_length(body)
121124
response,content=self.http.request(url,method="POST",
122125
body=body,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp