Skip to content

Instantly share code, notes, and snippets.

@srynobio
Last active November 4, 2019 23:32
Show Gist options
  • Save srynobio/d2715c60126d6222152a2d7c55e230a1 to your computer and use it in GitHub Desktop.
Save srynobio/d2715c60126d6222152a2d7c55e230a1 to your computer and use it in GitHub Desktop.
## I've testing adding sample as a name and as a path to a file.
## I have ran this code and `response.ok` returns true, but the project has no change at the sample level
## https://mosaic-staging.chpc.utah.edu/#/projects/459/
def post_sample(mosaic_meta, sample, project_id):
path = "{}/projects/{}/samples"
url = path.format(mosaic_meta['url'], project_id)
headers = {
'Authorization' : mosaic_meta['authorization'],
}
data = {
'name' : sample,
}
params = {
'project_id' : project_id,
}
response = requests.get(url, headers=headers, data=data, params=params)
if response.ok:
print('Project updated with sample {}'.format(sample))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment