Ejemplo n.º 1
0
 def post(self):
 
     form = ScraperForm()
     print form
     if form.validate_on_submit():
         cities = form.data.get('cities', ['indianapolis'])
         query_string = form.data.get('query_string', '/search/bia?query=krampus%7C%22karate+monkey%22%7Cecr%7Chardrock')
         
         # query_string = '/search/bia?query=krampus%7C%22karate+monkey%22%7Cecr%7Chardrock'
         # query_string = '/search/cta?query=vue'
         
         scr_sess = ScrapeSession(**form.data)
         scr_sess.save()
         # import pdb; pdb.set_trace()
         
         spawn_scrape(scr_sess)
         
         return redirect(url_for('.sessions'))
Ejemplo n.º 2
0
 def delete(self):
     session_id = request.values['session_id']
     scr_sess = ScrapeSession.objects(id=session_id)[0]
     scr_sess.delete()       
     return redirect(url_for('.sessions'))
Ejemplo n.º 3
0
 def get(self, session_id):
     scr_sess = ScrapeSession.objects(id=session_id)[0]
     return render_template('posts/list.html', sess=scr_sess, listings=scr_sess.listings)
Ejemplo n.º 4
0
 def get(self):
     sessions = ScrapeSession.objects()
     return render_template('sessions.html', sessions=sessions)