from flask import Flask, jsonify, request
import os
import requests

app = Flask(__name__)

stuff = {'theFirst': 1,
            'theSecond': 2}

DARK_URL = 'https://api.darksky.net/forecast/%s/%s,%s?exclude=[daily,hourly,minutely,alerts,flags]'
OPEN_URL = 'http://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&APPID=%s'
LAT = '40.7128'
LONG = '-74.0059'


@app.route('/')
def root():
    lat = request.args.get('lat', LAT)
    long = request.args.get('long', LONG)
    service = request.args.get('service', 'dark')
    if service == 'dark':
        return jsonify(get_dark_weather(lat, long))
    elif service == 'open':
        return jsonify(get_open_weather(lat, long))
    else:
        return "did you make a mistake?"



def get_dark_weather(lat, long):
    r = requests.get(DARK_URL %(os.environ.get('DARK_API_KEY'), lat, long))
    return r.json()

def get_open_weather(lat, long):
    r = requests.get(OPEN_URL %(lat, long, os.environ.get('OPEN_API_KEY')))
    return r.json()
@@ -393,379 +393,217 @@
     
-lat = request.args.get('lat', LAT)%0A    long = request.args.get('long', LONG)%0A    service = request.args.get('service', 'dark')%0A    if service == 'dark':%0A        return jsonify(get_dark_weather(lat, long))%0A    elif service == 'open':%0A        return jsonify(get_open_weather(
+return %22Hi, this is my site to redirect weather API calls so I can deploy on codepen%22%0A%0A@app.route('/dark')%0Adef get_dark_weather():%0A    lat = request.args.get('
 lat
+'
 , 
-long)
+LAT
 )%0A    
-else:%0A        return %22did you make a mistake?%22%0A%0A%0A%0Adef get_dark_weather(lat, long):
+lon = request.args.get('lon', LONG)
 %0A   
@@ -671,17 +671,16 @@
 lat, lon
-g
 ))%0A    r
@@ -695,16 +695,36 @@
 json()%0A%0A
+@app.route('/open')%0A
 def get_
@@ -748,16 +748,95 @@
  long):%0A
+    lat = request.args.get('lat', LAT)%0A    lon = request.args.get('lon', LONG)%0A
     r = 
@@ -867,17 +867,16 @@
 lat, lon
-g
 , os.env

refactor into 2 endpionts