def curl(self):
c = self._pycurl<EOL>if os.path.exists(self.path) and self.resume:<EOL><INDENT>mode = '<STR_LIT>'<EOL>self.downloaded = os.path.getsize(self.path)<EOL>c.setopt(pycurl.RESUME_FROM, self.downloaded)<EOL><DEDENT>else:<EOL><INDENT>mode = '<STR_LIT:wb>'<EOL><DEDENT>with open(self.path, mode) as f:<EOL><INDENT>c.setopt(c.URL, utf8_encode(self.url))<EOL>if self.auth:<EOL><INDENT>c.setopt(c.USERPWD, '<STR_LIT>' % self.auth)<EOL><DEDENT>c.setopt(c.USERAGENT, self._user_agent)<EOL>c.setopt(c.WRITEDATA, f)<EOL>h = self._get_pycurl_headers()<EOL>if h is not None:<EOL><INDENT>c.setopt(pycurl.HTTPHEADER, h)<EOL><DEDENT>c.setopt(c.NOPROGRESS, <NUM_LIT:0>)<EOL>c.setopt(pycurl.FOLLOWLOCATION, <NUM_LIT:1>)<EOL>c.setopt(c.PROGRESSFUNCTION, self.progress)<EOL>self._fill_in_cainfo()<EOL>if self._pass_through_opts:<EOL><INDENT>for key, value in self._pass_through_opts.items():<EOL><INDENT>c.setopt(key, value)<EOL><DEDENT><DEDENT>c.perform()<EOL><DEDENT>
Sending a single cURL request to download