This release is a pre-release and may not be stable for production use.
===========
async mongo gridfs for tornado
Installation
------------
Installing: `pip install asyncgridfs` or ` easy_install asyncgridfs`
Usage
-----
import asyncmongo
import tornado.web
from asyncgridfs import GridFS
class Handler(tornado.web.RequestHandler):
@property
def db(self):
if not hasattr(self, '_db'):
self._db = asyncmongo.Client(pool_id='mydb', host='127.0.0.1', port=27017, maxcached=10, maxconnections=50, dbname='test')
return self._db
@tornado.web.asynchronous
def get(self):
fid = self.get_argument('fid')
fs = GridFS(self.db)
fs.get(ObjectId(fid),callback=self._on_get)
@tornado.web.asynchronous
def post(self):
f = self.request.files['imgFile'][0]
content = f.pop('body')
content_type = f.pop('content_type')
filename = f.pop('filename')
fs = GridFS(self.db)
fs.put(content, contentType=content_type, filename=filename, callback=self._on_post)
def _on_get(self, fileobj):
self.set_header('Content-Type', fileobj['contentType'])
self.write(fileobj['data'])
self.finish()
def _on_put(self, _id):
self.write(str(_id))
self.finish()
Metadata
Release files for asyncgridfs 0.2.1.dev
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asyncgridfs-0.2.1.dev-py2.7.egg | Legacy Egg format | - | - | Details for asyncgridfs-0.2.1.dev-py2.7.egg |
Release files / asyncgridfs-0.2.1.dev-py2.7.egg
| Download URL | asyncgridfs-0.2.1.dev-py2.7.egg |
|---|---|
| Size | 6.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
7ff959540a4f89126989664267f01fb6e26c0d7b8314702d19391231e3b63f96
|
|
BLAKE2b-256 checksum How to use checksums |
219b385f584d73073eeab6f37fd0d32687a116eda4893efd31715fa027f4a502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for asyncgridfs 0.2.1.dev
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.