https://developers.google.com/maps/documentation/geocoding/get-api-key
import httplib2
import json
def getGeocodeLocation(inputString):
google_api_key = "your_key"
locationString = inputString.replace(" ", "+")
url = ('https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s'% (
locationString, google_api_key))
h = httplib2.Http()
response, content = h.request(url, 'GET')
result = json.loads(content)
latitude = result['result'][0]['geometry']['location']['lat']
longitude = result['result'][0]['geometry']['location']['lng']
return(latitude,longitude)
flask
from flask import Flask app = Flask(__name__) def puppyFunction(): return "Yes, puppies!" def puppiesFunction(id) return "This method will act on the puppy with id %s" % id if __name__ == '__main__': app.debug = True app.run(host='0.0.0.0', port=5000)
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy import create_engine
from passlib.apps import custom_app_context as pwd_context
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
username = Column(String(32), index=True)
password_hash = Column(String(64))
engine = create_engine('sqlite:///users.db')