Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
color_init()
zf = ZmqFactory()
e = ZmqEndpoint(ZmqEndpointType.connect, ENDPOINT)
self._conn = ZmqREQConnection(zf, e)
self.data = []
if self.service:
self.data = [self.service]
def __init__(self, cfg, print_json=False):
self.cfg = cfg
color_init()
zf = ZmqFactory()
e = ZmqEndpoint(ZmqEndpointType.connect, ENDPOINT)
self._conn = ZmqREQConnection(zf, e)
self.data = []
if self.service:
self.data = [self.service]
self.print_json = print_json
def get_zmq_connection():
zf = ZmqFactory()
e = ZmqEndpoint(ZmqEndpointType.connect, ENDPOINT)
return ZmqREQConnection(zf, e)
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from txzmq import ZmqFactory, ZmqEndpoint, ZmqEndpointType, ZmqREQConnection
import logging
import json
from util import Identity
class ZmqRequestor(ZmqREQConnection):
def __init__(self, remote_host, port, zmq_factory, data_manager=None):
self.data_manager = data_manager
self.remote_host = remote_host
endpoint = ZmqEndpoint(ZmqEndpointType.connect, "tcp://%s:%d" % (remote_host, port))
ZmqREQConnection.__init__(self, zmq_factory, endpoint)
def request_metadata(self):
msg = { "op" : "get_table_list", "identity" : Identity.get_identity() }
#logging.info("ZmqRequestor: Requesting table list from %s.", self.remote_host)
deferred = self.sendMsg(json.dumps(msg))
deferred.callback = self.message_received