apply PEP8 standards

This commit is contained in:
Mateusz Konieczny 2022-11-10 08:28:44 +01:00
parent a679054a0d
commit d544b5228d

View File

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