Gets the user with the specified username. If user was not found, the bot will send a message on Telegram.

@param username the username of the required user
@param ctx      the message context with the originating user
@return the id of the user
541696
protected int getUserIdSendError(String username, MessageContext ctx) {
    try {
      return getUser(username).getId();
    } catch (IllegalStateException ex) {
      silent.send(getLocalizedMessage(USER_NOT_FOUND, ctx.user().getLanguageCode(), username), ctx.chatId());
      throw propagate(ex);
    }
  }
841634
def get_user(self, username):
        

        r = self._query_('/users/%s' % username, 'GET')

        result = User(r.json())
        return result
1271176
@SuppressWarnings("unchecked")
    public LdapUser getLdapUser(final String username) {
        final Query query = pm.newQuery(LdapUser.class, "username == :username");
        final List<LdapUser> result = (List<LdapUser>) query.execute(username);
        return Collections.isEmpty(result) ? null : result.get(0);
    }
1149976
def GetUsername(self, event, default_username='-'):
    
    username = getattr(event, 'username', None)
    if username and username != '-':
      return username

    session_identifier = event.GetSessionIdentifier()
    if session_identifier is None:
      return default_username

    user_sid = getattr(event, 'user_sid', None)
    username = self._knowledge_base.GetUsernameByIdentifier(
        user_sid, session_identifier=session_identifier)
    return username or default_username
776185
public static dbuser get(nitro_service service, String username) throws Exception{
		dbuser obj = new dbuser();
		obj.set_username(username);
		dbuser response = (dbuser) obj.get_resource(service);
		return response;
	}
1308769
private static String getCurrentUserName() {
        Authentication a = SecurityContextHolder.getContext().getAuthentication();
        if (a == null) return null;
        org.springframework.security.core.userdetails.User u =
                (org.springframework.security.core.userdetails.User)
                        a.getPrincipal();
        if (u == null) return null;
        return u.getUsername();
    }
107164
def getUser(self):
        
        username = self.getUsername()
        if not username:
            return None
        user = api.user.get(userid=username)
        return user
565965
def _get_user(self, username):
        
        if username is None:
            return {}
        ret = {}
        for b in self.backends:
            try:
                tmp = self.backends[b].get_user(username)
            except UserDoesntExist as e:
                self._handle_exception(e)
                tmp = {}
            self._merge_user_attrs(tmp, ret, b)

        cherrypy.log.error(
            msg="user '" + username + "' attributes " + str(ret),
            severity=logging.DEBUG
        )
        return ret
709348
public UserStateResult getUserState(String username)
            throws APIConnectionException, APIRequestException {
        StringUtils.checkUsername(username);
        ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/userstat");
        return UserStateResult.fromResponse(response, UserStateResult.class);
    }
1070470
def get_user(self, username):
        """"""
        ret = {}
        tmp = self._get_user(self._byte_p2(username), ALL_ATTRS)
        if tmp is None:
            raise UserDoesntExist(username, self.backend_name)
        attrs_tmp = tmp[1]
        for attr in attrs_tmp:
            value_tmp = attrs_tmp[attr]
            if len(value_tmp) == 1:
                ret[attr] = value_tmp[0]
            else:
                ret[attr] = value_tmp
        return ret
477322
@RequestMapping(value = "/findByUsername", method = RequestMethod.GET)
	public @ResponseBody
	ResponseAccount findByUsername(
			@RequestParam(value = "username", required = true) String username) {
		logger.debug("Received request to get account by username");

		ResponseAccount acconut = accountService.getAccountByUsername(username);

		return acconut;

	}
686782
def get_username(self):
        
        username = self.get_as_nullable_string("username")
        username = username if username != None else self.get_as_nullable_string("user")
        return username
1010959
def get_user(user_or_username=None):
    
    if user_or_username is None:
        return None
    if hasattr(user_or_username, "getUserId"):
        return ploneapi.user.get(user_or_username.getUserId())
    return ploneapi.user.get(userid=u.to_string(user_or_username))
1126359
def get_user_by_username(name)
      resp = request('getUserByUsername', username: name)['user']
      resp['user_id'].nil? ? nil : User.new(self, resp)
    end
20101
private String toDN(String username)
	{
		String userDN = new StringBuilder(userDnPrefix).append(username).append(this.userDnSuffix).toString();
		return userDN;
	}
264429
function getUser(username, done) {
  return getModels(function(m) {
    return m.collections.user.findOne({ username })
      .populate("tokens")
      .populate("groups")
      .populate("leading")
      .exec(done);
  });
}
661040
private PortalUser getPortalUser(final String userName) {
        return jdbcOperations.execute(
                (ConnectionCallback<PortalUser>)
                        con -> {
                            PortalUser portalUser = null;
                            PreparedStatement pstmt = null;

                            try {
                                String query = "SELECT USER_ID FROM UP_USER WHERE USER_NAME=?";

                                pstmt = con.prepareStatement(query);
                                pstmt.setString(1, userName);

                                ResultSet rs = null;
                                try {
                                    if (log.isDebugEnabled())
                                        log.debug(
                                                "RDBMUserIdentityStore::getPortalUID(userName="
                                                        + userName
                                                        + "): "
                                                        + query);
                                    rs = pstmt.executeQuery();
                                    if (rs.next()) {
                                        portalUser = new PortalUser();
                                        portalUser.setUserId(rs.getInt("USER_ID"));
                                        portalUser.setUserName(userName);
                                    }
                                } finally {
                                    try {
                                        if (rs != null) {
                                            rs.close();
                                        }
                                    } catch (Exception e) {
                                    }
                                }
                            } finally {
                                try {
                                    if (pstmt != null) {
                                        pstmt.close();
                                    }
                                } catch (Exception e) {
                                }
                            }

                            return portalUser;
                        });
    }