Пример #1
0
 def urlretrieval(self, mail):
     url, cs, cwd = self.items[0], [], ''
     if mail:
         cs = [self.mailer]
     elif self.ui.proto == 'ftp' or urlregex.ftpcheck(url):
         if self.ui.ftpdir:
             # otherwise eventual download to cwd
             self.ui.ftpdir = util.savedir(self.ui.ftpdir)
             cwd = os.getcwdu()
             os.chdir(self.ui.ftpdir)
         cs = [self.ui.configitem('net', 'ftpclient', default='ftp')]
         # for ftp programs that have more of a browser interface
         # we assume a file if url has a file extension
         if os.path.splitext(url)[1]:
             exe = os.path.split(cs[0])[-1]
             if exe == 'lftp':
                 # lftp needs an optional command
                 cs += ['-c', 'get']
             elif exe == 'ncftp':
                 # use ncftpget instead
                 cs = ['%sget' % cs[0]]
     if not cs and not self.ui.getdir:
         b = pybrowser.browser(parentui=self.ui, items=self.items)
         b.urlvisit()
     elif self.ui.getdir:
         uget = wget.wget(self.ui)
         uget.download([url])
     else:
         cs += [url]
         util.systemcall(cs)
     if cwd:
         os.chdir(cwd)
Пример #2
0
 def urlgo(self):
     if self.ui.proto == 'mid':
         k = kiosk.kiosk(self.ui, items=self.items)
         k.kioskstore()
     elif self.ui.getdir:
         uget = wget.wget(self.ui)
         uget.download(self.items)
     else:
         b = pybrowser.browser(parentui=self.ui, items=self.items)
         b.urlvisit()
Пример #3
0
 def gogoogle(self):
     '''Gets messages from Google Groups.'''
     self.ui.note('note: google masks all email addresses\n',
                  'going google ...\n')
     uget = wget.wget(self.ui, ('User-Agent', 'w3m'))
     for mid in self.items[:]:
         msgurl = uget.request(_makequery(mid), 'g')
         if msgurl:
             msg = uget.request(_getraw(msgurl))
             if msg and msg.split('\n', 1)[1].find('DOCTYPE html') == -1:
                 msg = email.message_from_string(msg)
                 self.msgs.append(msg)
                 self.items.remove(mid)
             else:
                 self.ui.warn('%s: not found at google\n' % mid)