Skip to content

Commit 9f06d60

Browse files
committed
Merge branch '0.1.2'
2 parents e47ea53 + 321c10e commit 9f06d60

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

netuitive/client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
except ImportError:
1010
import urllib2
1111

12+
try:
13+
from urllib.parse import urlparse
14+
except ImportError:
15+
from urlparse import urlparse
16+
1217

1318
class Client(object):
1419

@@ -33,6 +38,8 @@ def __init__(self, url='https://api.app.netuitive.com/ingest',
3338
self.url = url
3439
self.api_key = api_key
3540
self.dataurl = self.url + '/' + self.api_key
41+
self.timeurl = '{uri.scheme}://{uri.netloc}/time'.format(
42+
uri=urlparse(url))
3643
self.eventurl = self.dataurl.replace('/ingest/', '/ingest/events/', 1)
3744
self.agent = agent
3845
self.max_metrics = 10000
@@ -116,7 +123,7 @@ def post_event(self, event):
116123
self.eventurl, e)
117124

118125
def check_time_offset(self, epoch=None):
119-
req = urllib2.Request(self.url)
126+
req = urllib2.Request(self.timeurl)
120127
req.get_method = lambda: 'HEAD'
121128
resp = urllib2.urlopen(req)
122129
rdate = resp.info()['Date']

0 commit comments

Comments
 (0)