本文整理汇总了Python中user_agents.parse函数的典型用法代码示例。如果您正苦于以下问题:Python parse函数的具体用法?Python parse怎么用?Python parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: parse_pyua
def parse_pyua(self):
try:
self.df_p['pyua_browser'] = map(lambda x : parse(x).browser.family, self.ua_in)
self.df_p['pyua_device'] = map(lambda x : parse(x).device.family, self.ua_in)
self.df_p['pyua_pc'] = map(lambda x : parse(x).is_pc, self.ua_in)
self.df_p['pyua_mob'] = map(lambda x : parse(x).is_mobile, self.ua_in)
self.df_p['pyua_tab'] = map(lambda x : parse(x).is_tablet, self.ua_in)
except Exception as err:
print "pyua can't parse this string", self.ua_in
print err
return self.df_p
开发者ID:christinataylor,项目名称:602-project,代码行数:11,代码来源:ua_map.py
示例2: get_user_agent
def get_user_agent(request):
# Tries to get UserAgent objects from cache before constructing a UserAgent
# from scratch because parsing regexes.yaml/json (ua-parser) is slow
ua_string = request.META.get('HTTP_USER_AGENT', '')
if cache:
key = get_cache_key(ua_string)
user_agent = cache.get(key)
if user_agent is None:
user_agent = parse(ua_string)
cache.set(key, user_agent)
else:
user_agent = parse(ua_string)
return user_agent
开发者ID:Phantazm,项目名称:django-user_agents,代码行数:13,代码来源:utils.py
示例3: emailOpen
def emailOpen(e):
d = {}
if request.cookies.get('LATrackingID'):
a = modules.getModel(models.App, appid = request.cookies.get('LATrackingID'))
d['app_id'] = a.id
d['private_ip'] = request.environ.get('REMOTE_ADDR')
d['public_ip'] = request.environ.get('HTTP_X_FORWARDED_FOR')
d['full_url'] = request.environ.get('HTTP_REFERER', '').strip().lower()
email = db.session.query(models.Email).filter_by(emailid=e).first()
if email:
d['email_id'] = email.id
else:
return jsonify(**{'status':'failure', 'description':'no such email found'})
if d['public_ip']:
g = geocoder.ip(d['public_ip'])
d['lat'], d['lng'] = g.latlng
d['city'] = g.city
d['country'] = g.country
d['state'] = g.state
d['user_agent'] = request.environ.get('HTTP_USER_AGENT')
if d['user_agent']:
user_agent = parse(d['user_agent'])
d['browser'] = user_agent.browser.family
d['is_bot'], d['is_mobile'], d['is_tablet'], d['is_pc'] = user_agent.is_bot, user_agent.is_mobile, user_agent.is_tablet, user_agent.is_pc
p = models.Visit(**d)
p.date = datetime.now()
db.session.add(p)
db.session.commit()
return jsonify(success=True, description='successfully tracked email')
开发者ID:sinanuozdemir,项目名称:iris_calculator,代码行数:29,代码来源:controller.py
示例4: getBrowser
def getBrowser(userAgent):
# check for empty or null uri
if userAgent:
user_agent = parse(userAgent)
return user_agent.browser.family.lower()
else:
return None
开发者ID:ibnipun10,项目名称:Projects,代码行数:7,代码来源:kinesisStream.py
示例5: update_browser_num
def update_browser_num(list_br, packet):
if packet is None:
return [0,0,0,0,0]
else:
if(len(list_br) == 0):
list_br = [0,0,0,0,0]
if(not(is_http_get(packet))):
return list_br
else:
raw_ua = packet[get_http_layer(packet)].user_agent
parse_ua = parse(raw_ua)
ua_browser = parse_ua.browser.family
if "Firefox" in ua_browser:
list_br[0] = 1
else:
if "Chrome" in ua_browser:
list_br[1] = 1
else:
if "Safari" in ua_browser:
list_br[2] = 1
else:
if "Internet Exlorer" in ua_browser:
list_br[3] = 1
else:
list_br[4] = 1
return list_br
开发者ID:zaratec,项目名称:nat-proxy-deanonymizer,代码行数:27,代码来源:pcap-parser.py
示例6: addUserAgentInfo
def addUserAgentInfo(db):
uaCompleted = set()
for ua in list(db.execute("""select useragent from access
except
select useragent from uainfo""")):
userAgent = ua[0]
if userAgent in uaCompleted:
continue
uaRec = user_agents.parse(userAgent)
if not uaRec:
continue
if uaRec.is_pc:
browserType = 'Browser'
elif uaRec.is_mobile:
browserType = 'Mobile Browser'
elif uaRec.is_bot:
browserType = 'Robot'
else:
browserType = 'unknown'
db.execute("""insert or replace into uainfo(useragent,
browser_type, ua_name, os_name, os_family) values(?, ?, ?, ?, ?)""",
(userAgent, browserType, uaRec.browser.family,
'%s %s' % (uaRec.os.family, uaRec.os.version_string), uaRec.os.family))
uaCompleted.add(userAgent)
db.commit() # commit per record in case we exit
return
开发者ID:mhalle,项目名称:slicer4-server-utils,代码行数:28,代码来源:__main__.py
示例7: connectionMade
def connectionMade(self):
log.debug("HTTP connection made.")
try:
user_agent = parse(self.headers['user-agent'])
self.clientInfo["clientos"] = user_agent.os.family
self.clientInfo["browser"] = user_agent.browser.family
try:
self.clientInfo["browserv"] = user_agent.browser.version[0]
except IndexError:
self.clientInfo["browserv"] = "Other"
except KeyError:
self.clientInfo["clientos"] = "Other"
self.clientInfo["browser"] = "Other"
self.clientInfo["browserv"] = "Other"
self.clientInfo["clientip"] = self.client.getClientIP()
self.plugins.hook()
self.sendRequest()
self.sendHeaders()
if (self.command == 'POST'):
self.sendPostData()
开发者ID:4eu3,项目名称:MITMf,代码行数:25,代码来源:ServerConnection.py
示例8: format_record
def format_record(r, recursive):
path = r.req["path"]
if "twostream" in path:
try:
path = r.req["referrer"].replace("https://www.govtrack.us", "")
except:
pass
if "?" in path: path = path[:path.index("?")] # ensure no qsargs
if r.req.get("query"): path += "?" + urllib.parse.urlencode({ k.encode("utf8"): v.encode("utf8") for k,v in list(r.req["query"].items()) })
if r.req['agent']:
ua = str(user_agents.parse(r.req['agent']))
if ua == "Other / Other / Other": ua = "bot"
ua = re.sub(r"(\d+)(\.[\d\.]+)", r"\1", ua) # remove minor version numbers
else:
ua = "unknown"
ret = {
"reqid": r.id,
"when": r.when.strftime("%b %-d, %Y %-I:%M:%S %p"),
"netblock": get_netblock_label(r.req['ip']) if r.req['ip'] else None,
"path": path,
"query": r.req.get('query', {}),
"ua": ua,
}
if recursive:
ret["netblock"] = ", ".join(sorted(set( get_netblock_label(rr.req["ip"]) for rr in Sousveillance.objects.filter(subject=r.subject) if rr.req["ip"] )))
ret["recent"] = [format_record(rr, False) for rr in Sousveillance.objects.filter(subject=r.subject, id__lt=r.id).order_by('-when')[0:15]]
return ret
开发者ID:govtrack,项目名称:govtrack.us-web,代码行数:29,代码来源:views.py
示例9: check_cookie_present
def check_cookie_present(request):
#TODO we need to check the number of redirects in case we end up in a loop for some reason
if HTTPS_IFRAME_COOKIESETTER_URL_TO_CHECK in request.path \
and not ((settings.MEDIA_URL and request.path.startswith(settings.MEDIA_URL)) or request.path.startswith(settings.STATIC_URL)) \
and (not HTTPS_IFRAME_COOKIESETTER_ONLY_HTTPS or(HTTPS_IFRAME_COOKIESETTER_ONLY_HTTPS and request.is_secure())) \
and call_additional_checks():
#get the url to the cookiesetter view
cookiesetter_view_path = urlpath()
user_agent = parse(request.META.get('HTTP_USER_AGENT', ''))
if user_agent.browser.family in HTTPS_IFRAME_COOKIESETTER_BROWSERS \
and cookiesetter_view_path not in request.path:#these are after the initial check as it is an expensive lookup
current_absolute_url = urllib2.quote(request.build_absolute_uri().encode("utf8"))
cookies_present = True
for cookie_string in HTTPS_IFRAME_COOKIESETTER_COOKIES:
try:
cookie_token = request.COOKIES[cookie_string]
except KeyError:
cookies_present = False
if not cookies_present:
#ehck url scheme to http
redirect_url = '%s?absurl=%s' %(cookiesetter_view_path, current_absolute_url)
redirect_url = request.build_absolute_uri(redirect_url)
parsed = urlparse(redirect_url)
redirect_url = '%s://%s%s?%s' % ('http',parsed.netloc, parsed.path, parsed.query)
return False,redirect_url
requested_url = request.build_absolute_uri()
return True, requested_url
开发者ID:cyacco,项目名称:django-httpsiframecookiesetter,代码行数:34,代码来源:utils.py
示例10: index
def index():
ua = request.headers.get('User-Agent')
user_agent = parse(ua)
user = g.user.nickname
image = g.user.image
user_id = g.user.id
return render_template('index.html',title='home',user=user,image=image,id=user_id)
开发者ID:sandeep6189,项目名称:MoEngage,代码行数:7,代码来源:views.py
示例11: Analytics
def Analytics(REQ):
from datetime import datetime
user_agent = parse(REQ.META.get('HTTP_USER_AGENT'))
Code = REQ.GET.get("sn","")
inurl = REQ.get_full_path()
os = user_agent.os.family
browser = user_agent.browser.family
ip = REQ.META.get('HTTP_X_FORWARDED_FORMETA') and REQ.META.get('HTTP_X_FORWARDED_FORMETA') or REQ.META.get('REMOTE_ADDR')
indata = {'ip': ip, 'browser': browser, 'os': os}
try:
ebusiness = ebusiness_members.objects.get(code=Code)
isIn = ebusiness.flow_analytics_set.filter(**indata).order_by('-intime')
ebusiness_flow = ebusiness.flow_analytics_set
except ObjectDoesNotExist:
isIn = flow_analytics.objects.filter(**indata).filter(ebusiness=None).order_by('-intime')
ebusiness_flow = flow_analytics.objects
if isIn.count() < 1:
indata.update({"inurl":inurl,"endurl":inurl})
CreateIn = ebusiness_flow.create(**indata)
CreateIn.save()
else:
oldTime = isIn.values()[0]['intime'].strftime('%Y%m%d')
newTime = datetime.now().strftime('%Y%m%d')
if newTime == oldTime:
oldID = isIn.values()[0]['id']
UpdataIn = ebusiness_flow.get(id=oldID)
UpdataIn.num = UpdataIn.num + 1
UpdataIn.endurl = inurl
UpdataIn.save()
else:
indata.update({"inurl":inurl,"endurl":inurl})
CreateIn = ebusiness_flow.create(**indata)
CreateIn.save()
return ''
开发者ID:banjin,项目名称:klb,代码行数:35,代码来源:EbusinessTag.py
示例12: redirect
def redirect(request, shorturl):
#send a 500 error shortURL doesn't exist
try:
urlObject = ShortUrl.objects.get(shortid=shorturl)
except:
return HttpResponseServerError()
#check UA of request
#user_agents is awesome! (pip install pyyaml ua-parser user-agents)
userAgent = parse(request.META.get('HTTP_USER_AGENT', ''))
if urlObject:
if userAgent.is_mobile:
urlObject.mobileRedirectCount += 1
urlObject.save()
return HttpResponseRedirect(urlObject.fullMobileUrl)
elif userAgent.is_tablet:
urlObject.tabletRedirectCount += 1
urlObject.save()
return HttpResponseRedirect(urlObject.fullTabletUrl)
elif userAgent.is_pc:
urlObject.desktopRedirectCount += 1
urlObject.save()
return HttpResponseRedirect(urlObject.fullDesktopUrl)
开发者ID:dogeter,项目名称:shorturl,代码行数:26,代码来源:views.py
示例13: verify_browser
def verify_browser(request, min_versions=None):
""" accepts a request and tags it with browser support info
if `min_versions` is passed in, it skould be a dictionary of
'browser': version
"""
if not min_versions:
min_versions = settings.MIN_BROWSER_VERSIONS
request.user_agent = parse(request.META.get('HTTP_USER_AGENT', ''))
request.browser_unknown = True
request.browser_unsupported = False
for family, version in min_versions.items():
if request.user_agent.browser.family == family:
request.browser_unknown = False
bversion = request.user_agent.browser.version
if isinstance(bversion, (list, tuple)):
if len(bversion) > 0:
bversion = bversion[0]
else:
bversion = 0
else:
bversion = bversion
if bversion < version:
request.browser_unsupported = True
break
开发者ID:VelocityWebworks,项目名称:django-browser-verification,代码行数:30,代码来源:utils.py
示例14: publish
def publish(request, dispatcher):
"initialise req from the Twisted reauest"
# First we need to transform the request into our own format
# our format is {key:value, .., cookies:{key:value}, request:request}
req = Req()
# retain multiple value args as a list
req.update(dict([(i[0], len(i[1]) > 1 and i[1] or i[1][0])
for i in request.__dict__['args'].items()]))
req.cookies = request.__dict__['received_cookies'] or {}
# if we have the relevant modules then add user agent information
if user_agents:
ua_string = request.getHeader('user-agent')
req.user_agent = user_agents.parse(ua_string or '')
else:
req.user_agent = None
req.request = request
# set up Session cache
session = request.getSession()
req.cache = ISessionCache(session)
# get the domain and port
req._v_domain = req.get_host().split(":")[0] # excludes port
# Now process the request
path = request.__dict__['path']
try:
result = dispatcher.request(path, req)
except:
raise
sys.stderr.write(DATE().time())
sys.stderr.write(path+'\n')
result="request error..."
return result
开发者ID:mrcjhurst,项目名称:evoke,代码行数:34,代码来源:req.py
示例15: index
def index(groupKey=None):
if groupKey=='favicon.ico': abort(404)
#세션리셋
session.clear()
#ip = socket.gethostbyname(socket.gethostname())
ip = request.remote_addr
#https://pypi.python.org/pypi/user-agents/ #pip install user-agents
from user_agents import parse
user_agent = parse(request.user_agent.string)
if user_agent.is_mobile==True : platform = "mobile"
else : platform = "web"
accessLog = AccessLog(ip, platform)
db_session.add(accessLog)
try:
db_session.commit()
except exc.IntegrityError as e:
db_session.rollback()
debug = request.args.get('debug', '')
email = request.args.get('email', '')
resp = make_response( render_template('index.html', groupKey=groupKey) )
if email!='':
resp.set_cookie('email', email)
if debug!='':
resp.set_cookie('debug', debug)
if groupKey!=None:
resp.set_cookie('groupKey', groupKey)
return resp
开发者ID:kitworks,项目名称:Oasis-Web,代码行数:34,代码来源:controllers.py
示例16: index
def index(request, page):
#ページネーション作成
#itemをcount
itemCount = Item.objects.raw('select id, count(*) count from Item where genreId in (510914, 294456, 101480,204122,506438,511121,101483,563353,200164,511068,204030,101467,511073,511018,563381,204064,506475,510927,204049,563350,204078,204262,204119,204088,204260,563379,511191,302804,563490,563378,101479,204081,204055,563455,563355,200045,563477,563373,204069,204084,101469,553329,204072,511248,204279,511026,563377,101484,511009,563349,101478,511046,204283,302801,510930,563380,563451,563364,563481,204263,200044,507977,204120,101476,553328,506498,506443,204130,204091,200048,510943,563406,201318,563461,204027,204086,204068,511199,204121,563359,101481,302800,510923,563463,506439,204071,204034,510973,563452,563387,204060,204061,563391,511182,511025,204080,563358,563474,563402,511155,511013,563356,563469,511072,563457,563352,204085,563489,563454,511048,200041,563375,204118,204275,204089,563398,563362,510993,510947,204039,563460,204036,511156,563482,563401,511111,511091,204048,563371,511134,510989,553310,510974,563465,511104,511187,200040,563464,101477,563486,101472,506454,204135,204092,204259,511069,204131,506497,510985,563483,563383,563466,510939,563470,204037,510938,200049,563453,563476,563366,511001,204065,302803,204265,506484,511021,204052,563456,204271,511178,563475,204083,563405,511129,204042,511057,563478,511249,302802,204063,204075,511194,563473,510922,563365,563497,553315,511163,511198,204051,511122,563479,511125,511160,563462,563459,511171,511110,511060,553314,511190,510931,511168,563392,204074,563496,563390,511099,510977,204266,506449,511130,510935,204126,511183,511233,563360,511076,563363,563393,511002,563385,563399,510997,506468,101468,511092,204123,511222,511221,506494,563374,511038,511042,563351,204127,510994,563416,563492,563491,563415,563369,510981,511037,101473,302807,511041,510986,506495,563493,204046,510982,510978,511022,511077,511264,204133,204066,563495,563376,511195,563446,506453,511126,511214,511283,511164,511159,511179,563494,511049,563458,511252,511237,511279,511151,506444,563370,511238,563386,302806,511053,511251,204134,506458,302805,511271,511089,506485,511066,510942,511229,511065,511005,506459,563372,511276,563357,506480,563346,511218,511100,511140,563485,510946,553319,563421,563480,510971,511056,204128,511275,511288,553299,563472,563394,204136,511259,510926,553309,563354,563467,563445,511209,511210,506469,511230,563468,511203,204077,506489,506479,511010,511267,511272,511136,511061,511284,511170,510918,511225,553321,563471,510934,511268,553320,204132,511186,511119,563345,563361);')[0].count
#pageが数字なら
try:
page = int(request.GET['page'])
page = pager.pagerInt(page, itemCount)['page']
start_id = pager.pagerInt(page, itemCount)['start_id']
prevNext = pager.pagerInt(page, itemCount)['prevNext']
#pageが数字じゃなかったら
except:
page = pager.pagerNotInt()['page']
start_id = pager.pagerNotInt()['start_id']
prevNext = pager.pagerNotInt()['prevNext']
itemList = Item.objects.raw('select id, itemName, itemPrice, mediumImageUrls from Item where genreId in (510914, 294456, 101480,204122,506438,511121,101483,563353,200164,511068,204030,101467,511073,511018,563381,204064,506475,510927,204049,563350,204078,204262,204119,204088,204260,563379,511191,302804,563490,563378,101479,204081,204055,563455,563355,200045,563477,563373,204069,204084,101469,553329,204072,511248,204279,511026,563377,101484,511009,563349,101478,511046,204283,302801,510930,563380,563451,563364,563481,204263,200044,507977,204120,101476,553328,506498,506443,204130,204091,200048,510943,563406,201318,563461,204027,204086,204068,511199,204121,563359,101481,302800,510923,563463,506439,204071,204034,510973,563452,563387,204060,204061,563391,511182,511025,204080,563358,563474,563402,511155,511013,563356,563469,511072,563457,563352,204085,563489,563454,511048,200041,563375,204118,204275,204089,563398,563362,510993,510947,204039,563460,204036,511156,563482,563401,511111,511091,204048,563371,511134,510989,553310,510974,563465,511104,511187,200040,563464,101477,563486,101472,506454,204135,204092,204259,511069,204131,506497,510985,563483,563383,563466,510939,563470,204037,510938,200049,563453,563476,563366,511001,204065,302803,204265,506484,511021,204052,563456,204271,511178,563475,204083,563405,511129,204042,511057,563478,511249,302802,204063,204075,511194,563473,510922,563365,563497,553315,511163,511198,204051,511122,563479,511125,511160,563462,563459,511171,511110,511060,553314,511190,510931,511168,563392,204074,563496,563390,511099,510977,204266,506449,511130,510935,204126,511183,511233,563360,511076,563363,563393,511002,563385,563399,510997,506468,101468,511092,204123,511222,511221,506494,563374,511038,511042,563351,204127,510994,563416,563492,563491,563415,563369,510981,511037,101473,302807,511041,510986,506495,563493,204046,510982,510978,511022,511077,511264,204133,204066,563495,563376,511195,563446,506453,511126,511214,511283,511164,511159,511179,563494,511049,563458,511252,511237,511279,511151,506444,563370,511238,563386,302806,511053,511251,204134,506458,302805,511271,511089,506485,511066,510942,511229,511065,511005,506459,563372,511276,563357,506480,563346,511218,511100,511140,563485,510946,553319,563421,563480,510971,511056,204128,511275,511288,553299,563472,563394,204136,511259,510926,553309,563354,563467,563445,511209,511210,506469,511230,563468,511203,204077,506489,506479,511010,511267,511272,511136,511061,511284,511170,510918,511225,553321,563471,510934,511268,553320,204132,511186,511119,563345,563361) ORDER BY itemPrice DESC limit %s, 30;' % start_id)
c = Context({'typicalCategories':typicalCategories, 'searchForm':searchForm, 'itemList':itemList, 'itemCount':itemCount/30 + 1, 'prevNext':prevNext, 'page': page,})
if parse(request.META['HTTP_USER_AGENT']).is_mobile:
t = loader.get_template('rakuten/spIndex.html')
else:
t = loader.get_template('rakuten/index.html')
return HttpResponse(t.render(c))
开发者ID:onozeam,项目名称:mysite,代码行数:29,代码来源:views.py
示例17: supported_browser
def supported_browser(request):
if 'supported_browser' not in request.session:
user_agent = parse(request.META.get('HTTP_USER_AGENT', ''))
request.session['supported_browser'] = all(
pass_browser_entry(user_agent, entry) for entry in browser_requirements)
return {'supported_browser': request.session['supported_browser']}
开发者ID:indirectlylit,项目名称:kolibri,代码行数:7,代码来源:custom_context_processor.py
示例18: make_quest_log_entry
def make_quest_log_entry(user, request):
try:
ip_address = request.remote_addr
user_agent = parse(request.user_agent.string)
request_json = request.json
if user_agent.is_mobile:
device_type = 0
elif user_agent.is_tablet:
device_type = 1
elif user_agent.is_pc:
device_type = 2
else:
device_type = -1
new_quest_log_entry = QuestLogEntry(
chapter_index=user.chapter_index_id,
cumulative=user.cumulative,
datetime_quest_completed=datetime.datetime.now(),
datetime_quest_started=user.datetime_quest_started,
device_family=user_agent.device.family,
device_model=user_agent.device.model,
device_type=device_type,
ip_address=ip_address,
is_daily=user.is_on_daily,
is_timed=user.is_timed,
latitude=request_json['latitude'],
longitude=request_json['longitude'],
number_of_questions=user.number_of_questions,
user_id=user.user_id,
number_correct=user.number_correct
)
new_quest_log_entry.save()
except Exception as ex:
print(ex)
print("Failed to make quest log entry.")
开发者ID:pasab75,项目名称:zhen_school_app_demo,代码行数:35,代码来源:rest_functions.py
示例19: parse_data
def parse_data(self,data):
# Get User agent details and parse it
ua = user_agents.parse(data['user_agent'])
data['browser'] = ua.browser.family + ua.browser.version_string
data['os'] = ua.os.family
data['user_agent_name'] = data['user_agent'].split()[0]
# Get Request name separately from the request
data['request_name'] = data['request'].split()[0]
# Convert time in to datettime
time = data['time'].split()[0]
try:
date = datetime.strptime(time, "%d/%b/%Y:%H:%M:%S")
except ValueError:
date = "NULL"
data['time'] = date
if data["user"] == "-":
data["user"] = None
data["status"] = int(data["status"])
if data["size"] == "-":
data["size"] = 0
else:
data["size"] = int(data["size"])
if data["referer"] == "-":
data["referer"] = None
return data
开发者ID:mthak,项目名称:rpt,代码行数:25,代码来源:ParseApache.py
示例20: make_activity_log_entry
def make_activity_log_entry(user, correct, request):
try:
ip_address = request.remote_addr
user_agent = parse(request.user_agent.string)
request_json = request.json
if user_agent.is_mobile:
device_type = 0
elif user_agent.is_tablet:
device_type = 1
elif user_agent.is_pc:
device_type = 2
else:
device_type = -1
new_activity_log_entry = ActivityLogEntry(
correct=correct,
current_word_index=user.current_word_index,
datetime=datetime.datetime.now(),
datetime_quest_started=user.datetime_quest_started,
datetime_question_started=user.datetime_question_started,
device_family=user_agent.device.family,
device_model=user_agent.device.model,
device_type=device_type,
ip_address=ip_address,
is_daily=user.is_on_daily,
is_timed=user.is_timed,
latitude=request_json['latitude'],
longitude=request_json['longitude'],
number_of_questions=user.number_of_questions,
user_id=user.user_id
)
new_activity_log_entry.save()
except Exception as ex:
print(ex)
print("failed too make activity log entry.")
开发者ID:pasab75,项目名称:zhen_school_app_demo,代码行数:35,代码来源:rest_functions.py
注:本文中的user_agents.parse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论