移动设备检测库与wsgi中间件

mobi.devices的Python项目详细描述


请参阅http://mobi.infrae.com/上的文档。

mobi.devices是一组检测移动用户代理的工具。它使用 以及来自 这是MIT mobile project

它提供了wsgi中间件,可以用有关 执行请求的设备。

为了获得最佳性能,请安装pytc。这不是包装要求 因为它不是在所有平台上都可用。

粘贴示例配置:

[app:yourapp]
# This part describes your application
# use = ...

[filter:mobidevicedetection]
# The entry point to use the classifier
use = egg:mobi.devices#classifier
# cache the classification on a client side cookie (default: true)
cookie_cache = true
# Configure caching (see beaker documentation)
cache.type = ext:memcached
cache.url = 127.0.0.1:11211
cache.lock_dir = /tmp/mobicache
# Data directory *required*. make sure directory is writable
# by the user that run the webserver
var = /var/mobi/db
# Path to wurfl file. by default it uses the one shipped with
# this package. however you should use the latest one.
wurfl_file = /var/mobi/wurfl.xml.gz

[filter:mobirouter]
use = egg:mobi.devices#router
# Redirect mobile devices that connect to infrae.com hostname
# to m.infrae.com
infrae.com = http://m.infrae.com/

[pipeline:main]
# This part configures the actual WSGI stack
pipeline = mobidevicedetection mobirouter yourapp

[server:main]
# This is the configuration for the paster web server.
# It must have the same name as the pipeline.
use = egg:Paste#http
host = 0.0.0.0
port = 8080
threadpool_workers = 7

如果您使用的是带有修改路径和 如果希望路由器在原始路径上路由,请添加 在任何重写规则之前遵循规则

RewriteRule ^(.*)$ - [E=ORIGINAL_PATH:$1]
RequestHeader set X_ORIGINAL_PATH %{ORIGINAL_PATH}e

变更日志

移动设备1.2(2011-04-14)

  • 添加更多配置选项(bruno binet)

移动设备1.1(2010-12-20)

  • 添加原始路径http头处理程序以使路由器使用重写规则。
  • 添加简单的路由器中间件。

移动设备1.0.1(2010-09-14)

  • 修复wurfl文件配置处理
  • 修复丢失的导入

移动设备1.0(2010-09-13)

  • 为wurfl添加新引擎

移动设备1.0b1(2010-07-14)

  • 第一个版本,请参阅README.txt

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何从同步请求中获取响应代码   具有深度复制的类中的Java oop getter/setter   java LDAP“简单”用户身份验证(JNDI Tomcat)不稳定?   java将Jenkins jnlp代理设置为通过API以编程方式使用WebSocket   java如何获取在servlet筛选器的静态块中启动的静态类的实例?   前两个数字的java charAt循环不能循环它   java在Spring引导执行器中是否有检查子服务运行状况的标准方法?   java我可以将jacksonmapped@JsonProperties推到“顶层”吗?   json JAVA:opencsv随机读取CSV单元格   无第三方应用程序的java捆绑包JRE   使用openidConnectClient功能的WAS Liberty中出现java无效cookie标头错误   java如何在Restful Web服务中从Http Post获取数组?   java如何读取安卓开发的JSON url?   如何在java IO中打开包含汉字的文件?