-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakeURL.py
More file actions
32 lines (23 loc) · 1.27 KB
/
makeURL.py
File metadata and controls
32 lines (23 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# OwlHacks 2020
# Athan Kim
# Program takes in two user inputs as the Latitude and Longitude of the location to be used
# Also takes in the API key
# Program establishes 5 usable functions that fetch the key, latitude, longitude and the radius. Given these parameters, a URL can be created.
import os
def getKey(): # Fetches the key and returns the value
file = open("key.txt", "r")
key1 = file.read()
file.close()
return key1
#def getLati(): # Takes in a user input of the latitude and returns the value
# lati = input("Enter the desired latitude value (N): ")
# return lati
#def getLongi(): # Takes in a user input of the longitude and returns the value
# longi = input("Enter the desired longitude value (W): ");
# return longi
#def getRadius(): # Takes in a user input of miles and converts it to meters and returns the value
# miles = input("Enter the desired mile radius: ")
# meters = float(miles) * 1609.34
# return meters
def generatePlaceSearchCall(key, lati, long, rad): # Takes all established parameters and creates a URL
return "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + str(lati) + "," + str(long) + "&radius=" + str(rad) + "&type=electronics_store&key=" + str(key)