Skip to content

Instantly share code, notes, and snippets.

@alfredfrancis
Created May 10, 2017 07:53
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 alfredfrancis/f8d752611f453572d1d2c25b22286a25 to your computer and use it in GitHub Desktop.
Save alfredfrancis/f8d752611f453572d1d2c25b22286a25 to your computer and use it in GitHub Desktop.
Upload files to MongoDB GridFS using Restheart API and Python
import requests
# https://softinstigate.atlassian.net/wiki/pages/viewpage.action?pageId=11567174=
files = {
'file': open("helloworld.mp3", 'rb')
}
values={
'properties':'"filename":"helloworld.mp3"')
}
#Collection name should end with files
result= requests.post('http://restheartInstance:port/dbname/collectionname.files', files=files ,data=values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment