批量为用户打标签

        :param tag_id: 标签 ID
        :param user_id: 用户 ID, 可以是单个或者列表

        :return: 返回的 JSON 数据包
559635
def tag_user(self, tag_id, user_id):
        
        data = {'tagid': tag_id}
        if isinstance(user_id, (tuple, list)):
            data['openid_list'] = user_id
        else:
            data['openid_list'] = [user_id, ]
        return self._post('tags/members/batchtagging', data=data)
748842
async def _get_person_json(self, id_, url_params=None):
        
        url = self.url_builder(
            'person/{person_id}',
            dict(person_id=id_),
            url_params=url_params or OrderedDict(),
        )
        data = await self.get_data(url)
        return data
667289
def v1_stream_id_associations(tags, stream_id):
    '''
    '''
    stream_id = stream_id.decode('utf-8').strip()
    return {'associations': tags.assocs_by_stream_id(stream_id)}
681602
def get_post_by_id(self, post_id):
        
        r = None
        post_id = _as_int(post_id)
        with self._engine.begin() as conn:
            try:
                post_statement = sqla.select([self._post_table]) \
                    .where(self._post_table.c.id == post_id) \
                    .alias('post')

                joined_statement = post_statement.join(self._tag_posts_table) \
                    .join(self._tag_table) \
                    .join(self._user_posts_table) \
                    .alias('join')

                # Note this will retrieve one row per tag
                all_rows = conn.execute(
                    sqla.select([joined_statement])
                ).fetchall()
                r = self._serialise_posts_and_tags_from_joined_rows(
                    all_rows
                )[0]

            except Exception as e:
                self._logger.exception(str(e))
                r = None
        return r
1314681
def delete_tag_for_component(user, c_id, tag_id):
    """"""
    # Todo : check c_id and tag_id exist in db

    query = _TABLE_TAGS.delete().where(_TABLE_TAGS.c.tag_id == tag_id and
                                       _TABLE_TAGS.c.component_id == c_id)

    try:
        flask.g.db_conn.execute(query)
    except sa_exc.IntegrityError:
        raise dci_exc.DCICreationConflict(_TABLE_TAGS.c.tag_id, 'tag_id')

    return flask.Response(None, 204, content_type='application/json')
1122211
def tag_structure(tag, site):
    
    return {'tag_id': tag.pk,
            'name': tag.name,
            'count': tag.count,
            'slug': tag.name,
            'html_url': '%s://%s%s' % (
                PROTOCOL, site.domain,
                reverse('zinnia:tag_detail', args=[tag.name])),
            'rss_url': '%s://%s%s' % (
                PROTOCOL, site.domain,
                reverse('zinnia:tag_feed', args=[tag.name]))
            }
756402
def get_tag_html(tag_id):
    
    tag_data = get_lazy_tag_data(tag_id)
    tag = tag_data['tag']
    args = tag_data['args']
    kwargs = tag_data['kwargs']
    lib, tag_name = get_lib_and_tag_name(tag)

    args_str = ''
    if args:
        for arg in args:
            if isinstance(arg, six.string_types):
                args_str += "'{0}' ".format(arg)
            else:
                args_str += "{0} ".format(arg)

    kwargs_str = ''
    if kwargs:
        for name, value in kwargs.items():
            if isinstance(value, six.string_types):
                kwargs_str += "{0}='{1}' ".format(name, value)
            else:
                kwargs_str += "{0}={1} ".format(name, value)

    html = '{{% load {lib} %}}{{% {tag_name} {args}{kwargs}%}}'.format(
        lib=lib, tag_name=tag_name, args=args_str, kwargs=kwargs_str)

    return html
1236405
def get_tag(self, tagname, tagidx):
        
        return '%s=%s' % (tagname, decode(getattr(self, tagname)[tagidx]))
1100590
public function actionFollowerTag()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $tagId = Yii::$app->request->post('tag_id', null);
        if (($tag = Tag::findOne($tagId)) == null) {
            throw new NotFoundHttpException ();
        } else {
            /** @var \yuncms\user\models\User $user */
            $user = Yii::$app->user->identity;
            if ($user->hasTagValues($tag->id)) {
                $user->removeTagValues($tag->id);
                $user->save();
                return ['status' => 'unFollowed'];
            } else {
                $user->addTagValues($tag->id);
                $user->save();
                return ['status' => 'followed'];
            }
        }
    }
974989
def get_template_as_json(template_id, **kwargs):
    
    user_id = kwargs['user_id']
    return json.dumps(get_template_as_dict(template_id, user_id=user_id))
1192506
public List<Integer> getUserTags(String openId) {
        String url = WxEndpoint.get("url.tag.user.gettag");
        Map<String, Object> map = new HashMap<>();
        map.put("openid", openId);
        String response = wxClient.post(url, JsonMapper.nonEmptyMapper().toJson(map));
        TagIdsWrapper tagIdsWrapper = JsonMapper.defaultMapper().fromJson(response, TagIdsWrapper.class);
        return tagIdsWrapper.getList();
    }
798138
def by_tag_id(self,tag_id):
		'''

		'''
		query = meta.Session.query(TagSemanticTag).filter(TagSemanticTag.tag_id==tag_id)
		return query.first()
1210222
async def get_user(self, user_id, page_id):
        

        access_token = self._access_token(page_id=page_id)

        params = {
            'fields': 'first_name,last_name,profile_pic,locale,timezone'
                      ',gender',
            'access_token': access_token,
        }

        url = GRAPH_ENDPOINT.format(user_id)

        get = self.session.get(url, params=params)
        async with get as r:
            await self._handle_fb_response(r)
            return await r.json()
1141856
def get_by_uid(post_id):
        '''
        
        '''
        return TabPost2Tag.select(
            TabPost2Tag,
            TabTag.name.alias('tag_name'),
            TabTag.uid.alias('tag_uid')
        ).join(
            TabTag, on=(TabPost2Tag.tag_id == TabTag.uid)
        ).where(
            (TabPost2Tag.post_id == post_id) & (TabTag.kind == 'z')
        )
1354173
public function getUserListByTag($tagid, $next_openid = '')
    {
        $url = 'https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['tagid' => $tagid, 'next_openid' => $next_openid]);
    }
635922
def tagged(self, tag, offset=0, count=25):
        ''''''
        return json.loads(self.client('tag', 'get', tag, offset, count))
31832
def get_infos_with_id(self, uid):
        

        _logid = uid
        _user_info_url = USER_INFO_URL.format(logid=_logid)
        return self._request_api(url=_user_info_url).json()