File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 22import httplib2
33from urllib import urlencode
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.
107try :
@@ -61,15 +58,16 @@ def headers(self):
6158 """ Returns default headers, by setting the Content-Type and Accepts
6259 headers.
6360 """
64- if self .as_xml :
65- content_type = 'xml'
66- else :
67- content_type = 'json'
61+ content_type = 'xml' if self .as_xml else '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+ return headers
7371
7472 def encode (self , data ):
7573 """
You can’t perform that action at this time.
0 commit comments