# Path: tracker/views.py
# def geocode(location):
#     key = settings.GOOGLE_API_KEY
#     output = "csv"
#     location = urllib.quote_plus(location)
#     request = "http://maps.google.com/maps/geo?q=%s&output=%s&key=%s" % (location, output, key)
#     data = urllib.urlopen(request).read()
#     dlist = data.split(',')
#     if dlist[0] == '200':
#         return (float(dlist[2]), float(dlist[3]))
#     else:
#         return None


from tracker.views import geocode
from django.contrib.gis.geos.geometries import Point
from django.core.management.base import BaseCommand
import sys


class Command(BaseCommand):
    help = "Geocode an address"

    def handle(self, address, **kw):

# Path: tracker/views.py
# def geocode(location):
#     key = settings.GOOGLE_API_KEY
#     output = "csv"
#     location = urllib.quote_plus(location)
#     request = "http://maps.google.com/maps/geo?q=%s&output=%s&key=%s" % (location, output, key)
#     data = urllib.urlopen(request).read()
#     dlist = data.split(',')
#     if dlist[0] == '200':
#         return (float(dlist[2]), float(dlist[3]))
#     else:
#         return None


# Path: tracker/management/commands/geocode.py
from tracker.views import geocode
from django.contrib.gis.geos.geometries import Point
from django.core.management.base import BaseCommand
import sys



class Command(BaseCommand):
    help = "Geocode an address"

    def handle(self, address, **kw):

        print geocode(address)