mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user