Server IP : 172.67.216.182 / Your IP : 172.70.147.34 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/panel/pyenv/libexec/ |
Upload File : |
#! /usr/bin/python # A very simple external downloader # Copyright 2011-2012 Zdenek Pavlas # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., # 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA import time, os, errno, sys import six from urlgrabber.grabber import \ _readlines, URLGrabberOptions, _loads, \ PyCurlFileObject, URLGrabError, _to_utf8 def write(fmt, *arg): buf = fmt % arg if six.PY3: buf = buf.encode() try: os.write(1, buf) except OSError as e: if e.args[0] != errno.EPIPE: raise sys.exit(1) class ProxyProgress: def start(self, *d1, **d2): self.next_update = 0 def update(self, _amount_read): t = time.time() if t < self.next_update: return self.next_update = t + 0.31 write('%d %d\n', self._id, _amount_read) def main(): import signal signal.signal(signal.SIGINT, lambda n, f: sys.exit(1)) cnt = 0 while True: lines = _readlines(0) if not lines: break for line in lines: if not isinstance(line, six.string_types): line = line.decode('utf-8') cnt += 1 opts = URLGrabberOptions() opts._id = cnt for k in line.split(' '): k, v = k.split('=', 1) setattr(opts, k, _loads(v)) if opts.progress_obj: opts.progress_obj = ProxyProgress() opts.progress_obj._id = cnt dlsz = dltm = 0 try: fo = PyCurlFileObject(_to_utf8(opts.url), opts.filename, opts) fo._do_grab() fo.fo.close() size = fo._amount_read if fo._tm_last: dlsz = fo._tm_last[0] - fo._tm_first[0] dltm = fo._tm_last[1] - fo._tm_first[1] ug_err = 'OK' except URLGrabError as e: size = 0 ug_err = '%d %d %s' % (e.errno, getattr(e, 'code', 0), e.strerror) write('%d %d %d %.3f %s\n', opts._id, size, dlsz, dltm, ug_err) if __name__ == '__main__': main()