Skip to content

Commit

Permalink
Merge pull request #75 from pgamez/dev
Browse files Browse the repository at this point in the history
Fixes getting host/port values from config file
  • Loading branch information
long2ice authored Jul 27, 2023
2 parents 70ecaf4 + 5c3d5e8 commit 044a4b0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions asyncmy/connection.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ class Connection:
*,
user=None, # The first four arguments is based on DB-API 2.0 recommendation.
password="",
host='localhost',
host=None,
database=None,
unix_socket=None,
port=3306,
port=0,
charset="",
sql_mode=None,
read_default_file=None,
Expand Down Expand Up @@ -234,8 +234,8 @@ class Connection:
self._echo = echo
self._last_usage = self._loop.time()

self._host = host
self._port = port
self._host = host or "localhost"
self._port = port or 3306
if type(self._port) is not int:
raise ValueError("port should be of type int")
self._user = user or DEFAULT_USER
Expand Down Expand Up @@ -296,7 +296,7 @@ class Connection:
self._connected = False
self._reader: Optional[StreamReader] = None
self._writer: Optional[StreamWriter] = None

def _create_ssl_ctx(self, sslp):
if isinstance(sslp, ssl.SSLContext):
return sslp
Expand Down Expand Up @@ -1277,10 +1277,10 @@ class LoadLocalFile:

def connect(user=None,
password="",
host='localhost',
host=None,
database=None,
unix_socket=None,
port=3306,
port=0,
charset="",
sql_mode=None,
read_default_file=None,
Expand Down

0 comments on commit 044a4b0

Please sign in to comment.