mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-12 20:49:41 +02:00
Template
This commit is contained in:
parent
1550fde832
commit
af852125f8
6 changed files with 1131 additions and 737 deletions
25
src/epplibwrapper/utility/pool.py
Normal file
25
src/epplibwrapper/utility/pool.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from geventconnpool import ConnectionPool
|
||||
from epplibwrapper.socket import Socket
|
||||
|
||||
class EppConnectionPool(ConnectionPool):
|
||||
def __init__(self, client, login, options):
|
||||
# For storing shared credentials
|
||||
self._client = client
|
||||
self._login = login
|
||||
super().__init__(**options)
|
||||
|
||||
def _new_connection(self):
|
||||
socket = self.create_socket(self._client, self._login)
|
||||
try:
|
||||
connection = socket.connect()
|
||||
return connection
|
||||
except Exception as err:
|
||||
raise err
|
||||
|
||||
def _keepalive(self, connection):
|
||||
pass
|
||||
|
||||
def create_socket(self, client, login) -> Socket:
|
||||
"""Creates and returns a socket instance"""
|
||||
socket = Socket(client, login)
|
||||
return socket
|
Loading…
Add table
Add a link
Reference in a new issue