本文整理汇总了Python中models.Movie.select方法的典型用法代码示例。如果您正苦于以下问题:Python Movie.select方法的具体用法?Python Movie.select怎么用?Python Movie.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Movie
的用法示例。
在下文中一共展示了Movie.select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getMovies
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
def getMovies():
movies = []
sel_mov = Movie.select()
for mov in sel_mov:
movies.append(mov.__dict__['_data'])
return jsonify(movies)
示例2: handle_data
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
def handle_data(self, text):
if self.break_tag == True:
return
if self.start_tag != True or self.tbody_tag != True:
return
if self.is_a != True and self.is_td != True:
return
movie = self.movies[-1]
if self.td_index == 0:
movie.movie_number = text
print(' processing movie: ' + movie.movie_number)
if movie.movie_multi_a > 1 and Movie.select().where(Movie.movie_number == movie.movie_number).count() >= 1:
print(' unique check failed(multi): ' + movie.movie_number)
movie.movie_status = 'exist'
elif self.td_index == 1:
movie.movie_name = text
elif self.td_index == 2:
movie.movie_duration = text
elif self.td_index == 3:
try:
movie.movie_release_date = datetime.strptime(text, "%Y-%m-%d").date()
except ValueError:
movie.movie_release_date = dt.datetime.fromtimestamp(0).date()
if movie.movie_release_date == self.last_time:
if Movie.select().where(Movie.movie_number == movie.movie_number).count() >= 1:
print(' unique check failed(last time): ' + movie.movie_number)
del self.movies[-1]
self.break_tag = True
if len(self.movies) == 0:
print('******************** no movie update ********************')
elif movie.movie_release_date < self.last_time:
print(' unique check failed(last time): ' + movie.movie_number)
del self.movies[-1]
self.break_tag = True
if len(self.movies) == 0:
print('******************** no movie update ********************')
elif self.td_index == 4:
movie.movie_press = text
示例3: getMovie
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
def getMovie(id):
try:
movie = Movie.select().where(Movie.id == id).dicts().get()
return jsonify(movie)
except peewee.DoesNotExist:
return jsonify({'error': 'Movie not found'})
示例4: get_context
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
def get_context(self):
return {
'movie_list': Movie.select().order_by(Movie.created.desc()).paginate(1, 3)
}
示例5: BeautifulSoup
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
from peewee import *
from models import Movie, Customer, Customer_Movie
import requests
from bs4 import BeautifulSoup
import time
base_url = 'http://www.rottentomatoes.com'
movie_list = Movie.select().where(Movie.fetched == False)
for movie in movie_list:
url = base_url + movie.href + 'reviews/'
print movie.name
print url
try:
print "1"
page = requests.get(url)
print "2"
bf = BeautifulSoup(page.content)
print "3"
review_list = bf.find_all('div',{'class','criticinfo'})
#print "getting " + len(review_list) + " customer info"
for review in review_list:
info = review.find('a')
customer_name = info.text
customer_href = info.get('href')
print "try to save customer " + customer_name
try: