nominatim.py: use async in connect() function

The _async parameter name is only supported since psycopg 2.7.
However, async is a keyword in Python >= 3.7, so using this
gives us a syntax error. Working around this by defining the
parameters in a dict and handing that into the connect function.
This commit is contained in:
Sarah Hoffmann
2020-02-11 22:08:04 +01:00
parent 882f496e0a
commit d1eeaa59a6

View File

@@ -35,9 +35,14 @@ import select
log = logging.getLogger()
def make_connection(options, asynchronous=False):
return psycopg2.connect(dbname=options.dbname, user=options.user,
password=options.password, host=options.host,
port=options.port, async_=asynchronous)
params = {'dbname' : options.dbname,
'user' : options.user,
'password' : options.password,
'host' : options.host,
'port' : options.port,
'async' : asynchronous}
return psycopg2.connect(**params)
class RankRunner(object):