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

Commite996cb0

Browse files
author
Matthew McClure
committed
Added User-Agent to headers
1 parent52b4e64 commite996cb0

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
importhttplib2
33
fromurllibimporturlencode
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
ifself.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
defencode(self,data):
6974
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp