Test the login status from the returned communication of the
        server.

        :param data: bytes received from server during login
        :type data: list of bytes

        :return boolean, True when you are logged in.
490462
def _logged_in_successful(data):
        
        if re.match(r'^:(testserver\.local|tmi\.twitch\.tv)'
                    r' NOTICE \* :'
                    r'(Login unsuccessful|Error logging in)*$',
                    data.strip()):
            return False
        else:
            return True
689255
def _backlog(self, data):
        

        try:
            data = json.loads(data)
        except ValueError as e:
            self.log.info("Status contents are %r" % data)
            self.log.exception(e)
            self.log.info("Skipping backlog retrieval.")
            return

        last = data['message']['body']
        if isinstance(last, str):
            last = json.loads(last)

        then = last['timestamp']
        now = int(time.time())

        retrieved = 0
        for message in self.get_datagrepper_results(then, now):
            # Take the messages from datagrepper and remove any keys that were
            # artificially added to the message.  The presence of these would
            # otherwise cause message crypto validation to fail.
            message = fedmsg.crypto.utils.fix_datagrepper_message(message)

            if message['msg_id'] != last['msg_id']:
                retrieved = retrieved + 1
                self.incoming.put(dict(body=message, topic=message['topic']))
            else:
                self.log.warning("Already seen %r; Skipping." % last['msg_id'])

        self.log.info("Retrieved %i messages from datagrepper." % retrieved)
544837
def is_following(self, login):
        
        json = False
        if login:
            url = self._build_url('user', 'following', login)
            json = self._boolean(self._get(url), 204, 404)
        return json
637137
def receive_data(self, data):
        # type: (bytes) -> None
        
        self._h11_connection.receive_data(data)
        while True:
            try:
                event = self._h11_connection.next_event()
            except h11.RemoteProtocolError:
                raise RemoteProtocolError(
                    "Bad HTTP message", event_hint=RejectConnection()
                )
            if (
                isinstance(event, h11.ConnectionClosed)
                or event is h11.NEED_DATA
                or event is h11.PAUSED
            ):
                break

            if self.client:
                if isinstance(event, h11.InformationalResponse):
                    if event.status_code == 101:
                        self._events.append(self._establish_client_connection(event))
                    else:
                        self._events.append(
                            RejectConnection(
                                headers=event.headers,
                                status_code=event.status_code,
                                has_body=False,
                            )
                        )
                        self._state = ConnectionState.CLOSED
                elif isinstance(event, h11.Response):
                    self._state = ConnectionState.REJECTING
                    self._events.append(
                        RejectConnection(
                            headers=event.headers,
                            status_code=event.status_code,
                            has_body=True,
                        )
                    )
                elif isinstance(event, h11.Data):
                    self._events.append(
                        RejectData(data=event.data, body_finished=False)
                    )
                elif isinstance(event, h11.EndOfMessage):
                    self._events.append(RejectData(data=b"", body_finished=True))
                    self._state = ConnectionState.CLOSED
            else:
                if isinstance(event, h11.Request):
                    self._events.append(self._process_connection_request(event))
1113644
def do_status(self, _):
        '''  '''
        server_status = self.server.is_server_running()
        if server_status == 'yes':
            print 'Server: ' + colorize('currently online', 'green')
        elif server_status == 'no':
            print 'Server: ' + colorize('currently offline', 'red')
        elif server_status == 'maybe':
            print 'Server: ' + colorize('status unknown', 'yellow')
        elif server_status == 'blocked':
            print 'Server: ' + colorize('blocked', 'red')
311373
def handle_readable(client):
    

    data = client.recv(1028)
    if data == b'':
        return False
    client.sendall(b'SERVER: ' + data)
    print(threading.active_count())
    return True
1020210
def login(self, url, payload):
        
        self.auth = requests.Session()
        try:
            self.auth.post(url, data=payload, timeout=self.default_timeout)
            print("successfully logged in to %s" % url)
            return True
        except:
            return False
736009
def receive_message(self, message, data):
        
        if data[MESSAGE_TYPE] == TYPE_RECEIVER_STATUS:
            self._process_get_status(data)

            return True

        elif data[MESSAGE_TYPE] == TYPE_LAUNCH_ERROR:
            self._process_launch_error(data)

            return True

        return False
58280
def decode_data(self, data):
        
        assert self.get_empty() is False
        assert self._data_encoded is True
        if self._block_allowed:
            data = self._decode_transfer_block_data(data)
        else:
            data = self._decode_transfer_data(data)
        return data
627973
private static Data checkData(final Data data) {
		if (Data.EMPTY.equals(data)) {
			throw new IllegalStateException("Argument 'data' must not be empty.");
		}
		return data;
	}
1007460
def has_data(self, datatype, mode, disp):
        

        # Imports
        from ..error import RepoError

        # Just try to get the data. Simply pass up all exceptions except for
        #  those if the group or data doesn't exist. DO re-raise a non-bound
        #  repo. Initialize value to DATA PRESENT (True) for case where data
        #  is present and the 'try' succeeds.
        retval = True
        try:
            self.get_data(datatype, mode, disp)
        except RepoError as RErr:
            if RErr.tc in (RErr.DATA, RErr.GROUP):
                retval = False
            ## end if
        ## end try

        # Should be good to return
        return retval
557713
def data_received(self, data):
        
        self.time_out_handle.cancel()
        self.session.update(data.decode())

        if self.session.state == STATE_STARTING:
            self.transport.write(self.method.message.encode())
            self.time_out_handle = self.loop.call_later(
                TIME_OUT_LIMIT, self.time_out)

        elif self.session.state == STATE_PLAYING:
            self.callback(SIGNAL_PLAYING)

            if self.session.session_timeout != 0:
                interval = self.session.session_timeout - 5
                self.loop.call_later(interval, self.keep_alive)

        else:
            self.stop()
553977
def success(headers = None, data = ''):
    
    passed_headers = {} if headers is None else headers
    if isinstance(data, dict): data = json.dumps(data)
    ret_headers = {'status' : 'ok'}
    ret_headers.update(passed_headers)
    return server_responce(ret_headers, data)
129725
def status(server, output, verbose):
    
    if verbose:
        log("Connecting to Entity Matching Server: {}".format(server))

    service_status = server_get_status(server)
    if verbose:
        log("Status: {}".format(service_status['status']))
    print(json.dumps(service_status), file=output)
582424
def _data(self, received_data):
        
        if self.listener.on_data(received_data) is False:
            self.stop()
            raise ListenerError(self.listener.connection_id, received_data)
1298650
def check_login(cookie, tokens, username):
    '''
    '''
    url = ''.join([
        const.PASSPORT_URL,
        '?logincheck',
        '&token=', tokens['token'],
        '&tpl=mm&apiver=v3',
        '&tt=', util.timestamp(),
        '&username=', encoder.encode_uri_component(username),
        '&isphone=false',
    ])
    headers={
        'Cookie': cookie.header_output(),
        'Referer': const.REFERER,
    }
    req = net.urlopen(url, headers=headers)
    if req:
        ubi = req.headers.get_all('Set-Cookie')
        return ubi, json.loads(req.data.decode())
    else:
        return None
1083700
def check_global_status(flag, name, oid):
    
    # only check the status, if the "no" flag is not set
    if flag:
        # get the data via snmp
        myData = get_data(sess, oid, helper)
        data_summary_output, data_long_output = state_summary(myData, name, normal_state, helper)
        add_output(data_summary_output, data_long_output, helper)