Downloads the media contained in the message, if any. Shorthand
        for `telethon.client.downloads.DownloadMethods.download_media`
        with the ``message`` already set.
511049
async def download_media(self, *args, **kwargs):
        
        return await self._client.download_media(self, *args, **kwargs)
723095
private function download()
    {
        header('Content-disposition: attachment; filename="'.$this->filename.'.'.$this->extension.'"');
        header('Content-type: application/octet-stream');
        
        readfile($this->filename.'.'.$this->extension);
    }
127391
def download_file(self, file_url, destination_folder=None):
        
        if not destination_folder:
            destination_folder = constants.Files.DOWNLOADS_FOLDER
        page_utils._download_file_to(file_url, destination_folder)
367320
def download(self, path):
        """"""

        service_get_resp = requests.get(self.location, cookies={"session": self.session})
        payload = service_get_resp.json()

        download_get_resp = requests.get(payload["content"])
        with open(path, "wb") as config_file:
            config_file.write(download_get_resp.content)
889874
def download(self, attr):
        
        if attr.type not in ['malware-sample', 'attachment']:
            raise ValueError('Only malware-sample and attachment can be downloaded')

        return self.GET('/attributes/downloadAttachment/download/%i' % attr.id)
1345148
def download_file(client, bucket, remote_path, local_path, overwrite=False):
    """"""
    bucket = client.get_bucket(bucket)
    if (not overwrite) and os.path.isfile(local_path):
        raise OSError('File already exists!')
    with open(local_path, 'wb') as ofh:
        bucket.get_blob(remote_path).download_to_file(ofh)
1287941
def run_download_media(filename=None):
    
    if not filename:
        filename = settings.MEDIA_DUMP_FILENAME
    if env.key_filename:
        ssh = settings.PROJECT_NAME
    else:
        ssh = '{0}@{1}'.format(env.user, env.host_string)
    local('scp {0}:{1}{2} .'.format(
        ssh, settings.FAB_SETTING('SERVER_MEDIA_BACKUP_DIR'), filename))
972217
def download_file(self, *args, **kwargs):
        """"""
        return download_file(*args, **self._merge_overrides(**kwargs)).run()
658006
def media_in_content(self, content):
        
        local_file = ''
        if 'https://t.co' in content:
            content = re.sub(r'https://t.co/(\w+)', '', content)
        if 'https://pbs.twimg.com/media/' in content:
            m = re.search('https://pbs.twimg.com/media/([\w\-_]+).jpg', content)  # NOQA
            url = 'https://pbs.twimg.com/media/{}.jpg'.format(m.group(1))
            local_file = download_image(url)
            content = re.sub(r'https://pbs.twimg.com/media/([\w\-_]+).jpg', '',  # NOQA
                             content)

            return content, local_file
        return content, local_file
193840
def download(self, request, **kwargs):
        

        # method check to avoid bad requests
        self.method_check(request, allowed=['get'])

        # create a basic bundle object for self.get_cached_obj_get.
        basic_bundle = self.build_bundle(request=request)

        # using the primary key defined in the url, obtain the tileset
        tileset = self.cached_obj_get(
            bundle=basic_bundle,
            **self.remove_api_resource_names(kwargs))

        filename = helpers.get_tileset_filename(tileset)
        filename = os.path.abspath(filename)
        if os.path.isfile(filename):
            response = serve(request, os.path.basename(filename), os.path.dirname(filename))
            response['Content-Disposition'] = 'attachment; filename="{}"'.format(os.path.basename(filename))
        else:
            response = self.create_response(request, {'status': 'not generated'})
        return response
1100736
def download_file(self, remote, local):
        
        file = open(local, 'wb')
        try:
            self.download(remote, file)
        finally:
            file.close()
650940
def download(self, url, file):
        
        if isinstance(file, str) or isinstance(file, unicode):
            file = open(file, 'wb')
        webclient = self.dupe()
        webclient.request('GET', url)
        rsp = webclient.getresponse()
        self._currdl = rsp
        self._dlfile = file
        for chunk in iter(lambda: rsp.read(16384), ''):
            file.write(chunk)
        self._currdl = None
        file.close()
1190531
def download(self):
        
        if self.url:
            try:
                return requests.get(self.url).content
            except requests.RequestException as e:
                raise GyazoError(str(e))
        return None
166844
def download_to(dir = Dir.pwd, opts = { force_download: false })
      delete_files!(dir) if opts[:force_download]

      return if file_exist?(dir)

      image = Tools.get(uri)

      append_file_data(dir, image)
      append_file_ext(dir)
    rescue StandardError => error
      logger.error({
        msg: 'Failed to download page',
        page: self,
        uri: uri,
        error: error,
        error_msg: error.message,
        backtrace: error.backtrace
      }.to_s)
    end
966556
def download_file(self, url):
        
        response = requests.get(url, stream=True)
        response.raise_for_status()
        return (int(response.headers.get('content-length', 0)), response)
1144289
def __load_dump(self, message):
        
        dump = message.content
        if self._hook is not None:
            # Call the hook
            try:
                updated_dump = self._hook(message, dump)
                if updated_dump is not None:
                    # Use the new description
                    dump = updated_dump
            except (TypeError, ValueError) as ex:
                self._logger("Invalid description hook: %s", ex)
        return dump
927077
async def download_media_by_id(self, media_id):
        
        try:
            msg = self.found_media[int(media_id)]
        except (ValueError, KeyError):
            # ValueError when parsing, KeyError when accessing dictionary
            print('Invalid media ID given or message not found!')
            return

        print('Downloading media to usermedia/...')
        os.makedirs('usermedia', exist_ok=True)
        output = await self.download_media(
            msg.media,
            file='usermedia/',
            progress_callback=self.download_progress_callback
        )
        print('Media downloaded to {}!'.format(output))