| Server IP : 112.74.42.100 / Your IP : 216.73.216.142 Web Server : nginx/1.20.2 System : Linux iZwz96lx4pjqiy84w4hni7Z 5.10.134-17.3.al8.x86_64 #1 SMP Thu Oct 31 14:29:57 CST 2024 x86_64 User : www ( 1000) PHP Version : 8.0.26 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 : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/usr/share/doc/python3-pycurl/doc/ |
Upload File : |
File Handling ============= In PycURL 7.19.0.3 and below, ``CURLOPT_READDATA``, ``CURLOPT_WRITEDATA`` and ``CURLOPT_WRITEHEADER`` options accepted file objects and directly passed the underlying C library ``FILE`` pointers to libcurl. Python 3 no longer implements files as C library ``FILE`` objects. In PycURL 7.19.3 and above, when running on Python 3, these options are implemented as calls to ``CURLOPT_READFUNCTION``, ``CURLOPT_WRITEFUNCTION`` and ``CURLOPT_HEADERFUNCTION``, respectively, with the write method of the Python file object as the parameter. As a result, any Python file-like object implementing a ``read`` method can be passed to ``CURLOPT_READDATA``, and any Python file-like object implementing a ``write`` method can be passed to ``CURLOPT_WRITEDATA`` or ``CURLOPT_WRITEHEADER`` options. When running PycURL 7.19.3 and above on Python 2, the old behavior of passing ``FILE`` pointers to libcurl remains when a true file object is given to ``CURLOPT_READDATA``, ``CURLOPT_WRITEDATA`` and ``CURLOPT_WRITEHEADER`` options. For consistency with Python 3 behavior these options also accept file-like objects implementing a ``read`` or ``write`` method, as appropriate, as arguments, in which case the Python 3 code path is used converting these options to ``CURLOPT_*FUNCTION`` option calls. Files given to PycURL as arguments to ``CURLOPT_READDATA``, ``CURLOPT_WRITEDATA`` or ``CURLOPT_WRITEHEADER`` must be opened for reading or writing in binary mode. Files opened in text mode (without ``"b"`` flag to ``open()``) expect string objects and reading from or writing to them from PycURL will fail. Similarly when passing ``f.write`` method of an open file to ``CURLOPT_WRITEFUNCTION`` or ``CURLOPT_HEADERFUNCTION``, or ``f.read`` to ``CURLOPT_READFUNCTION``, the file must have been be opened in binary mode.