from sqlalchemy import Table, Column, Integer, String, DateTime, func, sql from sqlalchemy.schema import ForeignKey, Index from sqlalchemy.orm import relation from flexget import db_schema from flexget.plugin import internet, PluginError from flexget.utils import requests from flexget.utils.database import text_date_synonym, with_session from flexget.utils.sqlalchemy_utils import table_schema, table_add_column from flexget import plugin log = logging.getLogger('api_rottentomatoes') Base = db_schema.versioned_base('api_rottentomatoes', 2) session = requests.Session() # There is a 5 call per second rate limit per api key with multiple users on the same api key, this can be problematic session.add_domain_limiter(requests.TimedLimiter('api.rottentomatoes.com', '0.4 seconds')) # This is developer Atlanta800's API key API_KEY = 'rh8chjzp8vu6gnpwj88736uv' API_VER = 'v1.0' SERVER = 'http://api.rottentomatoes.com/api/public' MIN_MATCH = 0.5 MIN_DIFF = 0.01 @db_schema.upgrade('api_rottentomatoes') def upgrade(ver, session): if ver is 0: table_names = [ 'rottentomatoes_actors',
from sqlalchemy.schema import ForeignKey, Index from sqlalchemy.orm import relation from flexget import db_schema from flexget.plugin import internet, PluginError from flexget.utils import requests from flexget.utils.database import text_date_synonym, with_session from flexget.utils.sqlalchemy_utils import table_schema, table_add_column from flexget import plugin log = logging.getLogger('api_rottentomatoes') Base = db_schema.versioned_base('api_rottentomatoes', 2) session = requests.Session() # There is a 5 call per second rate limit per api key with multiple users on the same api key, this can be problematic session.add_domain_limiter( requests.TimedLimiter('api.rottentomatoes.com', '0.4 seconds')) # This is developer Atlanta800's API key API_KEY = 'rh8chjzp8vu6gnpwj88736uv' API_VER = 'v1.0' SERVER = 'http://api.rottentomatoes.com/api/public' MIN_MATCH = 0.5 MIN_DIFF = 0.01 @db_schema.upgrade('api_rottentomatoes') def upgrade(ver, session): if ver is 0: table_names = [ 'rottentomatoes_actors', 'rottentomatoes_alternate_ids',