Skip to content

Instantly share code, notes, and snippets.

@cbare
Created March 20, 2015 21:49
Show Gist options
  • Select an option

  • Save cbare/e9be46c179d9ec7c767b to your computer and use it in GitHub Desktop.

Select an option

Save cbare/e9be46c179d9ec7c767b to your computer and use it in GitHub Desktop.
Update the URL of a File within Synapse
import synapseclient
syn = synapseclient.Synapse()
syn.login()
## create the entity
e = syn.store(File("http://google.com/", name="google", parent="syn3361147", synapseStore=False))
## should work, but doesn't
## e = syn.store(File("http://google.com/testing1", name="google", parent="syn3361147"), synapseStore=False)
fh1 = syn._uploadToFileHandleService("http://google.com/testing2", synapseStore=False)
print fh1
print e
## update the entity's file handle and store it
e.properties.dataFileHandleId = fh1['id']
e = syn.store(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment