REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.13 KB
Close
/proc/thread-self/root/opt/hc_python/share/doc/pycurl/examples/xmlrpc_curl.py
Text
Base64
#! /usr/bin/env python # -*- coding: utf-8 -*- # vi:ts=4:et # We should ignore SIGPIPE when using pycurl.NOSIGNAL - see # the libcurl tutorial for more info. try: import signal from signal import SIGPIPE, SIG_IGN except ImportError: pass else: signal.signal(SIGPIPE, SIG_IGN) try: from cStringIO import StringIO except ImportError: try: from StringIO import StringIO except ImportError: from io import StringIO try: import xmlrpclib except ImportError: import xmlrpc.client as xmlrpclib import pycurl import sys PY3 = sys.version_info[0] > 2 class CURLTransport(xmlrpclib.Transport): """Handles a cURL HTTP transaction to an XML-RPC server.""" xmlrpc_h = [ "Content-Type: text/xml" ] def __init__(self, username=None, password=None): self.c = pycurl.Curl() self.c.setopt(pycurl.POST, 1) self.c.setopt(pycurl.NOSIGNAL, 1) self.c.setopt(pycurl.CONNECTTIMEOUT, 30) self.c.setopt(pycurl.HTTPHEADER, self.xmlrpc_h) if username != None and password != None: self.c.setopt(pycurl.USERPWD, '%s:%s' % (username, password)) self._use_datetime = False def request(self, host, handler, request_body, verbose=0): b = StringIO() self.c.setopt(pycurl.URL, 'http://%s%s' % (host, handler)) self.c.setopt(pycurl.POSTFIELDS, request_body) self.c.setopt(pycurl.WRITEFUNCTION, b.write) self.c.setopt(pycurl.VERBOSE, verbose) self.verbose = verbose try: self.c.perform() except pycurl.error: v = sys.exc_info()[1] if PY3: v = v.args raise xmlrpclib.ProtocolError( host + handler, v[0], v[1], None ) b.seek(0) return self.parse_response(b) if __name__ == "__main__": ## Test server = xmlrpclib.ServerProxy("http://betty.userland.com", transport=CURLTransport()) print(server) try: print(server.examples.getStateName(41)) except xmlrpclib.Error: v = sys.exc_info()[1] print("ERROR", v)
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 2 × Files: 11
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
quickstart
DIR
-
drwxr-xr-x
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__pycache__
DIR
-
drwxr-xr-x
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
basicfirst.py
545 B
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
file_upload.py
1.15 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
linksys.py
21.26 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
multi-socket_action-select.py
7.81 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
opensocketexception.py
861 B
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
retriever-multi.py
3.28 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
retriever.py
2.60 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
sfquery.py
2.40 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
smtp.py
1.07 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ssh_keyfunction.py
302 B
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
xmlrpc_curl.py
2.13 KB
lrw-r--r--
2025-04-04 08:01:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).