基于Tornado和Redis的完整异步docsplit预览服务器
项目描述
简介
我们正在努力寻找最佳预览媒体服务器的解决方案。
情况很简单,我们有PDF文件,我们想要预览它们(小、中、大、标题)。
我们首先从Insight开始,它允许人们从一个带有缓存的URL请求同步和异步预览生成。
该系统能够注册引擎,以便我们可以在流中操作文档。
Insight-Reloaded的想法是移除同步模式,并将其委托给Nginx和磁盘或S3存储。
如果文档预览未准备好,我们想要一个404错误。
我们将通过回调获取文档预览URL。
API
简单示例
curl -X GET "http://localhost:8888/?url=http://my_file_url.com/file.pdf&callback=http://requestb.in/12vsewg" {"insight_reloaded": "Job added to queue.", "number_in_queue": 14} curl -X GET http://localhost:8888/status {"insight_reloaded": "There is 14 job in the queue.", "number_in_queue": 14} curl -X GET http://localhost:8888/ {"version": "1.5", "insight_reloaded": "Bonjour", "name": "insight-reloaded"}
多队列示例
您必须在您的settings.py中配置REDIS_QUEUE_KEYS。
REDIS_QUEUE_KEYS = ['urgent', 'normal'] DEFAULT_REDIS_QUEUE_KEY = 'normal'
然后您可以使用
curl -X GET "http://localhost:8888/urgent?url=http://my_file_url.com/file.pdf&callback=http://requestb.in/12vsewg" {"insight_reloaded": "Job added to queue 'normal'.", "number_in_queue": 14} curl -X GET http://localhost:8888/urgent/status {"insight_reloaded": "There is 14 job in the 'urgent' queue.", "number_in_queue": 14} curl -X GET http://localhost:8888/ {"version": "1.5", "insight_reloaded": "Bonjour", "name": "insight-reloaded"}
设置散列
默认情况下,Insight使用URL(sha1(url))计算预览散列。如果您愿意,您也可以在请求中发送它,确保每个预览都有一个唯一的散列。
curl -X GET "http://localhost:8888/?url=http://my_file_url.com/file.pdf&callback=http://requestb.in/12vsewg?hash=123456789" {"insight_reloaded": "Job added to queue.", "number_in_queue": 14}
服务架构
服务器配置
您可以在以下位置找到insight-reloaded chef cookbooks: https://github.com/novapost/insight-installer
这将帮助您安装运行insight-reloaded服务器所需的所有要求。
运行测试
make test
项目详情
关闭
insight_reloaded-1.6.6.zip 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 66635a8e88cdc87acb0452caf2045ad8372143994cf6c101df511f9109f36e3c |
|
MD5 | caf8912f2096e404c7ceb637d57f5c93 |
|
BLAKE2b-256 | ea3a765377b82e298ff41995bacc6e8275c4a04a474a81482829d5d533a72902 |