pythonblip
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: pythonblip | ||
| Version: 0.2.1 | ||
| Version: 0.3.0 | ||
| Summary: Couchbase BLIP Protocol Library | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/mminichino/python-blip |
| Metadata-Version: 2.1 | ||
| Name: pythonblip | ||
| Version: 0.2.1 | ||
| Version: 0.3.0 | ||
| Summary: Couchbase BLIP Protocol Library | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/mminichino/python-blip |
+16
-3
| ## | ||
| ## | ||
| import ssl | ||
| import time | ||
@@ -22,5 +22,4 @@ import logging | ||
| def __init__(self, uri: str, headers: dict): | ||
| def __init__(self, target: str, headers: dict, tls: bool = False): | ||
| lock = Lock() | ||
| self.uri = uri | ||
| self.headers = headers | ||
@@ -35,7 +34,21 @@ self.run_loop = True | ||
| if not tls: | ||
| self.ssl_context = None | ||
| else: | ||
| self.ssl_context = ssl.SSLContext() | ||
| self.ssl_context.check_hostname = False | ||
| self.ssl_context.verify_mode = ssl.CERT_NONE | ||
| self.ssl_context.options |= ssl.OP_NO_TLSv1 | ||
| self.ssl_context.options |= ssl.OP_NO_TLSv1_1 | ||
| self.ssl_context.load_default_certs() | ||
| self.uri = target | ||
| async def connect(self): | ||
| tasks = [] | ||
| logger.debug(f"Connecting to {self.uri}") | ||
| try: | ||
| connection = websockets.connect(self.uri, | ||
| ssl=self.ssl_context, | ||
| extra_headers=self.headers, | ||
@@ -42,0 +55,0 @@ subprotocols=['BLIP_3+CBMobile_3'], |
@@ -34,2 +34,4 @@ ## | ||
| authenticator = attr.ib(validator=instance_of((SessionAuth, BasicAuth))) | ||
| tls = attr.ib(validator=instance_of(bool)) | ||
| port = attr.ib(validator=instance_of(str)) | ||
| scope = attr.ib(validator=instance_of(str)) | ||
@@ -43,5 +45,7 @@ collections = attr.ib(validator=instance_of(list)) | ||
| def create(cls, database: str, | ||
| target: str, | ||
| hostname: str, | ||
| r_type: ReplicatorType, | ||
| authenticator: Union[SessionAuth, BasicAuth], | ||
| tls: bool = False, | ||
| port: str = "4984", | ||
| scope: str = "_default", | ||
@@ -54,7 +58,13 @@ collections: list[str] = None, | ||
| collections = ["_default"] | ||
| if tls: | ||
| prefix = "wss" | ||
| else: | ||
| prefix = "ws" | ||
| return cls( | ||
| database, | ||
| f"{target}/{database}/_blipsync", | ||
| f"{prefix}://{hostname}:{port}/{database}/_blipsync", | ||
| r_type, | ||
| authenticator, | ||
| tls, | ||
| port, | ||
| scope, | ||
@@ -127,3 +137,3 @@ collections, | ||
| self.hash_list.append(_hash) | ||
| self.blip = BLIPProtocol(self.config.target, self.config.authenticator.header()) | ||
| self.blip = BLIPProtocol(self.config.target, self.config.authenticator.header(), self.config.tls) | ||
| logger.info(f"Replicator active for client {self.client}") | ||
@@ -130,0 +140,0 @@ |
+1
-1
@@ -9,3 +9,3 @@ from setuptools import setup | ||
| name='pythonblip', | ||
| version='0.2.1', | ||
| version='0.3.0', | ||
| packages=['pythonblip'], | ||
@@ -12,0 +12,0 @@ url='https://github.com/mminichino/python-blip', |
Sorry, the diff of this file is not supported yet
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
63567
1.53%1060
2.12%