PHP 8.2.30
Preview: basicfirst.py Size: 545 B
//proc/thread-self/root/opt/hc_python/share/doc/pycurl/examples/basicfirst.py

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:et
import sys
import pycurl

PY3 = sys.version_info[0] > 2


class Test:
    def __init__(self):
        self.contents = ''
        if PY3:
            self.contents = self.contents.encode('ascii')

    def body_callback(self, buf):
        self.contents = self.contents + buf


sys.stderr.write("Testing %s\n" % pycurl.version)

t = Test()
c = pycurl.Curl()
c.setopt(c.URL, 'https://curl.haxx.se/dev/')
c.setopt(c.WRITEFUNCTION, t.body_callback)
c.perform()
c.close()

print(t.contents)

Directory Contents

Dirs: 2 × Files: 11

Name Size Perms Modified Actions
- drwxr-xr-x 2025-04-04 08:01:21
Edit Download
- drwxr-xr-x 2025-04-04 08:01:21
Edit Download
545 B lrw-r--r-- 2025-04-04 08:01:21
Edit Download
1.15 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download
21.26 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download
7.81 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download
861 B lrw-r--r-- 2025-04-04 08:01:21
Edit Download
3.28 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download
2.60 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download
2.40 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download
1.07 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download
302 B lrw-r--r-- 2025-04-04 08:01:21
Edit Download
2.13 KB lrw-r--r-- 2025-04-04 08:01:21
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).