获取摇周边的设备及用户信息
        详情请参考
        http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html

        :param ticket: 摇周边业务的ticket，可在摇到的URL中得到，ticket生效时间为30分钟
        :return: 设备及用户信息
973480
def get_shake_info(self, ticket):
        
        res = self._post(
            'shakearound/user/getshakeinfo',
            data={
                'ticket': ticket
            },
            result_processor=lambda x: x['data']
        )
        return res
1283157
def view_tickets(self, id, **kwargs):
        ""
        api_path = "/api/v2/views/{id}/tickets.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
972999
public function checkTicket($ticket)
    {
        $url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['ticket' => $ticket]);
    }
736711
def verify_ticket(self, ticket, **kwargs):
        

        try:
            from xml.etree import ElementTree
        except ImportError:
            from elementtree import ElementTree

        page = self.fetch_saml_validation(ticket)

        try:
            user = None
            attributes = {}
            response = page.content
            tree = ElementTree.fromstring(response)
            # Find the authentication status
            success = tree.find('.//' + SAML_1_0_PROTOCOL_NS + 'StatusCode')
            if success is not None and success.attrib['Value'].endswith(':Success'):
                # User is validated
                name_identifier = tree.find('.//' + SAML_1_0_ASSERTION_NS + 'NameIdentifier')
                if name_identifier is not None:
                    user = name_identifier.text
                attrs = tree.findall('.//' + SAML_1_0_ASSERTION_NS + 'Attribute')
                for at in attrs:
                    if self.username_attribute in list(at.attrib.values()):
                        user = at.find(SAML_1_0_ASSERTION_NS + 'AttributeValue').text
                        attributes['uid'] = user

                    values = at.findall(SAML_1_0_ASSERTION_NS + 'AttributeValue')
                    if len(values) > 1:
                        values_array = []
                        for v in values:
                            values_array.append(v.text)
                            attributes[at.attrib['AttributeName']] = values_array
                    else:
                        attributes[at.attrib['AttributeName']] = values[0].text
            return user, attributes, None
        finally:
            page.close()
672915
public function getTicket()
    {
        $key = 'stoneworld.wechat.jsapi_ticket.' . $this->appId;

        // for php 5.3
        $appId = $this->appId;
        $appSecret = $this->appSecret;
        $cache = $this->cache;
        $apiTicket = self::API_TICKET;

        return $this->cache->get(
            $key,
            function ($key) use ($appId, $appSecret, $cache, $apiTicket) {
                $http = new Http(new AccessToken($appId, $appSecret));

                $result = $http->get($apiTicket);

                $cache->set($key, $result['ticket'], $result['expires_in']);

                return $result['ticket'];
            }
        );
    }
1054110
private static int getTimeout(final Ticket ticket) {
        val ttl = ticket.getExpirationPolicy().getTimeToLive().intValue();
        if (ttl == 0) {
            return 1;
        }
        return ttl;
    }
297117
protected function refresh_js_api_ticket(){
        $config = $this -> config;
        if(!isset($config['app_id']) || !isset($config['app_secret']) || empty($config['app_id']) || empty($config['app_secret'])){
            if ($this->business_interface) $this->business_interface->log('refresh_js_api_ticket APP_ID or APP_SECRET must be set');
            return null;
        }
        $access_token = $this -> get_access_token();
        if (empty($access_token)){
            if ($this->business_interface) $this->business_interface->log('refresh_js_api_ticket access_token is null');
            return null;
        }
        $url = self::API_GET_TICKET."access_token={$access_token}&type=jsapi";
        $result = $this -> curl($url);
        if (isset($result['errcode']) && $result['errcode'] == 0 && isset($result['ticket'])){
            if ($this->business_interface)$this->business_interface->cache_js_api_ticket($result);
            return $result['ticket'];
        }elseif (isset($result['errmsg']) && $result['errmsg'] && $this->business_interface){
            $this->business_interface->log("refresh_js_api_ticket exception:{$result['errmsg']}");
        }
        return null;
    }
1026320
public function getJsTicket($appid = '', $jsapi_ticket = '', $access_token = '')
    {
        if (empty($access_token)) {
            if (!$this->access_token && !$this->getAccessToken()) {
                return false;
            }
            $access_token = $this->access_token;
        }
        if (empty($appid)) {
            $appid = $this->appid;
        }
        # 手动指定token，优先使用
        if ($jsapi_ticket) {
            $this->jsapi_ticket = $jsapi_ticket;
            return $this->jsapi_ticket;
        }
        # 尝试从缓存中读取
        $cache = 'wechat_jsapi_ticket_' . $appid;
        $jt = Tools::getCache($cache);
        if ($jt) {
            return $this->jsapi_ticket = $jt;
        }
        # 检测事件注册
        if (isset(Loader::$callback[__FUNCTION__])) {
            return $this->jsapi_ticket = call_user_func_array(Loader::$callback[__FUNCTION__], array(&$this, &$cache));
        }
        # 调接口获取
        $result = Tools::httpGet(self::API_URL_PREFIX . self::GET_TICKET_URL . "access_token={$access_token}" . '&type=jsapi');
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                return $this->checkRetry(__FUNCTION__, func_get_args());
            }
            $this->jsapi_ticket = $json['ticket'];
            Tools::setCache($cache, $this->jsapi_ticket, $json['expires_in'] ? intval($json['expires_in']) - 100 : 3600);
            return $this->jsapi_ticket;
        }
        return false;
    }
1325965
def get_attachments_ids(self, ticket_id):
        
        attachments = self.get_attachments(ticket_id)
        return [int(at[0]) for at in attachments] if attachments else attachments
1124342
async def get_ticket(self, request):
        
        session = await get_session(request)
        return session.get(self.cookie_name)
334725
public function getQrCode($ticket)
    {
        $baseUri = 'https://mp.weixin.qq.com/cgi-bin/showqrcode';
        $params = [
            'ticket' => $ticket,
        ];

        $response = $this->requestRaw($baseUri, 'GET', $params);

        return [
            'status' => $response->getStatusCode(),
            'reason' => $response->getReasonPhrase(),
            'headers' => $response->getHeaders(),
            'body' => strval($response->getBody()),
            'url' => $baseUri.'?'.http_build_query($params),
        ];
    }
858077
protected function getTicketFromWeChat()
    {
        $url    = sprintf(self::TICKET_URL, $this->getAccessToken()->getAccessToken());
        $client = $this->getHttpClient();
        $client->setUrl($url);
        $client->setHeaderArray(['Content-Type: application/json']);

        if (!$client->exec()) {
            throw new Exception("error when get js api ticket from WeChat({$url})");
        }

        $result = json_decode($client->getResponse(), true);
        if (!(isset($result['ticket']) && (isset($result['expires_in'])))) {
            throw new Exception("error result when get js api ticket from WeChat({$url})");
        }

        return ['ticket' => $result['ticket'], 'expire'=> $result['expires_in']];
    }
736204
def fetch_points_of_sales(self, ticket=None):
        
        ticket = ticket or self.get_or_create_ticket('wsfe')

        client = clients.get_client('wsfe', self.is_sandboxed)
        response = client.service.FEParamGetPtosVenta(
            serializers.serialize_ticket(ticket),
        )
        check_response(response)

        results = []
        for pos_data in response.ResultGet.PtoVenta:
            results.append(PointOfSales.objects.update_or_create(
                number=pos_data.Nro,
                issuance_type=pos_data.EmisionTipo,
                owner=self,
                defaults={
                    'blocked': pos_data.Bloqueado == 'N',
                    'drop_date': parsers.parse_date(pos_data.FchBaja),
                }
            ))

        return results
1009484
def ticket_skips(self, ticket_id, **kwargs):
        ""
        api_path = "/api/v2/tickets/{ticket_id}/skips.json"
        api_path = api_path.format(ticket_id=ticket_id)
        return self.call(api_path, **kwargs)
1368487
def get_ticket(self, ticket_id):
        
        mask = """mask[id, title, assignedUser[firstName, lastName],status,
                  createDate,lastEditDate,updates[entry,editor],updateCount, priority]"""
        return self.ticket.getObject(id=ticket_id, mask=mask)
820595
public OvhTicket tickets_ticketId_GET(Long ticketId) throws IOException {
		String qPath = "/support/tickets/{ticketId}";
		StringBuilder sb = path(qPath, ticketId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhTicket.class);
	}
358185
def get_agent_jsapi_ticket(self):
        
        ticket_key = '{}_agent_jsapi_ticket'.format(self._client.corp_id)
        expires_at_key = '{}_agent_jsapi_ticket_expires_at'.format(self._client.corp_id)
        ticket = self.session.get(ticket_key)
        expires_at = self.session.get(expires_at_key, 0)
        if not ticket or expires_at < int(time.time()):
            jsapi_ticket = self.get_agent_ticket()
            ticket = jsapi_ticket['ticket']
            expires_at = int(time.time()) + int(jsapi_ticket['expires_in'])
            self.session.set(ticket_key, ticket)
            self.session.set(expires_at_key, expires_at)
        return ticket