下载临时多媒体文件。

        :param media_id: 媒体文件 ID
        :return: requests 的 Response 实例
546767
def download_media(self, media_id):
        
        return requests.get(
            url="https://api.weixin.qq.com/cgi-bin/media/get",
            params={
                "access_token": self.token,
                "media_id": media_id
            }
        )
606687
def media_update(self, id, description=None, focus=None):
        
        id = self.__unpack_id(id)

        if focus != None:
            focus = str(focus[0]) + "," + str(focus[1])
            
        params = self.__generate_params(locals(), ['id'])  
        return self.__api_request('PUT', '/api/v1/media/{0}'.format(str(id)), params)
166071
def get(self, agent_id, media_id):
        
        return requests.get(self.get_url(agent_id, media_id))
1057751
def media(self):
        
        if self._media is None:
            self._media = MediaList(
                self._version,
                account_sid=self._solution['account_sid'],
                message_sid=self._solution['sid'],
            )
        return self._media
1299470
def GetAttachmentIdFromMediaId(media_id):
    
    altchars = '+-'
    if not six.PY2:
        altchars = altchars.encode('utf-8')
    # altchars for '+' and '/'. We keep '+' but replace '/' with '-'
    buffer = base64.b64decode(str(media_id), altchars)
    resoure_id_length = 20
    attachment_id = ''
    if len(buffer) > resoure_id_length:
        # We are cutting off the storage index.
        attachment_id = base64.b64encode(buffer[0:resoure_id_length], altchars)
        if not six.PY2:
            attachment_id = attachment_id.decode('utf-8')
    else:
        attachment_id = media_id

    return attachment_id
892211
def get_requests_request_id(self, request_id):
        
        route_values = {}
        if request_id is not None:
            route_values['requestId'] = self._serialize.url('request_id', request_id, 'str')
        response = self._send(http_method='GET',
                              location_id='ebc09fe3-1b20-4667-abc5-f2b60fe8de52',
                              version='5.0-preview.1',
                              route_values=route_values)
        return self._deserialize('Request', response)
473376
public function openidVideo($media_id = '', $openids = [], $title = '', $description = '')
    {
        $queryStr                      = [];
        $queryStr['touser']            = $openids;
        $queryStr['video']['media_id'] = $media_id;

        if (!empty($title)) {
            $queryStr['video']['title'] = $title;
        }

        if (!empty($description)) {
            $queryStr['video']['description'] = $description;
        }

        $queryStr['msgtype'] = 'video';

        $this->module = 'message';

        $res = $this->_post('mass/send', $queryStr);

        return $res;
    }
426493
def get(self, resource_id):
        
        response = self.requester.get(
            '/{endpoint}/{entity}/{id}',
            endpoint=self.endpoint, entity=self.entity, id=resource_id,
            paginate=False
        )
        return response.json()
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
            }
        )
863693
def download(self, resource_id):
        
        self.resource_id(str(resource_id))
        self._request_uri = '{}/download'.format(self._request_uri)
981818
public function deleteMaterial($media_id) {
		$data = $this->getData('/cgi-bin/material/del_material', [
			'access_token' => $this->getAccessToken(),
		], Json::encode(['media_id' => $media_id]));

		return $this->errcode == 0;
	}
886982
def download(self, id, attid): # pylint: disable=invalid-name,redefined-builtin
        
        resp = self.service.get_id(self._base(id), attid, params={'format': 'download'}, stream=True)
        b = io.BytesIO()
        stream.stream_response_to_file(resp, path=b)
        resp.close()
        b.seek(0)
        return (b, self.service.filename(resp))
320713
public function getMediaWithHttpInfo($media_id, $is_video = false)
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $url_prefix = $is_video ? str_replace('https', 'http', self::API_URL_PREFIX) : self::API_URL_PREFIX;
        $url = $url_prefix . self::MEDIA_GET_URL . "access_token={$this->access_token}" . '&media_id=' . $media_id;
        $oCurl = curl_init();
        if (stripos($url, "https://") !== false) {
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($oCurl, CURLOPT_SSLVERSION, 1);
        }
        curl_setopt($oCurl, CURLOPT_URL, $url);
        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
        $sContent = curl_exec($oCurl);
        $aStatus = curl_getinfo($oCurl);
        $result = array();
        if (intval($aStatus["http_code"]) !== 200) {
            return false;
        }
        if ($sContent) {
            if (is_string($sContent)) {
                $json = json_decode($sContent, true);
                if (isset($json['errcode'])) {
                    $this->errCode = $json['errcode'];
                    $this->errMsg = $json['errmsg'];
                    return $this->checkRetry(__FUNCTION__, func_get_args());
                }
            }
            $result['content'] = $sContent;
            $result['info'] = $aStatus;
            return $result;
        }
        return false;
    }
551379
public function openidVoice($media_id = '', $openids = [])
    {
        $queryStr                      = [];
        $queryStr['touser']            = $openids;
        $queryStr['voice']['media_id'] = $media_id;
        $queryStr['msgtype']           = 'voice';

        $this->module = 'message';

        $res = $this->_post('mass/send', $queryStr);

        return $res;
    }
825354
public static MediaFile get(final BandwidthClient client, final String id) throws Exception {
    	
        final String mediaUri = client.getUserResourceInstanceUri(BandwidthConstants.MEDIA_URI_PATH, id);

        final JSONObject jsonObject = toJSONObject(client.get(mediaUri, null));
        return new MediaFile(client, jsonObject);
    }
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)
1086302
def get_film(film_id):
    '''  '''
    result = _get(film_id, settings.FILMS)
    return Film(result.content)