Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e31cb98

Browse files
author
Yuhan ZOU
committed
Release 1.3.2
1 parent 8d598e0 commit e31cb98

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

sensorsanalytics/sdk.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import urllib2
1919
import urllib
2020

21-
SDK_VERSION = '1.3.1'
21+
SDK_VERSION = '1.3.2'
2222

2323
try:
2424
isinstance("", basestring)
@@ -510,22 +510,22 @@ class DebugConsumer(object):
510510
具体的说明在http://www.sensorsdata.cn/manual/
511511
"""
512512

513-
def __init__(self, debug_url_prefix, debug_write_data=True, request_timeout=None):
513+
def __init__(self, url_prefix, write_data=True, request_timeout=None):
514514
"""
515515
初始化Consumer
516-
:param debug_url_prefix: 服务器提供的用于Debug的API的URL地址,特别注意,它与导入数据的API并不是同一个
517-
:param debug_write_data: 发送过去的数据,是真正写入,还是仅仅进行检查
516+
:param url_prefix: 服务器提供的用于Debug的API的URL地址,特别注意,它与导入数据的API并不是同一个
517+
:param write_data: 发送过去的数据,是真正写入,还是仅仅进行检查
518518
:param request_timeout:请求的超时时间,单位毫秒
519519
:return:
520520
"""
521521
import urlparse
522-
debug_url_path = urlparse.urlparse(debug_url_prefix).path
523-
if not debug_url_path.endswith('debug'):
524-
print('please init with debug API url.')
525-
raise SensorsAnalyticsDebugException()
526-
self._debug_url_prefix = debug_url_prefix
522+
debug_url = urlparse.urlparse(url_prefix)
523+
## 将 URI Path 替换成 Debug 模式的 '/debug'
524+
debug_url = debug_url._replace(path = '/debug')
525+
526+
self._debug_url_prefix = debug_url.geturl()
527527
self._request_timeout = request_timeout
528-
self._debug_write_data = debug_write_data
528+
self._debug_write_data = write_data
529529

530530
@staticmethod
531531
def _gzip_string(data):

0 commit comments

Comments
 (0)