Skip to content

sven-mayer/pywurfl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pywurfl

pywurfl is a Python language package that makes dealing with the WURFL in Python a little easier. It contains tools that allow you to retrieve objects that represent devices defined in the WURFL or manipulate the WURFL device hierarchy by using a simple set of API functions or a pywurfl specific query language. Also included within the package is a WURFL processor class that provides an event based API that can be used to alleviate some of the work when processing the WURFL sequentially.

Instaltion

pip install git+https://github.com/SamyStyle/pywurfl

####Requires Python >= 2.6

Required Modules

Levenshtein Module >= 0.10.1 is required for the user agent similarity algorithms.

Optional Modules

pyparsing >= 1.5 is required if you want to use the pywurfl query language.

Get the latest WURFL XML

The pywurfl package contains a wurfl2python.py script that translates a WURFL compatible XML file into a python class hierarchy that the pywurfl API can use directly. The default name for the output file is wurfl.py. Type the following at the command line to produce it:

python wurfl2python.py wurfl.xml

###A quick usage example After you have created the wurfl.py module, you can use the following code to get a device object based on a user agent and print it to stdout.

from wurfl import devices
from pywurfl.algorithms import TwoStepAnalysis

user_agent = u"Nokia3350/1.0 (05.01)"
search_algorithm = TwoStepAnalysis(devices)

device = devices.select_ua(user_agent, search=search_algorithm)

#Print out the specialized capabilities for this device.
print device

###Patching In order to patch your wurfl.xml file, use the WURFL XSLT Tools. Then run wurfl2python on the patched file.

##License

pywurfl is Copyright 2004-2010, Armand Lynch (lyncha at users dot sourceforge dot net) The code is free software; you can redistribute it and/or modify it under the terms of the LGPL License (see the file LICENSE included with the distribution).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages