dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasgoMobi

DeviceAtlas 1.3 adds Python and Ruby support

atrasatti's picture
Posted by atrasatti 3 years 31 weeks ago
Bookmark and Share

When we initially released DeviceAtlas back in February we announced three different API's, Java, PHP and .NET. From the beginning we knew that the Ruby and Python communities would have been knocking at our door and in fact we have not been sitting staring at the wall. The initial API's have been updated and streamlined and now we come with two new flavours that should be welcomed by many web developers. With version 1.3 of DeviceAtlas we are releasing Ruby (that you can use with rails, of course) and Python.

The Python library is the same one that Ronan used for his article about how to use DeviceAtlas with GAE. We have also been considering the licensing model for usage on GAE and we decided to go for what seemed to be the easiest possible model, 1 application deployed, equals to 1 server. So if you are deploying 1 application, all you need to buy is a single server licence. Volume discounts still apply, of course, deploy 10 applications, get 10 licences and a 10% discount.

The API's are already available for download, we suggest that you get your developer licence and test with the latest JSON file.

A few other under-the-hood changes have happened and you will see the fruits in the next few days.


Posted by atrasatti 3 years 31 weeks ago

atrasatti's picture

Andrea Trasatti is Director of Technology Strategy at dotMobi where among the other things he is leading the design and development of DeviceAtlas.
Prior to this Andrea has been a system administrator and a software developer for more than 10 years and a consultant for more than 5 years.
In Italy Andrea started developing the first WAP sites in late 1999 when the first WAP phone was about to be released. Since then he has been developing some of the most innovative services for mobile devices.
Andrea has also actively participated to W3C work first as an invited expert and later as author of one of the documents that was published by the Device Descriptions Working Group.

Posted by John Boxall (not verified) 3 years ago

Loving the Python API - thanks!

John

Posted by johnboxall 3 years ago

It would be cool if you would package the Python library for installation using setuptools or distutils.

That way after downloading DA you could run something like:

python setup.py install

And have it correctly installed and ready to go (after your d/l the JSON file of course)

I would restructure the directory of the download to something like...

  • DA_PYTHON_1.3/
    • setup.py
    • doc/...
    • deviceatlas/
      • api.py
      • daExceptions.py

Now with DA installed using setup tools it would be availible to all Python programs like this:

from deviceatlas.api import DaApi
da = DaApi(...)
...

DA has one dependency, simplejson - so you might want to use setuptools (which includes support for downloading dependencies)

Here is some code using disutils to package DA:

from distutils.core import setup
import os
 
PACKAGE_NAME = 'deviceatlas'
 
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
		os.chdir(root_dir)
 
for dirpath, dirnames, filenames in os.walk(PACKAGE_NAME):
		# Ignore dirnames that start with '.'
		for i, dirname in enumerate(dirnames):
				if dirname.startswith('.'): del dirnames[i]
		if '__init__.py' in filenames:
				pkg = dirpath.replace(os.path.sep, '.')
				if os.path.altsep:
						pkg = pkg.replace(os.path.altsep, '.')
				packages.append(pkg)
		elif filenames:
			print dirpath
			prefix = PACKAGE_NAME[len(PACKAGE_NAME):] # Strip any trailing slashes
			for f in filenames:
				data_files.append(os.path.join(prefix, f))
 
setup(name=PACKAGE_NAME,
      version='1.3',
      description='Device Atlas Python API.',
      author='Ronan Cremin',
      author_email='support@deviceatlas.com',
      url='http://deviceatlas.com',
      package_dir={PACKAGE_NAME: PACKAGE_NAME},
      packages=packages,
      package_data={PACKAGE_NAME: data_files},
      classifiers=[],
)

Posted by ronan 3 years ago

John,

Thanks for the feedback. Yes, we should do this properly and package this up with setuptools. We'll probably do this for v1.4. Thanks for supplying the code! Btw, we keep a copy of the Python API running on http://deviceatlas.appspot.com/ so that people can try it out.

Ronan Cremin, dotMobi

Ronan Cremin, dotMobi

Posted by james0021 5 days ago

Thanks..High Pagerank Backlinks