如何检测iphone/ipod touch是否正在访问我的appengine应用程序?

Ste*_*ion 11 python iphone google-app-engine web-applications

如果它被iphone/ipod触摸所取代,我需要以不同的方式呈现页面.我想信息是在请求对象中,但是语法是什么?

Ste*_*ion 8

这是我正在寻找的语法,适用于iphone和ipod touch:

uastring = self.request.headers.get('user_agent')
if "Mobile" in uastring and "Safari" in uastring:
  # do iphone / ipod stuff
Run Code Online (Sandbox Code Playgroud)

  • 我得到`AttributeError:'WSGIRequest'对象没有属性'headers'. (2认同)