Skip to content

Instantly share code, notes, and snippets.

@baoilleach
Created June 7, 2009 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baoilleach/125429 to your computer and use it in GitHub Desktop.
Save baoilleach/125429 to your computer and use it in GitHub Desktop.
# Requires PyActiveResource (http://code.google.com/p/pyactiveresource/)
from pyactiveresource.activeresource import ActiveResource
registry_id = "16" # Replace this with your registry_id
password = "password"
user = "baoilleach@gmail.com"
site = "https://chemcaster.com/registries/$registry_id/"
class Structure(ActiveResource):
_site = site
_user = user
_password = password
def demo():
name = "benzene"
molfile = "[NO NAME]\n CHEMWRIT 2D\nCreated with ChemWriter - http://metamolecular.com/chemwriter\n 6 6 0 0 0 0 0 0 0 0 0 V2000\n 5.0800 -5.0400 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 5.9460 -5.5400 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 6.8121 -5.0400 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 6.8121 -4.0400 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 5.9460 -3.5400 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 5.0800 -4.0400 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 2 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 2 0 0 0 0\n 4 5 1 0 0 0 0\n 5 6 2 0 0 0 0\n 6 1 1 0 0 0 0\nM END"
s = Structure({'name':name, 'molfile':molfile},
{'registry_id': registry_id})
success = s.save()
if not success:
raise Exception, "Didn't work!"
if __name__ == "__main__":
demo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment