Skip to content

Instantly share code, notes, and snippets.

@ingenieroariel
Created June 17, 2010 13:36
Show Gist options
  • Save ingenieroariel/442132 to your computer and use it in GitHub Desktop.
Save ingenieroariel/442132 to your computer and use it in GitHub Desktop.
import redis
import json
cache = redis.Redis(host='localhost', port=6379, db=0)
keys = cache.keys().split(" ")
out = {}
bogota = open('bogota.txt', 'w')
for key in keys:
try:
sitio = json.loads(cache.get(key))[key]
if sitio[0] == "BOGOTA D.C.":
nombre = sitio[2]
direccion = sitio[3]
salida = '"%s", "%s"\n' % ( sitio[2], sitio[3].replace("&ndash", "-" ))
out[str(salida)] = salida
except:
pass
for key in out.values():
bogota.write(key)
bogota.close()
#sudo apt-get install redis-server git-core python-pip
#pip install -e git+http://github.com/andymccurdy/redis-py.git#egg=redis
#sudo /etc/init.d/redis-server stop
#sudo cp the_dump.rdb /var/lib/redis/dump.rdb
#sudo chown redis:redis /var/lib/dump.rdb
#sudo /etc/init.d/redis-server start
import redis
cache = redis.Redis(host='localhost', port=6379, db=0)
keys = cache.keys().split(" ")
for key in keys:
sitio = cache.get(key)
print sitio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment