Beispiel #1
0
    def __init__(self, api_key, api_secret, 
                 should_auth=False, heartbeat=True, ping_interval=10, ping_timeout=9):
        self.api_key = api_key
        self.api_secret = api_secret
        self.ping_timeout = ping_timeout
        self.ping_interval = ping_interval
        self.should_auth = should_auth
        self.heartbeat = heartbeat
        self.channels = []
        self.reconnect_count = 0

        EventEmitter.__init__(self)

        WebSocketApp.__init__(
            self,
            url=self.gen_url(),
            header=self.header(),
            on_message=self.on_message,
            on_close=self.on_close,
            on_open=self.on_open,
            on_error=self.on_error,
            on_pong=self.on_pong
        )

        self.on('subscribe', self.on_subscribe)
Beispiel #2
0
    def __init__(self, **kwargs):
        EventEmitter.__init__(self)
        for key, value in kwargs.iteritems():
            setattr(self, key, value)

        component_config = types.ComponentConfig(realm = u"sputnik")
        wamp.ApplicationSessionFactory.__init__(self, config=component_config)
Beispiel #3
0
    def __init__(self, **kwargs):
        EventEmitter.__init__(self)
        for key, value in kwargs.iteritems():
            setattr(self, key, value)

        component_config = types.ComponentConfig(realm = u"sputnik")
        wamp.ApplicationSessionFactory.__init__(self, config=component_config)
Beispiel #4
0
    def __init__(self, endpoint=None, id=None, secret=None,
                 debug=False, bot=SputnikSession, ca_certs_dir="/etc/ssl/certs", **kwargs):
        EventEmitter.__init__(self)
        self.debug = debug
        self.session_factory = BotFactory(username=id,
                                          password=secret,
                                          **kwargs)
        self.session_factory.on("connect", self.onConnect)
        self.session_factory.on("disconnect", self.onDisconnect)
        self.session_factory.on("join", self.onJoin)
        self.session_factory.session = bot
        self.base_uri = endpoint

        from urlparse import urlparse
        parse = urlparse(endpoint)

        if parse.scheme == 'wss':
            if parse.port is None:
                port = 8443
            else:
                port = parse.port
            self.connection_string = "ssl:host=%s:port=%d:caCertsDir=%s" % (parse.hostname, port, ca_certs_dir)
        elif parse.scheme == 'ws':
            if parse.port is None:
                port = 8880
            else:
                port = parse.port
            self.connection_string = "tcp:%s:%d" % (parse.hostname, port)
        else:
            raise NotImplementedError

        self.session = None
        self.transport_factory = websocket.WampWebSocketClientFactory(self.session_factory,
                                                                 url = self.base_uri, debug=self.debug,
                                                                 debug_wamp=self.debug)
Beispiel #5
0
 def __init__(self,
              verification_token,
              endpoint="/slack/events",
              server=None):
     EventEmitter.__init__(self)
     self.verification_token = verification_token
     self.server = SlackServer(verification_token, endpoint, self, server)
Beispiel #6
0
    def __init__(self, endpoint=None, id=None, secret=None,
                 debug=False, bot=SputnikSession, ca_certs_dir="/etc/ssl/certs", **kwargs):
        EventEmitter.__init__(self)
        self.debug = debug
        self.session_factory = BotFactory(username=id,
                                          password=secret,
                                          **kwargs)
        self.session_factory.on("connect", self.onConnect)
        self.session_factory.on("disconnect", self.onDisconnect)
        self.session_factory.on("join", self.onJoin)
        self.session_factory.session = bot
        self.base_uri = endpoint

        from urlparse import urlparse
        parse = urlparse(endpoint)

        if parse.scheme == 'wss':
            if parse.port is None:
                port = 8443
            else:
                port = parse.port
            self.connection_string = "ssl:host=%s:port=%d:caCertsDir=%s" % (parse.hostname, port, ca_certs_dir)
        elif parse.scheme == 'ws':
            if parse.port is None:
                port = 8880
            else:
                port = parse.port
            self.connection_string = "tcp:%s:%d" % (parse.hostname, port)
        else:
            raise NotImplementedError

        self.session = None
        self.transport_factory = websocket.WampWebSocketClientFactory(self.session_factory,
                                                                 url = self.base_uri, debug=self.debug,
                                                                 debug_wamp=self.debug)
Beispiel #7
0
    def __init__(self, path):
        asyncore.dispatcher.__init__(self)
        EventEmitter.__init__(self)

        self._requests = []
        self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
        self.connect(path)
    def __init__(self, address):
        EventEmitter.__init__(self)
        threading.Thread.__init__(self)

        self.sp = serial.Serial(address, timeout=1)
        self.alive = True
        self.lock = threading.Lock()
Beispiel #9
0
    def __init__(self,
                 symbol='XBTH17',
                 channels=[],
                 shouldAuth=False,
                 max_table_length=constants.MAX_TABLE_LEN,
                 websocket=None):

        EventEmitter.__init__(self)
        self.channels = channels

        if max_table_length > 0:
            self.max_table_length = max_table_length
        else:
            self.max_table_length = constants.MAX_TABLE_LEN

        self.shouldAuth = shouldAuth
        self.symbol = symbol
        self.websocket = websocket

        self.data = {
            'orderBookL2': [],
            'instrument': []
        }

        self.init()
Beispiel #10
0
 def __init__(self, url, debug=False):
     WebSocketClient.__init__(self, url)
     EventEmitter.__init__(self)
     self.debug = debug
     self._session = None
     self._uniq_id = 0
     self._callbacks = {}
Beispiel #11
0
    def __init__(self, steamid, key=None, language: str='en', identity_secret: str='', poll_delay: int=30,
                 login_delay_time: int=0):
        """

        :param steamid: stemid64
        :param key: steam api key
        :param language:
        :param identity_secret:
        :param poll_delay: how often trades should be polled (too often can cause errors, too infrequent can make your
        bot too slow to respond
        :param login_delay_time: how long to wait after our session died to retry
        """
        EventEmitter.__init__(self)
        self.session = aiohttp.ClientSession()
        ConfManager.__init__(self, identity_secret, steamid, self.session)
        self.steamid = SteamID(steamid)
        if not self.steamid.isValid() or not self.steamid.type == SteamID.Type['INDIVIDUAL']:
            raise ValueError(f"Steam ID {self.steamid} is not valid, or is not a user ID")
        self.key = key
        self.language = language
        self.poll_delay = poll_delay
        self.last_poll = 0
        self.logged_in = False
        self._trade_cache = {}
        self._conf_cache = {}
        self.first_run = True
        self.login_delay_time = login_delay_time
 def __init__(self, url, debug=False):
     self.debug = debug
     # by default socket connections don't timeout. this causes issues
     # where reconnects can get stuck
     # TODO: make this configurable?
     socket.setdefaulttimeout(10)
     WebSocketClient.__init__(self, url)
     EventEmitter.__init__(self)
Beispiel #13
0
 def __init__(self, modules: list, poll_delay: int=2):
     """
     :param modules: modules to poll
     :param poll_delay: how long to wait after polling finishes until polling starts again
     """
     self.modules = modules
     self.poll_delay = poll_delay
     EventEmitter.__init__(self)
    def __init__(self):

        # run the superclass constructor
        EventEmitter.__init__(self)

        # constructor
        self.win = None
        self.draw_queue = []
Beispiel #15
0
 def __init__(self, url, debug=False):
     self.debug = debug
     # by default socket connections don't timeout. this causes issues
     # where reconnects can get stuck
     # TODO: make this configurable?
     socket.setdefaulttimeout(10)
     WebSocketClient.__init__(self, url)
     EventEmitter.__init__(self)
Beispiel #16
0
    def __init__(self):

        # run the superclass constructor
        EventEmitter.__init__(self)

        # create constructor
        self.win = None
        self.draw_queue = []
        self.active_aois = []
Beispiel #17
0
 def __init__(self,
              consumer_secret,
              endpoint="/webhooks/twitter",
              server=None,
              **kwargs):
     EventEmitter.__init__(self)
     self.consumer_secret = consumer_secret
     self.server = WebhookServer(consumer_secret, endpoint, self, server,
                                 **kwargs)
Beispiel #18
0
    def __init__(self, id=None, secret=None, endpoint="https://api.coinsetter.com/v1"):
        EventEmitter.__init__(self)
        self.username = id
        self.password = secret
        self.endpoint = endpoint
        self.session_id = None

        from urllib2 import urlopen
        self.ip = json.load(urlopen('http://jsonip.com'))['ip']
Beispiel #19
0
 def __init__(self,
              signing_secret,
              endpoint="/slack/events",
              server=None,
              **kwargs):
     EventEmitter.__init__(self)
     self.signing_secret = signing_secret
     self.server = SlackServer(signing_secret, endpoint, self, server,
                               **kwargs)
Beispiel #20
0
    def __init__(self, id=None, secret=None, endpoint="https://api.coinsetter.com/v1"):
        EventEmitter.__init__(self)
        self.username = id
        self.password = secret
        self.endpoint = endpoint
        self.session_id = None

        from urllib2 import urlopen
        self.ip = json.load(urlopen('http://jsonip.com'))['ip']
Beispiel #21
0
    def __init__(self, url=None, conn_string=None, authParams=None, reactor=None, **options):
        ''' Creates the client, but does not connect to the server automatically.
        Optional keyword parameters (**options) for...
           Client: url (required), authParams, reactor, conn_string, debug, factory
           protocol: url (required), authParams, heartbeat_interval
           rpc: rpcAckTimeout, rpcResponseTimeout, subscriptionTimeout
           record: recordReadAckTimeout, merge_strategy, recordReadTimeout, recordDeleteTimeout, recordDeepCopy,
           presence: subscriptionTimeout
        '''

        if not url or url is None:
            raise ValueError(
                "url is None; you must specify a  URL for the deepstream server, e.g. ws://localhost:6020/deepstream")
        parse_result = urlparse(url)
        if not authParams or authParams is None:
            authParams = {}
            if parse_result.username and parse_result.password:
                authParams['username'] = parse_result.username
                authParams['password'] = parse_result.password
        if not conn_string or conn_string is None:
            if parse_result.scheme == 'ws':
                if parse_result.hostname:
                    conn_string = 'tcp:%s' % parse_result.hostname
                if parse_result.port:
                    conn_string += ':%s' % parse_result.port
                else:
                    conn_string += ':6020'
        if not conn_string or conn_string is None:
            raise ValueError(
                "Could not parse conn string from URL; you must specify a Twisted endpoint descriptor for the server, e.g. tcp:127.0.0.1:6020")
        if not reactor or reactor is None:
            from twisted.internet import reactor
        self.reactor = reactor
        factory = options.pop('factory', WSDeepstreamFactory)
        self._factory = factory(url, self, debug=options.pop('debug', False), reactor=reactor, **options)
        self._endpoint = clientFromString(reactor, conn_string)
        self._service = ClientService(self._endpoint, self._factory)  # Handles reconnection for us

        EventEmitter.__init__(self)
        self._connection = ConnectionInterface(self, url)
        self._presence = PresenceHandler(self._connection, self, **options)
        self._event = EventHandler(self._connection, self, **options)
        self._rpc = RPCHandler(self._connection, self, **options)
        self._record = RecordHandler(self._connection, self, **options)
        self._message_callbacks = dict()

        self._message_callbacks[
            constants.topic.PRESENCE] = self._presence.handle
        self._message_callbacks[
            constants.topic.EVENT] = self._event.handle
        self._message_callbacks[
            constants.topic.RPC] = self._rpc.handle
        self._message_callbacks[
            constants.topic.RECORD] = self._record.handle
        self._message_callbacks[
            constants.topic.ERROR] = self._on_error
Beispiel #22
0
 def __init__(self, log, clock, script_path, id, app, name, popen=subprocess.Popen):
     EventEmitter.__init__(self)
     self.log = log
     self.clock = clock
     self.script_path = script_path
     self.app = app
     self.name = name
     self.runner = None
     self._name = "%s-%s-%s" % (id, app, name)
     self._popen = popen
    def __init__(self):
        """Constructor."""
        # run the superclass constructor
        EventEmitter.__init__(self)
        self.type = None
        self.control_elements = []

        # sensor_id should be unique
        rndnum = random.randint(0, 100000)
        self.sensor_id = "sensor" + str(rndnum)
Beispiel #24
0
    def __init__(self, initial_value, value_forwarder=None):
        """
        Initialize the object.

        initial_value -- the initial value
        value_forwarder -- the method that updates the actual value on the
                           thing
        """
        EventEmitter.__init__(self)
        self.last_value = initial_value
        self.value_forwarder = value_forwarder
    def __init__(self, id, id_property):
        ChangeTracker.__init__(self,
                               intrinsic_properties=[id_property],
                               data={
                                   id_property: id,
                                   'meta': ChangeTracker()
                               })
        EventEmitter.__init__(self)

        self._id_property = id_property
        self._connection = None
Beispiel #26
0
    def __init__(self):
        """Constructor."""
        # run the superclass constructor
        EventEmitter.__init__(self)
        self.type = None
        self.control_elements = []
        self.data_conditions = []

        # sensor_id should be unique
        rndnum = random.randint(0, 100000)
        self.sensor_id = "sensor" + str(rndnum)
Beispiel #27
0
 def __init__(self,
              shouldAuth=False,
              heartbeatEnabled=True):
     EventEmitter.__init__(self)
     self.url = self.build_websocket_url()
     self.header = self.get_auth()
     self.sock = None
     self.last_ping_tm = 0
     self.last_pong_tm = 0
     self.channels = []
     self.reconnect_count = 0
     self.__reset()
     self.connect_websocket()
Beispiel #28
0
 def __init__(self, clock, container, id, app, name,
              image, command, config, port_pool, port):
     EventEmitter.__init__(self)
     self.clock = clock
     self.id = id
     self.app = app
     self.name = name
     self.image = image
     self.command = command
     self.config = config
     self.port_pool = port_pool
     self.port = port
     self.state = 'init'
     self._container = container
Beispiel #29
0
    def __init__(self):
        EventEmitter.__init__(self)

        linphone.set_log_handler(self._logHandler)
        callbacks = {'call_state_changed': self._callStateHandler}
        self.core = linphone.Core.new(callbacks, None, None)

        self.core.max_calls = 1
        self.core.ring = '/usr/share/sounds/linphone/rings/oldphone.wav'
        self.core.ring_level = 100
        self.core.echo_cancellation_enabled = False
        self.core.echo_limiter_enabled = False
        self.core.video_capture_enabled = False
        self.core.video_display_enabled = False
        self.core.video_preview_enabled = False
 def __init__(self, url, auto_reconnect=True, auto_reconnect_timeout=0.5, debug=False):
     EventEmitter.__init__(self)
     self.ddpsocket = None
     self._ddp_version_index = 0
     self._retry_new_version = False
     self._is_closing = False
     self._is_reconnecting = False
     self.url = url
     self.auto_reconnect = auto_reconnect
     self.auto_reconnect_timeout = auto_reconnect_timeout
     self.debug = debug
     self._session = None
     self._uniq_id = 0
     self._callbacks = {}
     self._init_socket()
Beispiel #31
0
 def __init__(self, url, auto_reconnect=True, auto_reconnect_timeout=0.5, debug=False):
     EventEmitter.__init__(self)
     self.collection_data = CollectionData()
     self.ddp_client = DDPClient(url, auto_reconnect=auto_reconnect,
                                 auto_reconnect_timeout=auto_reconnect_timeout, debug=debug)
     self.ddp_client.on('connected', self.connected)
     self.ddp_client.on('socket_closed', self.closed)
     self.ddp_client.on('failed', self.failed)
     self.ddp_client.on('added', self.added)
     self.ddp_client.on('changed', self.changed)
     self.ddp_client.on('removed', self.removed)
     self.ddp_client.on('reconnected', self._reconnected)
     self.connected = False
     self.subscriptions = {}
     self._login_data = None
Beispiel #32
0
 def __init__(self, url, auto_reconnect=True, auto_reconnect_timeout=0.5, debug=False):
     EventEmitter.__init__(self)
     self.collection_data = CollectionData()
     self.ddp_client = DDPClient(url, auto_reconnect=auto_reconnect,
                                 auto_reconnect_timeout=auto_reconnect_timeout, debug=debug)
     self.ddp_client.on('connected', self.connected)
     self.ddp_client.on('socket_closed', self.closed)
     self.ddp_client.on('failed', self.failed)
     self.ddp_client.on('added', self.added)
     self.ddp_client.on('changed', self.changed)
     self.ddp_client.on('removed', self.removed)
     self.ddp_client.on('reconnected', self._reconnected)
     self.connected = False
     self.subscriptions = {}
     self._login_data = None
Beispiel #33
0
    def __init__(
            self,  # type: Any
            addr,  # type: str
            port,  # type: int
            prot=default_protocol,  # type: Protocol
            out_addr=None,  # type: Union[None, Tuple[str, int]]
            debug_level=0  # type: int
    ):  # type: (...) -> None
        """Initializes a peer to peer socket

        Args:
            addr:        The address you wish to bind to (ie: "192.168.1.1")
            port:        The port you wish to bind to (ie: 44565)
            prot:        The protocol you wish to operate over, defined by a
                             :py:class:`py2p.base.Protocol` object
            out_addr:    Your outward facing address. Only needed if you're
                             connecting over the internet. If you use '0.0.0.0'
                             for the addr argument, this will automatically be
                             set to your LAN address.
            debug_level: The verbosity you want this socket to use when
                             printing event data

        Raises:
            socket.error: The address you wanted could not be bound, or is
            otherwise used
        """
        object.__init__(self)
        EventEmitter.__init__(self)
        self.protocol = prot
        self.debug_level = debug_level
        self.routing_table = {}  # type: Dict[bytes, BaseConnection]
        # In format {ID: handler}
        self.awaiting_ids = []  # type: List[BaseConnection]
        # Connected, but not handshook yet
        if out_addr:  # Outward facing address, if you're port forwarding
            self.out_addr = out_addr
        elif addr == '0.0.0.0':
            self.out_addr = get_lan_ip(), port
        else:
            self.out_addr = addr, port
        info = (str(self.out_addr).encode(), prot.id.encode(), user_salt)
        h = sha384(b''.join(info))
        self.id = b58encode_int(int(h.hexdigest(), 16)).encode()  # type: bytes
        self._logger = getLogger('{}.{}.{}'.format(
            self.__class__.__module__, self.__class__.__name__, self.id))
        self.__handlers = [
        ]  # type: List[Callable[[Message, BaseConnection], Union[bool, None]]]
        self.__closed = False
Beispiel #34
0
 def __init__(self, url, auto_reconnect=True, auto_reconnect_timeout=0.5, debug=False, headers=None):
     EventEmitter.__init__(self)
     self.ddpsocket = None
     self._ddp_version_index = 0
     self._retry_new_version = False
     self._is_closing = False
     self._is_reconnecting = False
     self.url = url
     self.auto_reconnect = auto_reconnect
     self.auto_reconnect_timeout = auto_reconnect_timeout
     self.debug = debug
     self.headers = [('Host', self._get_domain_from_url(self.url))].append(headers)
     self._session = None
     self._uniq_id = 0
     self._callbacks = {}
     self._init_socket()
Beispiel #35
0
    def __init__(self,
                 source=None,
                 volume=None,
                 aggressiveness=None,
                 model_dir=None,
                 lang=None,
                 config=CONFIG):
        EventEmitter.__init__(self)
        self.config = config

        # ensure default values
        for k in CONFIG["listener"]:
            if k not in self.config["listener"]:
                self.config["listener"][k] = CONFIG["listener"][k]

        volume = volume or self.config["listener"]["default_volume"]
        aggressiveness = aggressiveness or self.config["listener"][
            "default_aggressiveness"]
        model_dir = model_dir or self.config["listener"]["default_model_dir"]
        self.lang = lang or self.config["lang"]
        if "-" in self.lang:
            self.lang = self.lang.split("-")[0]

        if "{lang}" in model_dir:
            model_dir = model_dir.format(lang=self.lang)

        if not isdir(model_dir):
            if model_dir in self._default_models:
                logging.error(
                    "you need to install the package: "
                    "kaldi-chain-zamia-speech-{lang}".format(lang=self.lang))
            raise ModelNotFound

        self.rec = PulseRecorder(source_name=source, volume=volume)
        self.vad = VAD(aggressiveness=aggressiveness)
        logging.info("Loading model from %s ..." % model_dir)

        self.asr = ASR(engine=ASR_ENGINE_NNET3,
                       model_dir=model_dir,
                       kaldi_beam=self.config["listener"]["default_beam"],
                       kaldi_acoustic_scale=self.config["listener"]
                       ["default_acoustic_scale"],
                       kaldi_frame_subsampling_factor=self.config["listener"]
                       ["default_frame_subsampling_factor"])
        self._hotwords = dict(self.config["hotwords"])
Beispiel #36
0
    def __init__(self,
                 symbol='BTC-USD',
                 channels=[],
                 shouldAuth=False,
                 max_table_length=constants.MAX_TABLE_LEN,
                 websocket=None):

        EventEmitter.__init__(self)
        self.channels = channels

        if max_table_length > 0:
            self.max_table_length = max_table_length
        else:
            self.max_table_length = constants.MAX_TABLE_LEN

        self.shouldAuth = shouldAuth
        self.symbol = symbol
        self.websocket = websocket

        self.data = {
            'orderBookL2': [],
            'instrument': []
        }

        channels = self.channels
        symbol = self.symbol
        shouldAuth = self.shouldAuth
        websocket = self.websocket

        self.websocket = GdaxWebsocket()

        self.websocket.connect(
           shouldAuth=shouldAuth,
           websocket=websocket
        )

        self.websocket.on('subscribe', self.on_subscribe)
        self.websocket.on('latency', self.on_latency)
        self.channels = []
        self.subscribe_to_channels(channels)
        self.subscribe_to_instrument_channels(symbol, channels)
        self.secureChannels = []
        if shouldAuth:
            self.subscribe_to_secure_instrument_channels(symbol, channels)
Beispiel #37
0
    def __init__(self):
        """Constructor."""
        # run the superclass constructor
        EventEmitter.__init__(self)

        # Model initialization code
        self.participant_id = ""
        self.experiment_file = None
        self.sensors = []
        self.experiment = None

        # define important directories for external (not program code) files
        homedir = os.environ["HOME"]
        drop_home = os.path.join(homedir, "Documents", "drop_data")
        self.rootdir = drop_home
        self.savedir = os.path.join(drop_home, "recordings")
        self.experimentdir = os.path.join(drop_home, "experiments")
        self.mediadir = os.path.join(drop_home, "media")
        self.plugindir = os.path.join(drop_home, "plugins")
        self.dependenciesdir = os.path.join(drop_home, "dependencies")

        # check that saving, experiment etc directories are present
        utils.dircheck(self.savedir)
        utils.dircheck(self.experimentdir)
        utils.dircheck(self.mediadir)
        utils.dircheck(self.plugindir)
        utils.dircheck(self.dependenciesdir)

        # put the plugins-directory and dependenciesdir to python path
        sys.path.append(self.plugindir)
        sys.path.append(self.dependenciesdir)

        # temporary? keyboard-contigency list
        self.keyboard_contigency = []

        # initialize plugin manager
        self.pluginmanager = PluginManager(plugin_locator=DropPluginLocator())
        self.pluginmanager.setPluginPlaces([self.plugindir])
        self.pluginmanager.collectPlugins()

        # initialize pygtk-view
        self.ec = DPV(self, self.mediadir, self.experimentdir)
        self.ec.main()
Beispiel #38
0
 def __init__(self,
              url,
              auto_reconnect=True,
              auto_reconnect_timeout=0.5,
              debug=False):
     EventEmitter.__init__(self)
     self.ddpsocket = None
     self._ddp_version_index = 0
     self._retry_new_version = False
     self._is_closing = False
     self._is_reconnecting = False
     self.url = url
     self.auto_reconnect = auto_reconnect
     self.auto_reconnect_timeout = auto_reconnect_timeout
     self.debug = debug
     self._session = None
     self._uniq_id = 0
     self._callbacks = {}
     self._init_socket()
Beispiel #39
0
    def __init__(self, initial_value, value_forwarder=None):
        """
        Initialize the object.

        initial_value -- the initial value
        value_forwarder -- the method that updates the actual value on the
                           thing
        """
        EventEmitter.__init__(self)
        self.last_value = initial_value

        if value_forwarder is None:

            def fn(_):
                raise AttributeError('Read-only value')

            self.value_forwarder = fn
        else:
            self.value_forwarder = value_forwarder
Beispiel #40
0
 def __init__(self,
              steamid,
              key=None,
              language='en',
              identity_secret='',
              poll_delay=30):
     EventEmitter.__init__(self)
     self.session = aiohttp.ClientSession()
     ConfManager.__init__(self, identity_secret, steamid, self.session)
     self.steamid = SteamID(steamid)
     if not self.steamid.isValid(
     ) or not self.steamid.type == SteamID.Type['INDIVIDUAL']:
         raise ValueError(
             f"Steam ID {self.steamid} is not valid, or is not a user ID")
     self.key = key
     self.language = language
     self.poll_delay = poll_delay
     self.logged_in = False
     self._trade_cache = {}
     self._conf_cache = {}
Beispiel #41
0
    def __init__(self, master, remoteUri):
        tk.Frame.__init__(self, master)
        EventEmitter.__init__(self)

        self.rowconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)
        self.rowconfigure(2, weight=2)
        self.columnconfigure(0, weight=1)
        self.columnconfigure(1, weight=1)

        self.TITLE = tk.Label(self, text='Connected with', font=(None, 16))
        self.TITLE.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=0)

        self.URI = tk.Label(self, font=(None, 16))
        self.URI['text'] = remoteUri
        self.URI.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=1)

        self.HANGUP = tk.Button(self, text='HANGUP', font=(None, 16), command=self.hangup)
        self.HANGUP.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=2)

        self.DIALPAD = DialPadFrame(self)
        self.DIALPAD.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=0, column=1, rowspan=3)
Beispiel #42
0
    def __init__(self, master, remoteUri):
        tk.Frame.__init__(self, master)
        EventEmitter.__init__(self)

        self.rowconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)
        self.rowconfigure(2, weight=2)
        self.columnconfigure(0, weight=1)
        self.columnconfigure(1, weight=1)

        self.TITLE = tk.Label(self, text='Incoming call from', font=(None, 16))
        self.TITLE.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=0, columnspan=2)

        self.URI = tk.Label(self, font=(None, 16))
        self.URI['text'] = remoteUri
        self.URI.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=1, columnspan=2)

        self.ACCEPT = tk.Button(self, text='ACCEPT', font=(None, 16), command=self.accept)
        self.ACCEPT.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=2, column=0)

        self.DECLINE = tk.Button(self, text='DECLINE', font=(None, 16), command=self.decline)
        self.DECLINE.grid(sticky=tk.N+tk.E+tk.S+tk.W, row=2, column=1)
Beispiel #43
0
 def __init__(self,
              url,
              auto_reconnect=True,
              auto_reconnect_timeout=0.5,
              debug=False,
              headers=None):
     EventEmitter.__init__(self)
     self.ddpsocket = None
     self._ddp_version_index = 0
     self._retry_new_version = False
     self._is_closing = False
     self._is_reconnecting = False
     self.url = url
     self.auto_reconnect = auto_reconnect
     self.auto_reconnect_timeout = auto_reconnect_timeout
     self.debug = debug
     self.headers = [('Host', self._get_domain_from_url(self.url))
                     ].append(headers)
     self._session = None
     self._uniq_id = 0
     self._callbacks = {}
     self._init_socket()
Beispiel #44
0
    def __init__(self):
        """Constructor."""
        # run the superclass constructor
        EventEmitter.__init__(self)

        # Model initialization code
        self.sensors = []
        self.tags = []

        # define important directories for external (not program code) files
        homedir = os.environ["HOME"]
        ldrop_home = os.path.join(homedir, "Documents", "ldrop_data")
        self.rootdir = ldrop_home
        self.plugindir = os.path.join(ldrop_home, "plugins")
        self.savedir = os.path.join(ldrop_home, "recordings")

        # check that saving, experiment etc directories are present
        utils.dircheck(self.savedir)
        utils.dircheck(self.plugindir)

        # put the plugins-directory
        sys.path.append(self.plugindir)

        # temporary? keyboard-contigency list
        self.keyboard_contigency = []

        # initialize plugin manager
        self.pluginmanager = PluginManager(plugin_locator=LdropPluginLocator())
        self.pluginmanager.setPluginPlaces([self.plugindir])
        self.pluginmanager.collectPlugins()
        self.gui = []

        self.play_callback = None
        self.stop_callback = None
        self.continue_callback = None
        self.data_callback = None

        self.participant_id = ""
Beispiel #45
0
 def __init__(self, verification_token):
     EventEmitter.__init__(self)
     self.verification_token = verification_token