예제 #1
0
파일: dashboard.py 프로젝트: gthole/gedgo
def _reset_tracking():
    if redis is None:
        return {}

    keys = redis.keys('gedgo_*')
    for key in keys:
        redis.delete(key)

    redis.set('gedgo_tracking_start', int(time.time()))
예제 #2
0
파일: dashboard.py 프로젝트: poszu/gedgo
def _reset_tracking():
    if redis is None:
        return {}

    keys = redis.keys('gedgo_*')
    for key in keys:
        redis.delete(key)

    redis.set('gedgo_tracking_start', int(time.time()))
예제 #3
0
파일: tasks.py 프로젝트: poszu/gedgo
def geo_resolve_ip(ip_address):
    if redis is None:
        return
    try:
        response = requests.get('ipinfo.io/%s/json' % ip_address)
        j = response.json()
        j['requested'] = datetime.utcnow().isoformat()
        redis.set('gedgo_ip_%s', json.dumps(j))
    except (requests.exceptions.RequestsException, ValueError):
        return
예제 #4
0
def geo_resolve_ip(ip_address):
    if redis is None:
        return
    try:
        response = requests.get('ipinfo.io/%s/json' % ip_address)
        j = response.json()
        j['requested'] = datetime.utcnow().isoformat()
        redis.set('gedgo_ip_%s', json.dumps(j))
    except (requests.exceptions.RequestsException, ValueError):
        return
예제 #5
0
def _increment_key(key_name):
    try:
        pvc = int(redis.get(key_name))
    except TypeError:
        pvc = 0
    redis.set(key_name, pvc + 1)