Skip to content

Instantly share code, notes, and snippets.

@astrofrog
Created March 4, 2011 20:46
Show Gist options
  • Save astrofrog/855678 to your computer and use it in GitHub Desktop.
Save astrofrog/855678 to your computer and use it in GitHub Desktop.
Broadcast a table from Python over SAMP
from sampy import *
import time
import urllib
myhub = SAMPHubProxy()
myhub.connect()
client = SAMPClient(myhub)
metadata1 = {"samp.name": "Client",
"samp.description.text": "Client",
"client.version": "0.01"}
client.start()
client.register()
client.declareMetadata(metadata1)
try:
myhub.notifyAll(client.getPrivateKey(),
{"samp.mtype": "table.load.votable",
"samp.params": {"url": "https://github.com/atpy/atpy/raw/master/examples/aj285677t3_votable.xml",
"name": "aj285677t3_votable.xml"}
})
finally:
client.unregister()
client.stop()
myhub.disconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment