cloud-sql-python-connector 1.3.0__tar.gz → 1.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/PKG-INFO +1 -1
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/cloud_sql_python_connector.egg-info/PKG-INFO +1 -1
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/cloud_sql_python_connector.egg-info/SOURCES.txt +1 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/cloud_sql_python_connector.egg-info/requires.txt +2 -2
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/connector.py +1 -1
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/instance.py +4 -7
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/pg8000.py +9 -8
- cloud-sql-python-connector-1.4.1/google/cloud/sql/connector/py.typed +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/version.py +1 -1
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/setup.py +3 -2
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/LICENSE +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/README.md +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/cloud_sql_python_connector.egg-info/dependency_links.txt +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/cloud_sql_python_connector.egg-info/namespace_packages.txt +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/cloud_sql_python_connector.egg-info/not-zip-safe +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/cloud_sql_python_connector.egg-info/top_level.txt +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/__init__.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/__init__.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/__init__.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/__init__.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/asyncpg.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/exceptions.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/pymysql.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/pytds.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/rate_limiter.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/refresh_utils.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/connector/utils.py +0 -0
- {cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloud-sql-python-connector
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
4
4
|
Summary: The Cloud SQL Python Connector is a library that can be used alongside a database driver to allow users with sufficient permissions to connect to a Cloud SQL database without having to manually allowlist IPs or manage SSL certificates.
|
|
5
5
|
Home-page: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector
|
|
6
6
|
Author: Google LLC
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloud-sql-python-connector
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
4
4
|
Summary: The Cloud SQL Python Connector is a library that can be used alongside a database driver to allow users with sufficient permissions to connect to a Cloud SQL database without having to manually allowlist IPs or manage SSL certificates.
|
|
5
5
|
Home-page: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector
|
|
6
6
|
Author: Google LLC
|
|
@@ -18,6 +18,7 @@ google/cloud/sql/connector/connector.py
|
|
|
18
18
|
google/cloud/sql/connector/exceptions.py
|
|
19
19
|
google/cloud/sql/connector/instance.py
|
|
20
20
|
google/cloud/sql/connector/pg8000.py
|
|
21
|
+
google/cloud/sql/connector/py.typed
|
|
21
22
|
google/cloud/sql/connector/pymysql.py
|
|
22
23
|
google/cloud/sql/connector/pytds.py
|
|
23
24
|
google/cloud/sql/connector/rate_limiter.py
|
|
@@ -104,10 +104,6 @@ class InstanceMetadata:
|
|
|
104
104
|
"Upgrade your OpenSSL version to 1.1.1 for TLSv1.3 support."
|
|
105
105
|
)
|
|
106
106
|
self.context.minimum_version = ssl.TLSVersion.TLSv1_2
|
|
107
|
-
|
|
108
|
-
# add request_ssl attribute to ssl.SSLContext, required for pg8000 driver
|
|
109
|
-
self.context.request_ssl = False # type: ignore
|
|
110
|
-
|
|
111
107
|
self.expiration = expiration
|
|
112
108
|
|
|
113
109
|
# tmpdir and its contents are automatically deleted after the CA cert
|
|
@@ -259,7 +255,7 @@ class Instance:
|
|
|
259
255
|
self._current = self._schedule_refresh(0)
|
|
260
256
|
self._next = self._current
|
|
261
257
|
|
|
262
|
-
def force_refresh(self) -> None:
|
|
258
|
+
async def force_refresh(self) -> None:
|
|
263
259
|
"""
|
|
264
260
|
Forces a new refresh attempt immediately to be used for future connection attempts.
|
|
265
261
|
"""
|
|
@@ -267,8 +263,9 @@ class Instance:
|
|
|
267
263
|
if not self._refresh_in_progress.is_set():
|
|
268
264
|
self._next.cancel()
|
|
269
265
|
self._next = self._schedule_refresh(0)
|
|
270
|
-
# block all sequential connection attempts on the next refresh result
|
|
271
|
-
|
|
266
|
+
# block all sequential connection attempts on the next refresh result if current is invalid
|
|
267
|
+
if not await _is_valid(self._current):
|
|
268
|
+
self._current = self._next
|
|
272
269
|
|
|
273
270
|
async def _perform_refresh(self) -> InstanceMetadata:
|
|
274
271
|
"""Retrieves instance metadata and ephemeral certificate from the
|
|
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
"""
|
|
16
|
+
import socket
|
|
16
17
|
import ssl
|
|
17
18
|
from typing import Any, TYPE_CHECKING
|
|
18
19
|
|
|
@@ -39,26 +40,26 @@ def connect(
|
|
|
39
40
|
:rtype: pg8000.dbapi.Connection
|
|
40
41
|
:returns: A pg8000 Connection object for the Cloud SQL instance.
|
|
41
42
|
"""
|
|
42
|
-
# Connecting through pg8000 is done by passing in an SSL Context and setting the
|
|
43
|
-
# "request_ssl" attr to false. This works because when "request_ssl" is false,
|
|
44
|
-
# the driver skips the database level SSL/TLS exchange, but still uses the
|
|
45
|
-
# ssl_context (if it is not None) to create the connection.
|
|
46
43
|
try:
|
|
47
44
|
import pg8000
|
|
48
45
|
except ImportError:
|
|
49
46
|
raise ImportError(
|
|
50
47
|
'Unable to import module "pg8000." Please install and try again.'
|
|
51
48
|
)
|
|
49
|
+
|
|
50
|
+
# Create socket and wrap with context.
|
|
51
|
+
sock = ctx.wrap_socket(
|
|
52
|
+
socket.create_connection((ip_address, SERVER_PROXY_PORT)),
|
|
53
|
+
server_hostname=ip_address,
|
|
54
|
+
)
|
|
55
|
+
|
|
52
56
|
user = kwargs.pop("user")
|
|
53
57
|
db = kwargs.pop("db")
|
|
54
58
|
passwd = kwargs.pop("password", None)
|
|
55
|
-
setattr(ctx, "request_ssl", False)
|
|
56
59
|
return pg8000.dbapi.connect(
|
|
57
60
|
user,
|
|
58
61
|
database=db,
|
|
59
62
|
password=passwd,
|
|
60
|
-
|
|
61
|
-
port=SERVER_PROXY_PORT,
|
|
62
|
-
ssl_context=ctx,
|
|
63
|
+
sock=sock,
|
|
63
64
|
**kwargs,
|
|
64
65
|
)
|
|
File without changes
|
|
@@ -75,11 +75,12 @@ setup(
|
|
|
75
75
|
install_requires=core_dependencies,
|
|
76
76
|
extras_require={
|
|
77
77
|
"pymysql": ["PyMySQL==1.1.0"],
|
|
78
|
-
"pg8000": ["pg8000==1.
|
|
79
|
-
"pytds": ["python-tds==1.
|
|
78
|
+
"pg8000": ["pg8000==1.30.1"],
|
|
79
|
+
"pytds": ["python-tds==1.13.0"],
|
|
80
80
|
"asyncpg": ["asyncpg==0.28.0"]
|
|
81
81
|
},
|
|
82
82
|
python_requires=">=3.8",
|
|
83
83
|
include_package_data=True,
|
|
84
84
|
zip_safe=False,
|
|
85
|
+
package_data={"google.cloud.sql.connector": ["py.typed"]},
|
|
85
86
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/__init__.py
RENAMED
|
File without changes
|
{cloud-sql-python-connector-1.3.0 → cloud-sql-python-connector-1.4.1}/google/cloud/sql/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|