{ "info": { "author": "Vladim\u00edr Gorej", "author_email": "gorej@codescale.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Browsers", "Topic :: Utilities" ], "description": "django-pybrowscap\n=================\n\n\ndjango-pybrowscap is django middleware with support for pybrowscap.\nIt decorates request with browser attribute, which contains all possible information\nabout the User-Agent accessing the view.\n\nRequirements\n------------\n\n- python 2.7+\n- django\n- requests (http://docs.python-requests.org/en/latest/)\n- pybrowscap\n- browscap csv file (http://browsers.garykeith.com/downloads.asp)\n\n\nInstallation\n------------\n\nInstall via pipy or copy this module into your project or into your PYTHON_PATH.\n\n\n**Put django_pybrowscap into INSTALLED_APPS in your projects settings.py file**\n\n::\n\n INSTALLED_APPS = (\n 'localeurl',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n 'django.contrib.admin',\n 'django.contrib.sitemaps',\n 'web',\n 'debug_toolbar',\n 'rosetta',\n 'south',\n 'django_pybrowscap'\n )\n\n\n**Put django_pybrowscap.middleware.PybrowscapMiddleware into MIDDLEWARE_CLASSES in your projects settings.py file**\n\n::\n\n MIDDLEWARE_CLASSES = (\n 'web.middleware.LocaleMiddleware',\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django_pybrowscap.middleware.PybrowscapMiddleware',\n ....\n )\n\n\nConfiguration\n-------------\n\n**django settings.py constants**\n\n::\n\n # This setting will effectively turn the middleware off, to speed up requests/response while developing\n PYBROWSCAP_INITIALIZE = True # Default is `not settings.DEBUG`.\n\n # Path where browscap file is located on filesystem\n PYBROWSCAP_FILE_PATH = MEDIA_ROOT+os.sep+'browscap.csv' # Default is '' (empty string)\n\n # Proxy to use\n # See: http://docs.python-requests.org/en/latest/user/advanced/#proxies\n PYBROWSCAP_PROXIES = {\n \"http\": \"http://user:pass@10.10.1.10:3128\",\n \"https\": \"http://10.10.1.10:1080\",\n } # Defaults to None.\n\n # Timeout for HTTP requets\n # See: http://docs.python-requests.org/en/latest/user/quickstart/#timeouts\n PYBROWSCAP_HTTP_TIMEOUT = 30\n\n # Tuple of regular expressions of paths that are to be ignored by the middleware\n PYBROWSCAP_IGNORE_PATHS = (\n re.compile(r'^/sitemap.xml$'),\n re.compile(r'^/robots.txt$'),\n re.compile(r'^/favicon.ico$'),\n re.compile(r'^/media/')\n ) # Defaults to an empty tupple.\n\n # This tells middleware to reload browscap file from disk every PYBROWSCAP_RELOAD_INTERVAL seconds\n PYBROWSCAP_RELOAD = True # Reload file. Default is False.\n PYBROWSCAP_RELOAD_INTERVAL = 7 * 24 * 60 * 60 # Reloads browscap file once a week\n\n\n\nAutomatic Updates\n-----------------\n\nDownload latest version of the browscap data by executing the builtin management command:::\n\n $ python manage.py download_browscap \\\n --url http://browsers.garykeith.com/stream.asp?BrowsCapCSV \\\n --file-path /path/to/downloaded/browscap_file\n\nYou don't need to provide any options for this command. By default, latest CSV browscap file will be downloaded\nand saved to `settings.PYBROWSCAP_FILE_PATH`. Don't forget to set your `settings.PYBROWSCAP_RELOAD = True`.\nFor convenience execute the command via cron automatically once a week:::\n\n 5 8 * * 6 python manage.py download_browscap\n\n\n\nExample\n-------\n\n::\n\n def standard_view(request):\n if request.browser is not None and request.browser.is_crawler():\n # do something\n else:\n # do something else\n\n\n\nTests\n-----\n\n**Tested on evnironment**\n\n- Xubuntu Linux 12.04 LTS precise 64-bit\n- python 2.7.3\n- python unitest\n- browscap_14_05_2012.csv from Mon, 14 May 2012 22:20:20 -0000\n\n**Running tests**\n\nTo run the tests, execute one of the following commands:::\n\n $ python setup.py test\n $ make test\n\n\nAuthor\n------\n\n| char0n (Vladimir Gorej, CodeScale)\n| email: gorej@codescale.net\n| web: http://www.codescale.net\n\n\nReferences\n----------\n\n- http://github.com/CodeScaleInc/django-pybrowscap\n- http://browsers.garykeith.com/\n- http://php.net/get_browser\n- http://www.codescale.net/en/community#django-pybrowscap", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/CodeScaleInc/django-pybrowscap/tarball/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.codescale.net/en/community#django-pybrowscap", "keywords": "browser browscap detection user agent django", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-pybrowscap", "package_url": "https://pypi.org/project/django-pybrowscap/", "platform": "any", "project_url": "https://pypi.org/project/django-pybrowscap/", "project_urls": { "Download": "http://github.com/CodeScaleInc/django-pybrowscap/tarball/master", "Homepage": "http://www.codescale.net/en/community#django-pybrowscap" }, "release_url": "https://pypi.org/project/django-pybrowscap/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "django-pybrowscap is django middleware with support for pybrowscap", "version": "1.0.0" }, "last_serial": 790374, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "50a578ae6c78eba69194e290d81686b5", "sha256": "5247edd5caaa6dac132b2090997e6339d94d47c7f832a2033fa042451eec18b9" }, "downloads": -1, "filename": "django-pybrowscap-0.9.tar.gz", "has_sig": false, "md5_digest": "50a578ae6c78eba69194e290d81686b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5641, "upload_time": "2012-03-06T19:50:56", "url": "https://files.pythonhosted.org/packages/3d/db/6e612baea042db9a8d9c030a13f21a4c6934ec7f64894b45f33954936737/django-pybrowscap-0.9.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "9d2bdca7b98ce26c1f2df42b44133640", "sha256": "2cb13a9db646140501746914ef28325e59d961e9b7b1928ebe921243520276fc" }, "downloads": -1, "filename": "django-pybrowscap-0.9.1.tar.gz", "has_sig": false, "md5_digest": "9d2bdca7b98ce26c1f2df42b44133640", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6191, "upload_time": "2012-05-01T20:22:51", "url": "https://files.pythonhosted.org/packages/2f/4e/284f72c2f29676fe0db2ee48ecb5f0e30259d579e0d61c412e0a73209820/django-pybrowscap-0.9.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "07c7ec68ebcc14989b8de397ca78eea6", "sha256": "4154089416f77a79c539023478c6f939619b9e3bb90df1a78784aad01e8922be" }, "downloads": -1, "filename": "django-pybrowscap-1.0.0.tar.gz", "has_sig": false, "md5_digest": "07c7ec68ebcc14989b8de397ca78eea6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8427, "upload_time": "2013-06-23T13:23:27", "url": "https://files.pythonhosted.org/packages/5a/76/766508ca8c80f927b8847044293f0a9e7fc2b330d9f0e9b568094db1421a/django-pybrowscap-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "07c7ec68ebcc14989b8de397ca78eea6", "sha256": "4154089416f77a79c539023478c6f939619b9e3bb90df1a78784aad01e8922be" }, "downloads": -1, "filename": "django-pybrowscap-1.0.0.tar.gz", "has_sig": false, "md5_digest": "07c7ec68ebcc14989b8de397ca78eea6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8427, "upload_time": "2013-06-23T13:23:27", "url": "https://files.pythonhosted.org/packages/5a/76/766508ca8c80f927b8847044293f0a9e7fc2b330d9f0e9b568094db1421a/django-pybrowscap-1.0.0.tar.gz" } ] }