获取永久素材下载地址
        详情请参考
        https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90

        :param agent_id: 企业应用的id
        :param media_id: 媒体文件 ID
        :return: 临时素材下载地址
323373
def get_url(self, agent_id, media_id):
        
        parts = (
            'https://qyapi.weixin.qq.com/cgi-bin/material/get',
            '?access_token=',
            self.access_token,
            '&media_id=',
            media_id,
            '&agentid=',
            agent_id,
        )
        return ''.join(parts)
983524
public function getMaterial($media_id, $outType = null)
    {
        $url = "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        $result = Tools::post($url, ['media_id' => $media_id]);
        if (json_decode($result)) {
            return Tools::json2arr($result);
        }
        return is_null($outType) ? $result : $outType($result);
    }
928613
def agent(agent_id):
    '''
    
    '''
    fields = [
        ('ID', 'id'),
        ('Status', 'status'),
        ('Region', 'region'),
        ('First Contact', 'first_contact'),
        ('CPU Usage (%)', 'cpu_cur_pct'),
        ('Used Memory (MiB)', 'mem_cur_bytes'),
        ('Total slots', 'available_slots'),
        ('Occupied slots', 'occupied_slots'),
    ]
    if is_legacy_server():
        del fields[9]
        del fields[6]
    q = 'query($agent_id:String!) {' \
        '  agent(agent_id:$agent_id) { $fields }' \
        '}'
    q = q.replace('$fields', ' '.join(item[1] for item in fields))
    v = {'agent_id': agent_id}
    with Session() as session:
        try:
            resp = session.Admin.query(q, v)
        except Exception as e:
            print_error(e)
            sys.exit(1)
        info = resp['agent']
        rows = []
        for name, key in fields:
            if key == 'mem_cur_bytes' and info[key] is not None:
                info[key] = round(info[key] / 2 ** 20, 1)
            if key in info:
                rows.append((name, info[key]))
        print(tabulate(rows, headers=('Field', 'Value')))
327162
def download_permanent_media(self, media_id):
        
        return requests.post(
            url="https://api.weixin.qq.com/cgi-bin/material/get_material",
            params={"access_token": self.token},
            data=_json.dumps({
                "media_id": media_id
            }, ensure_ascii=False).encode("utf-8")
        )
1187465
protected static function cgi_media_uri($access_token, $media_id)
    {
        $param = [
            'access_token' => $access_token,
            'media_id' => $media_id,
        ];

        return self::CGI_MEDIA_GET_URI . http_build_query($param);
    }
1342175
def get(self, media_id):
        
        def _processor(res):
            if isinstance(res, dict):
                if 'news_item' in res:
                    # 图文素材
                    return res['news_item']
            return res

        res = self._post(
            'material/get_material',
            data={
                'media_id': media_id
            },
            result_processor=_processor
        )
        return res
49060
def location_media(location_id, request_parameters: {limit: 1000}, limit: 10)
      location = extract_location_media(location_id, request_parameters: request_parameters)
      # check if we should get more data
      paging_info = location.paging_info
      # poll more data
      while location.total_media_count < limit && paging_info[:has_next_page] do
        request_opts = {}.merge(request_parameters)
        if paging_info && paging_info[:end_cursor]
          request_opts[:max_id] = paging_info[:end_cursor]
        end
        next_page_location = extract_location_media(location_id, request_parameters: request_opts)
        location.add_media(next_page_location.media)
        paging_info = next_page_location.paging_info
        location
      end
      location
    end
194402
def find_next_video_in_playlist(self, playlist_id, cur_video_id):
        
        url = 'https://openapi.youku.com/v2/playlists/video/next.json'
        params = {
            'client_id': self.client_id,
            'playlist_id': playlist_id,
            'video_id': cur_video_id
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
143481
def by_id(self, region, encrypted_summoner_id):
        
        url, query = SummonerApiV4Urls.by_id(
            region=region, encrypted_summoner_id=encrypted_summoner_id
        )
        return self._raw_request(self.by_id.__name__, region, url, query)
597490
public MpNews getMpNews(String mediaId) {
        String url = WxEndpoint.get("url.material.mpnews.get");

        String json = String.format("{\"media_id\":\"%s\"}", mediaId);
        logger.info("get mpnews: {}", json);
        String response = wxClient.post(url, json);
        return JsonMapper.defaultMapper().fromJson(response, MpNews.class);
    }
1202469
def find_agent_host_id(this_host):
    """"""

    host_id = this_host
    try:
        for root, dirs, files in os.walk('/run/resource-agents'):
            for fi in files:
                if 'neutron-scale-' in fi:
                    host_id = 'neutron-n-' + fi.split('-')[2]
                    break
        return host_id
    except IndexError:
        return host_id
217255
def anime(self, item_id):
        
        query_string = """\
            query ($id: Int) {
                Media(id: $id, type: ANIME) {
                    title {
                        romaji
                        english
                    }
                    startDate {
                        year
                        month
                        day
                    }
                    endDate {
                        year
                        month
                        day
                    }
                    coverImage {
                        large
                    }
                    bannerImage
                    format
                    status
                    episodes
                    season
                    description
                    averageScore
                    meanScore
                    genres
                    synonyms
                    nextAiringEpisode {
                        airingAt
                        timeUntilAiring
                        episode
                    }
                }
            }
        """
        vars = {"id": item_id}
        r = requests.post(self.settings['apiurl'],
                         headers=self.settings['header'],
                         json={'query': query_string, 'variables': vars})
        jsd = r.text

        try:
            jsd = json.loads(jsd)
        except ValueError:
            return None
        else:
            return jsd
1214794
def set_cover_video_for_playlist(self, access_token, playlist_id,
                                     video_id):
        
        url = 'https://openapi.youku.com/v2/playlists/video/setcover.json'
        data = {
            'client_id': self.client_id,
            'access_token': access_token,
            'playlist_id': playlist_id,
            'video_id': video_id
        }
        r = requests.post(url, data=data)
        check_error(r)
        return r.json()['id']
399388
public GetMediaSourceDownloadResponse getMediaSourceDownload(GetMediaSourceDownloadRequest request) {

        checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!");

        InternalRequest internalRequest =
                createRequest(HttpMethodName.GET, request, PATH_MEDIA, request.getMediaId());
        internalRequest.addParameter(PARA_DOWNLOAD, null);
        internalRequest.addParameter(PARA_EXPIREDINSECONDS, String.valueOf(request.getExpiredInSeconds()));

        return invokeHttpClient(internalRequest, GetMediaSourceDownloadResponse.class);
    }
159029
def get_media_list(self, media_type, offset, count):
        
        return self.post(
            url="https://api.weixin.qq.com/cgi-bin/material/batchget_material",
            data={
                "type": media_type,
                "offset": offset,
                "count": count
            }
        )
795216
def _req_lixian_get_id(self, torrent=False):
        """"""
        url = 'http://115.com/'
        params = {
            'ct': 'lixian',
            'ac': 'get_id',
            'torrent': 1 if torrent else None,
            '_': get_timestamp(13)
        }
        req = Request(method='GET', url=url, params=params)
        res = self.http.send(req)
        return res.content
1328007
def delete_agent_cloud(self, agent_cloud_id):
        
        route_values = {}
        if agent_cloud_id is not None:
            route_values['agentCloudId'] = self._serialize.url('agent_cloud_id', agent_cloud_id, 'int')
        response = self._send(http_method='DELETE',
                              location_id='bfa72b3d-0fc6-43fb-932b-a7f6559f93b9',
                              version='5.1-preview.1',
                              route_values=route_values)
        return self._deserialize('TaskAgentCloud', response)