Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def nicupdate():
arg_hostname = request.query.hostname
arg_myip = request.query.myip
assert len(arg_hostname) > 0
assert len(arg_myip) > 0
#assert arg_hash in sample_data
response.content_type = 'text/plain; charset=utf-8'
return str("good %s" % arg_myip)
def getBBOX(db):
bounds = request.query['bbox']
w,s,e,n = map(float,bounds.split(','))
stops = db.query(Stop).filter(Stop.stop_lat < n, Stop.stop_lat >s,
Stop.stop_lon < e, Stop.stop_lon > w).limit(300).all()
features = []
for stop in stops:
ft = geojson.feature(id = stop.stop_id, feature_type = "Point",
coords = [float(stop.stop_lon), float(stop.stop_lat)],
properties = stop.as_dict)
features.append(ft)
geojson.featureCollection(features)
return geojson.featureCollection(features)
def get_page():
try:
page = request.query.page or 1
page = int(page)
except (ValueError):
page = 1
return page
def render():
if 'from' in request.query:
fromTime = parseATTime(request.query['from'])
else:
fromTime = parseATTime('-1d')
if 'until' in request.query:
untilTime = parseATTime(request.query.until)
else:
untilTime = parseATTime('now')
targets = request.query.getall('target')
if 'format' in request.query:
format_ = request.query.format
else:
format_ = 'json'
store = app.config['store']
requestContext = {'startTime': fromTime,
'endTime': untilTime,
'data': [],
'localOnly': True
def route_handler(self):
self.stats = Stats(self.profile)
func_name = bottle.request.query.get(FUNC_NAME_KEY) or ''
sort = bottle.request.query.get(SORT_KEY) or ''
self.stats.sort(sort)
callers = self.stats.show_callers(func_name).read() if func_name else ''
callees = self.stats.show_callees(func_name).read() if func_name else ''
data = {
'title': self.title,
'stats': self.stats.sort(sort).show(func_name).read(),
'callers': callers,
'callees': callees,
}
return bottle.template(STATS_TEMPLATE, **data)
def coreferences():
sentences = request.query['sentence']
text_param = sentences
if text_param is not None:
text = text_param
context = []
if "context" in request.query:
context = [unicode(utt) for utt in request.query.getall("context")]
text_speaker = request.query["textspeaker"] if "textspeaker" in request.query else ""
context_speakers = request.query.getall("contextspeakers") if "contextspeakers" in request.query else []
speakers_names = request.query["speakersnames"] if "speakersnames" in request.query else {}
print("text", text)
print("context", context)
coref.one_shot_coref(text, text_speaker,
context, context_speakers,
speakers_names)
return coref.run_coref()
def resp(estimate,simulate):
print "Request: %s\n" % request.query.json
req = simplejson.loads(request.query.json)
returnobj = misc.run_model(req,DSET,estimate=estimate,simulate=simulate,variables=variables)
return returnobj
estimate = int(request.query.get('estimate',1))
def announce():
announcement = request.query
swarm = Swarm.from_announcement(announcement)
update_peer_info(announcement, request.headers.get("User-Agent", None))
listing = swarm.listing(
number_of_peers=int(request.query.get("numwant", 50)))
listing.update({
"tracker id": tracker_id,
"interval": interval
})
return bencode(listing)
def champion_id(region, id):
return merakikernel.riotapi.championapi.champion_id(region, id, dict(bottle.request.query))
def epglist_getter():
sEcho = request.query.sEcho
retlist = []
totalrows = 0
if sEcho: # Server-side processing
columns = ['guide_chan.g_name', 'guide.g_title', 'guide.g_desc', 'guide.g_start', 'guide.g_stop']
sLimit = "LIMIT %s OFFSET %s" % (request.query.iDisplayLength, request.query.iDisplayStart)
iSortingCols = int(request.query.iSortingCols)
sOrder = ""
if iSortingCols:
sOrder = "ORDER BY"
col = int(request.query['iSortCol_0'])
sOrder += " %s " % columns[col]
sOrder += "ASC" if request.query['sSortDir_0']=="asc" else "DESC"
if sOrder == "ORDER BY":
sOrder = ""
iSearch = request.query.sSearch
sWhere = ""