server/api_class.py
def run_search_center(search_query: str) -> tuple:
    ''' this function runs the search and retrieves the long and lat from OSM'''
    result = API('https://nominatim.openstreetmap.org/')
    url = result.build_search_url(search_query)

    latitude = 0
    longitude = 0
    # validate URL
    status = result.get_status(url)
    incorrect_format = result.check_incorrect_format(url)
    network_error = result.check_network_error(url)

    if status != 200 or incorrect_format or network_error:
        print('FAILED')
        print(status, url)

        print('format', incorrect_format)
        print('network', network_error)
        if status != 200:
            print('NOT 200')
        elif incorrect_format:
            print('FORMAT')
        elif network_error:
            print('NETWORK')

        return latitude, longitude

    # if url is valid, continue finding lat and long
    else:
   
        result = result.get_result(url)
        data = Nominatim_API_Data(result)

        latitude = data.get_lat() 
        longitude = data.get_lon()
    
        return latitude, longitude
 this function runs the search and retrieves the long and lat from OSM
this function runs the search and retrieves the long and lat from OSM
this function runs the search and retrieves the long and lat from OSM
def run_search_center(search_query: str) -> tuple:
    result = API('https://nominatim.openstreetmap.org/')
    url = result.build_search_url(search_query)
    latitude = 0
    longitude = 0
    status = result.get_status(url)
    incorrect_format = result.check_incorrect_format(url)
    network_error = result.check_network_error(url)
    if status != 200 or incorrect_format or network_error:
        print('FAILED')
        print(status, url)
        print('format', incorrect_format)
        print('network', network_error)
        if status != 200:
            print('NOT 200')
        elif incorrect_format:
            print('FORMAT')
        elif network_error:
            print('NETWORK')
        return latitude, longitude
    else:
        result = result.get_result(url)
        data = Nominatim_API_Data(result)
        latitude = data.get_lat() 
        longitude = data.get_lon()
        return latitude, longitude
def run_search_center ( search_query : str ) -> tuple : result = API ( 'https://nominatim.openstreetmap.org/' ) url = result . build_search_url ( search_query ) latitude = 0 longitude = 0 status = result . get_status ( url ) incorrect_format = result . check_incorrect_format ( url ) network_error = result . check_network_error ( url ) if status != 200 or incorrect_format or network_error : print ( 'FAILED' ) print ( status , url ) print ( 'format' , incorrect_format ) print ( 'network' , network_error ) if status != 200 : print ( 'NOT 200' ) elif incorrect_format : print ( 'FORMAT' ) elif network_error : print ( 'NETWORK' ) return latitude , longitude else : result = result . get_result ( url ) data = Nominatim_API_Data ( result ) latitude = data . get_lat ( ) longitude = data . get_lon ( ) return latitude , longitude
this function runs the search and retrieves the long and lat from OSM
this function runs the search and retrieves the long and lat from OSM
''' this function runs the search and retrieves the long and lat from OSM''' # validate URL # if url is valid, continue finding lat and long
search_query
str