jmathai / elodie

An EXIF-based photo assistant, organizer and workflow automation tool.
https://bit.ly/introducing-elodie
Apache License 2.0
1.25k stars 137 forks source link

api key generation fails #436

Closed amit-handa closed 1 year ago

amit-handa commented 1 year ago

Hi, thanks for creating the product. it feels it fits my requirements to a tee. I am unable to generate free api key from mapquest. is there anything I am missing ? I get 500 error while generating it :( have added a support issue to mapquest as wel.

thanks,

jmathai commented 1 year ago

I haven't generated one in years as my original one still works. If you hear back from MapQuest support then please update this bug.

clach04 commented 1 year ago

@amit-handa I had a similar experience, keep trying ;-)

In the meantime, a lower quality solution is to hack in local geo lookup, using reverse_geocoder - https://github.com/thampiman/reverse-geocoder

Hack elodie/geolocation.py

to add

import reverse_geocoder

Then replace lookup() - or simply add an additional function to replace the existing one (you can monkey patch this too):

def lookup_hardcoded_reverse_geocoder(**kwargs):
    if(
        'location' not in kwargs and
        'lat' not in kwargs and
        'lon' not in kwargs
    ):
        return None
    if 'location' in kwargs:
        raise NotImplemented()
    coordinates = [(kwargs['lat'], kwargs['lon'])]
    #results = reverse_geocoder.search(coordinates)
    results = reverse_geocoder.search(coordinates, mode=1)  # non-parrellel mode, avoid multiprocessing RuntimeError fork error(s)
    result = {
        'address': {
            'country': results[0]['cc'],
            'state': results[0]['admin1'],  # potentiall could do 'admin2' - for US lookup of (37.368, -122.03) not recommended
            'default': results[0]['admin1'],  # potentiall could do 'admin2' - for US lookup of (37.368, -122.03) not recommended
            'city': results[0]['name'],
        }
    }
    return result

# hack
lookup = lookup_hardcoded_reverse_geocoder
amit-handa commented 1 year ago

Thanks for responding. mapquest support is responsive (thank god !). I was able to get the key, had to recreate the account.

root cause is to use https://developer.mapquest.com rather than http://.. version. latter is obsolete (not sure why they still expose it though, but I aint complaining for anything I get free)