MobileESP: Ported to Python!

Hi, folks —

The community has delivered another great port of MobileESP! Jury Gerasimov sent me an email last week with the good news.

Jury’s company in Irkutsk, Russia, (that’s one of the largest cities in Siberia!) has been developing a bus monitoring service. The web site was built in Python for the Django web app framework. In Jury’s own words:

We’ve made 3 versions of the web interface – desktop, modern mobile and old mobile – available on the same URL. To detect which version the server should display, we needed some server-side script, and MobileESP has the most usable set of functions among other solutions. Our main developers were quite busy, so Python translation was made by freelance guy. He knew the code will be opened so kept the structure and comments close to original.

Check out the mobile version of their bus tracking web app: www.irk.fm/bus/ (Note that the web site is in Russian naturally.)

For you Python lovers, here is the sample code they used to integrate MobileESP in Django. It looks pretty simple…

  from mobileesp import mdetect

  user_agent = request.META.get("HTTP_USER_AGENT")
  http_accept = request.META.get("HTTP_ACCEPT")
  if user_agent and http_accept:
       agent = mdetect.UAgentInfo(userAgent=user_agent, httpAccept=http_accept)
       #Do first! For iPhone, Android, Windows Phone 7, etc.
       if agent.detectTierIphone():
           HttpResponseRedirect('/myapp/i/')
       #Then catch all other mobile devices
       if agent.detectMobileQuick():
           HttpResponseRedirect('/myapp/m/')
  #For traditional computers and tablets (iPad, Android, etc.)
  return HttpResponseRedirect('/myapp/d/')  

Moving forward, we will be hosting the Python codebase in the MobileESP project on Google Code. (See the Download Page for details.) Jury and his team will assist in reviewing and testing updates.

For more information about the Python port or to contact Jury for more information about his company’s services, please email Jury directly: jury@softshape.com.

Cheers,

Anthony

Owner of the MobileESP project. For the latest source code downloads, visit:

https://github.com/ahand/mobileesp

Posted in Code Updates, General, How To - Python, MobileESP APIs, Projects Using MobileESP