def __init__(self, url, debug=False, ident=None): WebSocketClientFactory.__init__(self, url, useragent=ident, debug=debug, debugCodePaths=debug) self.setProtocolOptions(failByDrop=False) # spec conformance ## enable permessage-XXX compression extensions ## offers = [PerMessageDeflateOffer()] #offers = [PerMessageSnappyOffer(), PerMessageBzip2Offer(), PerMessageDeflateOffer()] self.setProtocolOptions(perMessageCompressionOffers=offers) def accept(response): if isinstance(response, PerMessageDeflateResponse): return PerMessageDeflateResponseAccept(response) elif isinstance(response, PerMessageBzip2Response): return PerMessageBzip2ResponseAccept(response) elif isinstance(response, PerMessageSnappyResponse): return PerMessageSnappyResponseAccept(response) self.setProtocolOptions(perMessageCompressionAccept=accept) self.endCaseId = None self.currentCaseId = 0 self.updateReports = True if ident is not None: self.agent = ident else: self.agent = "AutobahnPython/%s" % autobahn.version self.resource = "/getCaseCount"
def __init__(self, url, debug = False, ident = None): WebSocketClientFactory.__init__(self, url, useragent = ident, debug = debug, debugCodePaths = debug) self.setProtocolOptions(failByDrop = False) # spec conformance ## enable permessage-XXX compression extensions ## offers = [PerMessageDeflateOffer()] #offers = [PerMessageSnappyOffer(), PerMessageBzip2Offer(), PerMessageDeflateOffer()] self.setProtocolOptions(perMessageCompressionOffers = offers) def accept(response): if isinstance(response, PerMessageDeflateResponse): return PerMessageDeflateResponseAccept(response) elif isinstance(response, PerMessageBzip2Response): return PerMessageBzip2ResponseAccept(response) elif isinstance(response, PerMessageSnappyResponse): return PerMessageSnappyResponseAccept(response) self.setProtocolOptions(perMessageCompressionAccept = accept) self.endCaseId = None self.currentCaseId = 0 self.updateReports = True if ident is not None: self.agent = ident else: self.agent = "AutobahnPython/%s" % autobahn.version self.resource = "/getCaseCount"
def __init__(self, receiver, host, apps, userpass, port=DEFAULT_PORT, timeout_secs=60, subscribe_all=False): """Constructor :param receiver The object that will receive events from the protocol :param host: Hostname of Asterisk. :param apps: App names to subscribe to. :param port: Port of Asterisk web server. :param timeout_secs: Maximum time to try to connect to Asterisk. :param subscribe_all: If true, subscribe to all events. """ url = "ws://%s:%d/ari/events?%s" % \ (host, port, urllib.urlencode({'app': apps, 'api_key': '%s:%s' % userpass})) if subscribe_all: url += '&subscribeAll=true' LOGGER.info("WebSocketClientFactory(url=%s)", url) WebSocketClientFactory.__init__(self, url, debug=True, protocols=['ari'], debugCodePaths=True) self.timeout_secs = timeout_secs self.attempts = 0 self.start = None self.receiver = receiver
def __init__(self, receiver, host, apps, userpass, port=DEFAULT_PORT, timeout_secs=60, subscribe_all=False): """Constructor :param receiver The object that will receive events from the protocol :param host: Hostname of Asterisk. :param apps: App names to subscribe to. :param port: Port of Asterisk web server. :param timeout_secs: Maximum time to try to connect to Asterisk. :param subscribe_all: If true, subscribe to all events. """ url = "ws://%s:%d/ari/events?%s" % \ (host, port, urllib.urlencode({'app': apps, 'api_key': '%s:%s' % userpass})) if subscribe_all: url += '&subscribeAll=true' LOGGER.info("WebSocketClientFactory(url=%s)", url) try: WebSocketClientFactory.__init__(self, url, debug=True, protocols=['ari'], debugCodePaths=True) except TypeError: WebSocketClientFactory.__init__(self, url, protocols=['ari']) self.timeout_secs = timeout_secs self.attempts = 0 self.start = None self.receiver = receiver
def __init__(self, url): WebSocketClientFactory.__init__(self, url) self.protocolInstance = None self.tickGap = 5 self.tickSetup() self.connect()
def __init__(self, api_key, use_ssl=True, debug=False, **kwargs): self.debug = debug client_name = 'twistedPusher' client_version = '0.1' proto = use_ssl and 'wss' or 'ws' port = use_ssl and 443 or 80 url = '%s://ws.pusherapp.com:%s/app/%s?client=%s&version=%s&protocol=6&flash=false' % (proto, port, api_key, client_name, client_version) WebSocketClientFactory.__init__(self, url=url, **kwargs)
def __init__(self, debug): WebSocketClientFactory.__init__(self, debug = debug) self.endCaseId = None self.currentCaseId = 0 self.updateReports = True self.agent = "AutobahnClient/%s" % pkg_resources.get_distribution("autobahn").version self.path = "/getCaseCount"
def __init__(self, url, debug, debugCodePaths): WebSocketClientFactory.__init__(self, url, debug = debug, debugCodePaths = debugCodePaths) self.endCaseId = None self.currentCaseId = 0 self.updateReports = True self.agent = "AutobahnClient/%s" % autobahn.version self.resource = "/getCaseCount"
def __init__(self, debug): WebSocketClientFactory.__init__(self, debug = debug) self.endCaseId = None self.currentCaseId = 0 self.updateReports = True self.agent = "AutobahnClient/%s" % autobahn.version self.path = "/getCaseCount"
def __init__(self, url, debug = False): WebSocketClientFactory.__init__(self, url, debug = debug, debugCodePaths = debug) self.setProtocolOptions(failByDrop = False) # spec conformance self.endCaseId = None self.currentCaseId = 0 self.updateReports = True self.agent = "AutobahnClient/%s" % autobahn.version self.resource = "/getCaseCount"
def __init__(self, url, conn): """ Initialize the factory. @param url: URL of the Robot process. @type url: str @param conn: Connection instance which provides callback functions. @type conn: rce.comm.client.RCE """ WebSocketClientFactory.__init__(self, url) self._connection = conn
def __init__(self, url, debug, debugCodePaths): WebSocketClientFactory.__init__(self, url, debug=debug, debugCodePaths=debugCodePaths) self.endCaseId = None self.currentCaseId = 0 self.updateReports = True self.agent = "AutobahnClient/%s" % autobahn.version self.resource = "/getCaseCount"
def __init__(self, url, connection): """ Initialize the factory. @param url: URL of the Robot Manager. @type url: str @param connection: Connection instance which provides callback functions. @type connection: pyrce.connection._Connection """ WebSocketClientFactory.__init__(self, url) self._connection = connection
def __init__(self, url, debug=False, serializers=None, reactor=None): if serializers is None: serializers = [WampMsgPackSerializer(), WampJsonSerializer()] self._serializers = {} for ser in serializers: self._serializers[ser.SERIALIZER_ID] = ser protocols = ["wamp.2.%s" % ser.SERIALIZER_ID for ser in serializers] WebSocketClientFactory.__init__(self, url, debug=debug, protocols=protocols, reactor=reactor)
def __init__(self, url, debug = False, serializers = None, reactor = None): if serializers is None: serializers = [WampMsgPackSerializer(), WampJsonSerializer()] self._serializers = {} for ser in serializers: self._serializers[ser.SERIALIZER_ID] = ser protocols = ["wamp.2.%s" % ser.SERIALIZER_ID for ser in serializers] WebSocketClientFactory.__init__(self, url, debug = debug, protocols = protocols, reactor = reactor)
def __init__(self, spec, debug = False): WebSocketClientFactory.__init__(self, debug = debug, debugCodePaths = debug) FuzzingFactory.__init__(self, spec.get("outdir", "./reports/servers/")) # needed for wire log / stats self.logOctets = True self.logFrames = True self.spec = spec self.specCases = parseSpecCases(self.spec) self.specExcludeAgentCases = parseExcludeAgentCases(self.spec) print "Autobahn WebSockets %s/%s Fuzzing Client" % (autobahntestsuite.version, autobahn.version) print "Ok, will run %d test cases against %d servers" % (len(self.specCases), len(spec["servers"])) print "Cases = %s" % str(self.specCases) print "Servers = %s" % str([x["url"] + "@" + x["agent"] for x in spec["servers"]]) self.currServer = -1 if self.nextServer(): if self.nextCase(): connectWS(self)
def __init__(self, key, secret, currency, http_api, coin='BTC', **kwargs): WebSocketClientFactory.__init__(self, **kwargs) self.evt = common.Event(eventprefix="//mtgox") self.key = binascii.unhexlify(key.replace('-', '')) self.secret = base64.b64decode(secret) self.currency = currency self.http_api = http_api self.coin = coin self.known_channels = { 'ticker': 'd5f06780-30a8-4a48-a2f8-7ed181b4a13f', 'depth': '24e67e0d-1cad-4cc0-9e7a-f8523ef460fe', 'trade': 'dbf1dee9-4f2e-4a08-8cb7-748919a71b21', 'lag': '85174711-be64-4de1-b783-0628995d7914'} self.client = None self.connected = False self.evt.listen('idkey', self.got_idkey) self.evt.listen('remark', self.got_remark) self.evt.listen('channel', self.got_channel) self.idkey_refresh_task = task.LoopingCall(self.refresh_idkey)
def __init__(self, recvQ=None, sendQ=None, *args, **kwargs): WebSocketClientFactory.__init__(self, *args, **kwargs) self.recvQ = recvQ self.sendQ = sendQ
def __init__(self, url, kato_client, cookie=None, **kwargs): WebSocketClientFactory.__init__(self, url, **kwargs) self.kato_client = kato_client self.cookie = cookie self.setProtocolOptions(version=13)
def __init__(self, url): WebSocketClientFactory.__init__(self, url)
def __init__(self, url, debug = False): WebSocketClientFactory.__init__(self, url, debug = debug, debugCodePaths = debug)
def __init__(self, url, reactor, deferred, **kw): WebSocketClientFactory.__init__(self, url, **kw) self._reactor = reactor self._deferred = deferred
def __init__(self, control_channel, **kwargs): self.control_channel = control_channel WebSocketClientFactory.__init__(self, **kwargs)
def __init__(self, url, kato_client, cookie=None, **kwargs): WebSocketClientFactory.__init__(self, url, **kwargs) self.kato_client = kato_client self.cookie = cookie self.setProtocolOptions(version = 13)
def __init__(self, api_key, tracker, *args, **kwargs): self.api_key = api_key self.tracker = tracker WebSocketClientFactory.__init__(self, *args, **kwargs)