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

Commit332a704

Browse files
committed
Format headers with.format() instead of string concatenation
1 parentde4e6a4 commit332a704

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

‎zencoder/core.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
importhttplib2
33
fromurllibimporturlencode
44

5-
# Library version. Should probably be rewritten to match the version in setup.py
6-
lib_version=0.5;
7-
85
# Note: I've seen this pattern for dealing with json in different versions of
96
# python in a lot of modules -- if there's a better way, I'd love to use it.
107
try:
@@ -61,15 +58,16 @@ def headers(self):
6158
""" Returns default headers, by setting the Content-Type and Accepts
6259
headers.
6360
"""
64-
ifself.as_xml:
65-
content_type='xml'
66-
else :
67-
content_type='json'
61+
content_type='xml'ifself.as_xmlelse'json'
62+
63+
headers= {
64+
'Content-Type':'application/{0}'.format(content_type),
65+
'Accepts':'application/{0}'.format(content_type),
66+
'Zencoder-Api-Key':self.api_key,
67+
'User-Agent':'zencoder-py'
68+
}
6869

69-
return {'Content-Type':'application/'+content_type,
70-
'Accepts':'application/'+content_type,
71-
'User-Agent':'Zencoder-Py v'+str(lib_version),
72-
'Zencoder-Api-Key':self.api_key}
70+
returnheaders
7371

7472
defencode(self,data):
7573
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp