Skip to content

Commit

Permalink
Removed all API key references
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhishekMarda committed Mar 9, 2021
1 parent d61c9be commit 99c1f3a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ celerybeat-schedule.*
*.sage.py

# Environments
.env
*.env
.venv
env/
venv/
Expand Down
4 changes: 2 additions & 2 deletions knovigo/ladph/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django.db import models

from ..settings import API_KEY
try:
import requests, json
except:
raise ImportError

api_key = "AIzaSyDdpsQ_OSZrVjRIeGoXcCXHbuG2pk1rlKI"
api_key = API_KEY


class Covid_HeatMap_Stats(models.Model):
Expand Down
7 changes: 4 additions & 3 deletions knovigo/ladph/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from django.forms.models import model_to_dict

from .models import Covid_HeatMap_Stats

# get API key
from ..settings import API_KEY

try:
import requests, json
Expand Down Expand Up @@ -186,7 +187,7 @@ def heatMapDataScraper():
return (data, 0)


api_key = "AIzaSyDdpsQ_OSZrVjRIeGoXcCXHbuG2pk1rlKI"
api_key = API_KEY


def make_id_url(place_name):
Expand Down Expand Up @@ -237,7 +238,7 @@ def construct_request(place_name, fields):
input=Westwoord%20Los%20Angeles
&inputtype=textquery
&fields=place_id,geometry
&key=AIzaSyDdpsQ_OSZrVjRIeGoXcCXHbuG2pk1rlKI
&key=hidden
returns (place_id, latitude, longitude)
"""
if isinstance(place_name, str) and len(place_name) != 0:
Expand Down
6 changes: 2 additions & 4 deletions knovigo/places/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from collections import defaultdict
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.gis.geos import Point

from .models import Place, PopularTimes, BusinessHours

from ..settings import API_KEY
# temporary
from django.http import JsonResponse

Expand All @@ -21,9 +20,8 @@
"Diddy Riese": "ChIJD28uC4S8woARUk1Z5qNqmjk", # Westwood Diddy Riese
"BJ's Restaurant & Brewhouse": "ChIJSXU3ioO8woARK-IVICYTrVI", # BJ's Restaurant and Brewery
}
api_key = "AIzaSyDdpsQ_OSZrVjRIeGoXcCXHbuG2pk1rlKI"


api_key = API_KEY
def get_place_data(place_id):
# modify the fields we retrieve
# do we rely more on the populartimes call to reduce redundant
Expand Down
10 changes: 7 additions & 3 deletions knovigo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,28 @@
https://docs.djangoproject.com/en/3.1/ref/settings/
"""

from pathlib import Path
import os
from pathlib import Path
from dotenv import load_dotenv
from pathlib import Path
env_path = Path('..') / 'knovigo-dev.env'
load_dotenv(dotenv_path=env_path)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "$+&8$i#*#+d$^2+b!y^ykydxh1$@#t^$7y@#3h^6f5^pnqgoct"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = os.getenv('DEBUG')

ALLOWED_HOSTS = []

API_KEY = os.getenv(('APIKEY'))
# Application definition

INSTALLED_APPS = [
Expand Down
5 changes: 5 additions & 0 deletions knovigo/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from dotenv import load_dotenv
from pathlib import Path
env_path = Path('..') / 'knovigo-dev.env'
load_dotenv(dotenv_path=env_path)

"""
WSGI config for knovigo project.
Expand Down
5 changes: 5 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env python
from dotenv import load_dotenv
from pathlib import Path
env_path = Path('.') / 'knovigo-dev.env'
load_dotenv(dotenv_path=env_path)

"""Django's command-line utility for administrative tasks."""
import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ git+https://github.com/m-wrzr/populartimes
django-crontab>=0.7.1
geopy
beautifulsoup4>=4.9.3

python-dotenv>=0.15.0

0 comments on commit 99c1f3a

Please sign in to comment.