[commits] [Wiki] changed: XmlRpcPythonHowTo
Wiki Guest
wikiguest at horde.org
Thu Jan 26 19:32:42 UTC 2023
guest [151.246.175.189] Thu, 26 Jan 2023 19:32:42 +0000
Modified page: https://wiki.horde.org/XmlRpcPythonHowTo
New Revision: 4
Change log: hacked by mamadgamer1 BBG MG1
@@ -1,66 +1,3 @@
-+ Using XML/RPC to interface with the Horde API using Python
-
-You can easily use Python to communicate with Horde through XML/RPC.
Recent versions of Python have a built-in library "xmlrpclib" which
even supports SSL (the "https://" protocol) and authentication! Below
you find an example which accesses Kronolith's API to enumerate and
download calendars. You can do similar things with other Horde modules.
-
-Look at the //modulename/lib/api.php// files in the Horde
distribution to see which APIs you can use.
-
-Note regarding SOAP: it is also possible to communicate with Horde's
SOAP API using the Python library "SOAPpy", but SOAP doesn't offer any
inherent advantages over XML-RPC when dealing with Horde's API.
-
-<code type="python">
-#
-# Horde XML-RPC with Python Example
-#
-# This is a simple example which shows how to communicate with Horde through
-# the XML-RPC interface using the Python programming language.
-#
-# It enumerates all calendars a user has read access to and saves them to
-# the harddisk as VCALENDAR files for backup purposes.
-#
-
-import xmlrpclib
-
-############################### User settings ###############################
-
-# The user name on the Horde server.
-# When using imp authentication, always use the _full_ email address here!
-# When using SQL authentication, just use your login name
-username = "joe.user at my-server.com"
-# username = "joe.user"
-
-# The password of this Horde user
-password = "secret"
-
-# Protocol to use for connection ("http" or "https")
-protocol = "https"
-
-# Server host name (and directory, if needed)
-hostname = "horde.my-server.com"
-# hostname = "www.my-server.com/horde"
-
-############################## End of settings ##############################
-
-url = "%s://%s:%s@%s/rpc.php" % (protocol, username, password, hostname)
-
-print "Connecting to URL '%s'..." % url
-server = xmlrpclib.ServerProxy(url, verbose=0)
-
-print "Retrieving list of calendars..."
-
-calendars = server.calendar.listCalendars(False, 4) # "read permission"
-
-for calendarKey in calendars:
- print "Downloading calendar %s..." % calendarKey
-
- content = server.calendar.exportCalendar(calendarKey, "text/calendar")
-
- filename = calendarKey + ".ics"
-
- print "Writing file '%s'..." % filename
-
- f = file(filename, "wt")
- f.write(content.encode('utf-8'))
- f.close()
-
-print "Done."
-</code>
-
++ Hacked By mamadgamer1 BBG MG1
+github.com/mamadgamer1
+discord: 25#1876
More information about the commits
mailing list