|
2 | 2 | importhttplib2
|
3 | 3 | fromurllibimporturlencode
|
4 | 4 |
|
5 |
| -# Library version. Should probably be rewritten to match the version in setup.py |
6 |
| -lib_version=0.5; |
7 |
| - |
8 | 5 | # Note: I've seen this pattern for dealing with json in different versions of
|
9 | 6 | # python in a lot of modules -- if there's a better way, I'd love to use it.
|
10 | 7 | try:
|
@@ -61,15 +58,16 @@ def headers(self):
|
61 | 58 | """ Returns default headers, by setting the Content-Type and Accepts
|
62 | 59 | headers.
|
63 | 60 | """
|
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 | + } |
68 | 69 |
|
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 |
73 | 71 |
|
74 | 72 | defencode(self,data):
|
75 | 73 | """
|
|