Skip to content

Commit e996cb0

Browse files
author
Matthew McClure
committed
Added User-Agent to headers
1 parent 52b4e64 commit e996cb0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

zencoder/core.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import httplib2
33
from urllib import urlencode
44

5+
# Library version. Should probably be rewritten to match the version in setup.py
6+
lib_version = 0.5;
7+
58
# Note: I've seen this pattern for dealing with json in different versions of
69
# python in a lot of modules -- if there's a better way, I'd love to use it.
710
try:
@@ -59,11 +62,13 @@ def headers(self):
5962
headers.
6063
"""
6164
if self.as_xml:
62-
return {'Content-Type': 'application/xml',
63-
'Accepts': 'application/xml'}
64-
else:
65-
return {'Content-Type': 'application/json',
66-
'Accepts': 'application/json'}
65+
content_type = 'xml'
66+
else :
67+
content_type = 'json'
68+
69+
return {'Content-Type': 'application/' + content_type,
70+
'Accepts': 'application/' + content_type,
71+
'User-Agent': 'Zencoder-Py v' + str(lib_version)}
6772

6873
def encode(self, data):
6974
"""

0 commit comments

Comments
 (0)