apply PEP8 standards
This commit is contained in:
parent
a679054a0d
commit
d544b5228d
@ -26,7 +26,6 @@ def main():
|
|||||||
connection.commit()
|
connection.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def load_data_into_database(cursor, data):
|
def load_data_into_database(cursor, data):
|
||||||
if "timed_out" not in data:
|
if "timed_out" not in data:
|
||||||
print(json.dumps(data, indent=4))
|
print(json.dumps(data, indent=4))
|
||||||
@ -93,11 +92,13 @@ def load_data_into_database(cursor, data):
|
|||||||
show_dictionary(entry)
|
show_dictionary(entry)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
def date_in_future(date):
|
def date_in_future(date):
|
||||||
if date == None:
|
if date == None:
|
||||||
return False
|
return False
|
||||||
return date > datetime.datetime.now()
|
return date > datetime.datetime.now()
|
||||||
|
|
||||||
|
|
||||||
def query(search_after):
|
def query(search_after):
|
||||||
headers = {
|
headers = {
|
||||||
'X-API-AllowRequest': os.environ['PLANNNING_DATA_API_ALLOW_REQUEST_CODE'],
|
'X-API-AllowRequest': os.environ['PLANNNING_DATA_API_ALLOW_REQUEST_CODE'],
|
||||||
@ -141,6 +142,7 @@ def query(search_after):
|
|||||||
print(json_data)
|
print(json_data)
|
||||||
return requests.post('https://planningdata.london.gov.uk/api-guest/applications/_search', headers=headers, json=json_data)
|
return requests.post('https://planningdata.london.gov.uk/api-guest/applications/_search', headers=headers, json=json_data)
|
||||||
|
|
||||||
|
|
||||||
def get_connection():
|
def get_connection():
|
||||||
return psycopg2.connect(
|
return psycopg2.connect(
|
||||||
host=os.environ['PGHOST'],
|
host=os.environ['PGHOST'],
|
||||||
@ -149,9 +151,11 @@ def get_connection():
|
|||||||
password=os.environ['PGPASSWORD']
|
password=os.environ['PGPASSWORD']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def filepath():
|
def filepath():
|
||||||
return os.path.dirname(os.path.realpath(__file__)) + os.sep + "data.json"
|
return os.path.dirname(os.path.realpath(__file__)) + os.sep + "data.json"
|
||||||
|
|
||||||
|
|
||||||
def insert_entry(cursor, e):
|
def insert_entry(cursor, e):
|
||||||
try:
|
try:
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
@ -255,6 +259,7 @@ def obtain_entry_link(provided_link, application_id):
|
|||||||
return None
|
return None
|
||||||
# Richmond is simply broken
|
# Richmond is simply broken
|
||||||
|
|
||||||
|
|
||||||
def process_status(status, decision_date):
|
def process_status(status, decision_date):
|
||||||
"""return None if status is invalid"""
|
"""return None if status is invalid"""
|
||||||
if status in ["Application Under Consideration", "Application Received"]:
|
if status in ["Application Under Consideration", "Application Received"]:
|
||||||
@ -281,5 +286,6 @@ def process_status(status, decision_date):
|
|||||||
return None
|
return None
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user