Fetch user journals from user

        :param username: name of user to retrieve journals from
        :param featured: fetch only featured or not
        :param offset: the pagination offset
        :param limit: the pagination limit
492009
def browse_userjournals(self, username, featured=False, offset=0, limit=10):

        

        response = self._req('/browse/user/journals', {
            "username":username,
            "featured":featured,
            "offset":offset,
            "limit":limit
        })

        deviations = []

        for item in response['results']:
            d = Deviation()
            d.from_dict(item)
            deviations.append(d)

        return {
            "results" : deviations,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }
359155
def find_user(self, username=None, email=None):
        
        if username:
            return (
                self.get_session.query(self.user_model)
                .filter(func.lower(self.user_model.username) == func.lower(username))
                .first()
            )
        elif email:
            return (
                self.get_session.query(self.user_model).filter_by(email=email).first()
            )
619835
def get_user(self, username):
        

        response = self._get(self.rest_url + "/user",
                             params={"username": username,
                                     "expand": "attributes"})

        if not response.ok:
            return None

        return response.json()
835661
def get_user_properties(user_or_username):
    
    user = get_user(user_or_username)
    if user is None:
        return {}
    if not callable(user.getUser):
        return {}
    out = {}
    plone_user = user.getUser()
    for sheet in plone_user.listPropertysheets():
        ps = plone_user.getPropertysheet(sheet)
        out.update(dict(ps.propertyItems()))
    return out
92802
def fetchAllUsers(self, rawResults = False) :
        """"""
        r = self.connection.session.get(self.URL)
        if r.status_code == 200 :
            data = r.json()
            if rawResults :
                return data["result"]
            else :
                res = []
                for resu in data["result"] :
                    u = User(self, resu)
                    res.append(u)
                return res
        else :
            raise ConnectionError("Unable to get user list", r.url, r.status_code)
625248
def get_member(self, username, api=None):
        
        api = api if api else self._API

        response = api.get(
            url=self._URL['member'].format(id=self.id, username=username),
        )
        data = response.json()
        return Member(api=api, **data)
607510
def user(self, user):
        """"""

        resource = self.RUSER + '/' + user
        params = {}

        result = [page for page in self._fetch(resource, params)]

        return result[0]
477136
def get_subscriptions(self, publication_id=None, owner_id=None,
                          since_when=None, limit_to=200, max_calls=None,
                          start_record=0, verbose=False):
        
        query = "SELECT Objects() FROM Subscription"

        # collect all where parameters into a list of
        # (key, operator, value) tuples
        where_params = []

        if owner_id:
            where_params.append(('owner', '=', "'%s'" % owner_id))
        if publication_id:
            where_params.append(('publication', '=', "'%s'" % publication_id))
        if since_when:
            d = datetime.date.today() - datetime.timedelta(days=since_when)
            where_params.append(
                ('LastModifiedDate', ">", "'%s 00:00:00'" % d))

        if where_params:
            query += " WHERE "
            query += " AND ".join(
                ["%s %s %s" % (p[0], p[1], p[2]) for p in where_params])

        subscription_list = self.get_long_query(
            query, limit_to=limit_to, max_calls=max_calls,
            start_record=start_record, verbose=verbose)

        return subscription_list
522988
def get_watchers(self, username, offset=0, limit=10):

        

        response = self._req('/user/watchers/{}'.format(username), {
            'offset' : offset,
            'limit' : limit
        })

        watchers = []

        for item in response['results']:
            w = {}
            w['user'] = User()
            w['user'].from_dict(item['user'])
            w['is_watching'] = item['is_watching']
            w['lastvisit'] = item['lastvisit']
            w['watch'] = {
                "friend" : item['watch']['friend'],
                "deviations" : item['watch']['deviations'],
                "journals" : item['watch']['journals'],
                "forum_threads" : item['watch']['forum_threads'],
                "critiques" : item['watch']['critiques'],
                "scraps" : item['watch']['scraps'],
                "activity" : item['watch']['activity'],
                "collections" : item['watch']['collections']
            }

            watchers.append(w)

        return {
            "results" : watchers,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }
234576
def get_subscriptions(self, limit=100, offset=0, params={}):
        
        url = self.SUBSCRIPTIONS_URL + "?limit=%s&offset=%s" % (limit, offset)

        for key, value in params.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
1048207
def get_user(self, username="", ext_collections=False, ext_galleries=False):

        

        if not username and self.standard_grant_type == "authorization_code":
            response = self._req('/user/whoami')
            u = User()
            u.from_dict(response)
        else:
            if not username:
                raise DeviantartError("No username defined.")
            else:
                response = self._req('/user/profile/{}'.format(username), {
                    'ext_collections' : ext_collections,
                    'ext_galleries' : ext_galleries
                })
                u = User()
                u.from_dict(response['user'])

        return u
843312
def count(cls, user_id):
        
        return cls.query.with_entities(
            cls.user_id).filter_by(user_id=user_id).count()
710754
def user_stars(self, user_id, extra_query_params={}):
        
        return self.do("GET", "users/{user_id}/stars",
                       url_params={"user_id": user_id},
                       query_params=extra_query_params)
1240227
def get_users(self, filter=None, sortBy=None, sortOrder=None,
            startIndex=None, count=None):
        
        self.assert_has_permission('scim.read')

        params = {}
        if filter:
            params['filter'] = filter

        if sortBy:
            params['sortBy'] = sortBy

        if sortOrder:
            params['sortOrder'] = sortOrder

        if startIndex:
            params['startIndex'] = startIndex

        if count:
            params['count'] = count

        return self._get(self.uri + '/Users', params=params)
1053238
def get_user(uwnetid, include_course_summary=True):
    
    url = author_uid_url(uwnetid) + "?%s" % CUSTOM_FIELD
    if include_course_summary:
        url = "%s&%s" % (url, COURSE_SUMMARY)
    resp = get_resource(url)
    return _process_json_resp_data(resp)
340841
def index(self, user):
        
        uri = self.client.remote + '/users/{0}/feeds'.format(user)
        return self.client.get(uri)
857326
def get_authuser_by_name(cls, request):
        
        username = authenticated_userid(request)
        if username:
            return cls.get_item(username=username)