Permalink
Browse files

new tracker method, killing it

  • Loading branch information...
1 parent 488daae commit eb283609ac4073bfeaba7fab18f7b06c1a744d39 @linked committed May 14, 2012
Showing with 29 additions and 2 deletions.
  1. +1 −1 hailwhale/periods.py
  2. +27 −0 hailwhale/wsgi.py
  3. +1 −1 setup.py
View
@@ -172,7 +172,7 @@ def get(name=None):
return name
if name and name in PERIOD_NICKS:
return PERIOD_NICKS[str(name)]
- if not name:
+ if not name or name == 'None':
name = Period.default_size()
return Period.all_sizes_dict()[str(name)]
View
@@ -100,6 +100,33 @@ def plotpoints():
return whale.plotpoints(**params)
+@route('/tracker')
+def tracker():
+ from periods import Period
+ import random
+ params = default_params()
+ # LOLOL THIS SHOULD REALLY CHANGE
+ key = 'hailwhale_weak_aes_key_pixel'
+ if not 'pk' in params and 'pixel' in params:
+ from Crypto.Cipher import AES
+ mode = AES.MODE_CBC
+ encryptor = AES.new(key, mode)
+ text = g('pixel')
+ params['pk'] = encryptor.decrypt(text)
+ pk = params['pk']
+ whale = Whale()
+ hail = Hail()
+ val = whale.count_now(at=times.now(), **params)
+ uid = g('uid')
+ if not uid or uid == '_new':
+ default = random.randrange(10**6,10**9)
+ uid = str(req.get_cookie('uid', str(default), key))
+ hail.spy_log(uid, params)
+ response.set_cookie('uid', uid, key)
+ return str(uid)
+
+
+
@route('/graph.js')
def graph():
from periods import Period
View
@@ -28,6 +28,6 @@
long_description=LONG_DESCRIPTION,
platforms=['any'],
classifiers=CLASSIFIERS,
- install_requires = ['bottle', 'redis', 'times'],
+ install_requires = ['bottle', 'redis', 'times', 'pycrypto'],
version='1.3.3',
)

0 comments on commit eb28360

Please sign in to comment.