Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-04-10 16:07:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0000c945ea2c7911af123c1fdf80d0c9ecbe0c6c
0000c945
1 parent
fe1886aa
refine the proxy api server.
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
13 行增加
和
8 行删除
trunk/research/api-server/server.py
trunk/research/api-server/server.py
查看文件 @
0000c94
...
...
@@ -36,7 +36,7 @@ reload(sys)
exec
(
"sys.setdefaultencoding('utf-8')"
)
assert
sys
.
getdefaultencoding
()
.
lower
()
==
"utf-8"
import
os
,
json
,
time
,
datetime
,
cherrypy
,
threading
import
os
,
json
,
time
,
datetime
,
cherrypy
,
threading
,
urllib2
# simple log functions.
def
trace
(
msg
):
...
...
@@ -329,14 +329,19 @@ class RESTProxy(object):
def
GET
(
self
,
*
args
,
**
kwargs
):
enable_crossdomain
()
hls
=
{
"args"
:
args
,
"kwargs"
:
kwargs
}
url
=
"http://"
+
"/"
.
join
(
args
);
print
"start to proxy url:
%
s"
%
url
ret
=
json
.
dumps
(
hls
)
print
ret
return
ret
f
=
None
try
:
f
=
urllib2
.
urlopen
(
url
)
f
.
read
()
except
:
print
"error proxy url:
%
s"
%
url
finally
:
if
f
:
f
.
close
()
print
"completed proxy url:
%
s"
%
url
return
url
'''
handle the hls requests: hls stream.
...
...
请
注册
或
登录
后发表评论