From 14d5ad6370d63f2c2af3e7c3b583acd0d775a093 Mon Sep 17 00:00:00 2001
From: davebshow <davebshow@gmail.com>
Date: Fri, 27 Nov 2015 11:31:55 -0500
Subject: [PATCH] allow passing of conn_timeout directly to GremlinClient

---
 README.md               |  2 +-
 aiogremlin/client.py    | 15 +++++++++++----
 aiogremlin/connector.py |  4 ++--
 docs/index.rst          |  2 +-
 docs/usage.rst          |  7 +++++--
 setup.py                |  4 ++--
 6 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index 3f8eb84..6def76e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# [aiogremlin 0.1.0](https://pypi.python.org/pypi/aiogremlin/0.0.11)
+# [aiogremlin 0.1.3](https://pypi.python.org/pypi/aiogremlin/0.0.11)
 
 ## [Official Documentation](http://aiogremlin.readthedocs.org/en/latest/)
 
diff --git a/aiogremlin/client.py b/aiogremlin/client.py
index 9481730..6f4459b 100644
--- a/aiogremlin/client.py
+++ b/aiogremlin/client.py
@@ -26,10 +26,12 @@ class GremlinClient:
         "gremlin-groovy" by default
     :param str op: Gremlin Server op argument. "eval" by default.
     :param str processor: Gremlin Server processor argument. "" by default.
-    :param float timeout: timeout for establishing connection (optional).
+    :param float timeout: timeout for websocket read (seconds)(optional).
         Values ``0`` or ``None`` mean no timeout
     :param ws_connector: A class that implements the method ``ws_connect``.
         Usually an instance of ``aiogremlin.connector.GremlinConnector``
+    :param float conn_timeout: timeout for establishing connection (seconds)
+        (optional). Values ``0`` or ``None`` mean no timeout
     :param username: Username for SASL auth
     :param password: Password for SASL auth
     """
@@ -37,7 +39,7 @@ class GremlinClient:
     def __init__(self, *, url='http://localhost:8182/', loop=None,
                  lang="gremlin-groovy", op="eval", processor="",
                  timeout=None, ws_connector=None, client_session=None,
-                 username="", password=""):
+                 conn_timeout=None, username="", password=""):
         self._lang = lang
         self._op = op
         self._processor = processor
@@ -50,7 +52,8 @@ class GremlinClient:
         self._password = password
         if ws_connector is None:
             ws_connector = GremlinConnector(loop=self._loop,
-                                            client_session=client_session)
+                                            client_session=client_session,
+                                            conn_timeout=conn_timeout)
         self._connector = ws_connector
 
     @property
@@ -355,6 +358,7 @@ def submit(gremlin, *,
            timeout=None,
            session=None,
            loop=None,
+           conn_timeout=None,
            username="",
            password=""):
     """
@@ -378,6 +382,8 @@ def submit(gremlin, *,
     :param loop: :ref:`event loop<asyncio-event-loop>` If param is ``None``,
         `asyncio.get_event_loop` is used for getting default event loop
         (optional)
+    :param float conn_timeout: timeout for establishing connection (seconds)
+        (optional). Values ``0`` or ``None`` mean no timeout
     :param username: Username for SASL auth
     :param password: Password for SASL auth
     :returns: :py:class:`aiogremlin.client.GremlinResponse` object
@@ -387,7 +393,8 @@ def submit(gremlin, *,
         loop = asyncio.get_event_loop()
 
     connector = aiohttp.TCPConnector(force_close=True, loop=loop,
-                                     verify_ssl=False)
+                                     verify_ssl=False,
+                                     conn_timeout=conn_timeout)
 
     client_session = aiohttp.ClientSession(
         connector=connector, loop=loop,
diff --git a/aiogremlin/connector.py b/aiogremlin/connector.py
index 5c9fa79..f3eae44 100644
--- a/aiogremlin/connector.py
+++ b/aiogremlin/connector.py
@@ -13,8 +13,8 @@ class GremlinConnector(WebSocketConnector):
     """Create and manage reusable websocket connections. Out of the box
     support for multiple enpoints (databases).
 
-    :param float conn_timeout: timeout for establishing connection (optional).
-        Values ``0`` or ``None`` mean no timeout
+    :param float conn_timeout: timeout for establishing connection (seconds)
+        (optional). Values ``0`` or ``None`` mean no timeout
     :param bool force_close: close websockets after release
     :param int limit: limit for total open websocket connections
     :param aiohttp.client.ClientSession client_session: Underlying HTTP
diff --git a/docs/index.rst b/docs/index.rst
index a7baafb..785e7a5 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -12,7 +12,7 @@ based on the `asyncio`_ and `aiohttp`_ libraries.
 
 Releases
 ========
-The latest release of :py:mod:`aiogremlin` is **0.1.2**.
+The latest release of :py:mod:`aiogremlin` is **0.1.3**.
 
 
 Requirements
diff --git a/docs/usage.rst b/docs/usage.rst
index df8e3cd..28a3e65 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -58,7 +58,7 @@ read the chunked responses one at a time::
 
     :param str processor: Gremlin Server processor argument. "" by default.
 
-    :param float timeout: timeout for establishing connection (optional).
+    :param float timeout: timeout for websocket read (seconds)(optional).
         Values ``0`` or ``None`` mean no timeout
 
     :param str session: Session id (optional). Typically a uuid
@@ -67,8 +67,11 @@ read the chunked responses one at a time::
         `asyncio.get_event_loop` is used for getting default event loop
         (optional)
 
+    :param float conn_timeout: timeout for establishing connection (seconds)
+        (optional). Values ``0`` or ``None`` mean no timeout
+
     :param username: Username for SASL auth
-    
+
     :param password: Password for SASL auth
 
     :returns: :py:class:`aiogremlin.client.GremlinResponse` object
diff --git a/setup.py b/setup.py
index 3463d36..78cd7c4 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
 
 setup(
     name="aiogremlin",
-    version="0.1.2",
+    version="0.1.3",
     url="",
     license="MIT",
     author="davebshow",
@@ -13,7 +13,7 @@ setup(
     packages=["aiogremlin", "tests"],
     install_requires=[
         "aiohttp==0.18.4",
-        "aiowebsocketclient==0.0.4"
+        "aiowebsocketclient==0.0.5"
     ],
     test_suite="tests",
     classifiers=[
-- 
GitLab