How to use x API with Python?
I would like to know how do I use the x API from the Python programming language.
More specifically, I want to ask if the following code is correct or not? import xmpp. From xmpp import PresenceRecording, Record. Import os. Import time. Conn = xmpp.Connection('localhost', 5222) presence = PresenceRecording(None, None. 'room@unconference.com') popen = PresenceRecording(presence, False). Popen2 = PresenceRecording(presence, True). Rpres = Record('record@unconference.com', 'room@unconference.com', False, ''). Rec = rpres.register() while True: time.sleep(60) conn.send(rec) The xmpp library itself already has a bunch of modules to interact with the API in any way. I think you probably should be using those: from xmpp.client import Client conn = Client("localhost", 5222). Presence = PresenceRecording(). Popen = PresenceRecording(presence, False). Popen2 = PresenceRecording(presence, True). Rpres = Record("record@unconference.com", "room@unconference.com", False, ""). Rec = rpres.register() conn.send(rec) Here are the functions from that library that are useful for what you're doing: def registerpresence(target, jid=None): presence.add(target) return True. Def unregisterpresence(target): presence.remove(target) def sendpresence(self, record): self.
Related Answers
Is Python good for Selenium?
Most of the stuff I've been doing for programming assignments so far...
Which is better for Selenium Java or python?
Is there a way to learn Rose grape from scratch and test. website quickly...
How do Python web scrapers make money?
If you want to be a web scraper, you will nee...