Example #1
0
def repopulate_cache():
    api.setup("guicavane", "guicavane", cache_dir="./", cache_lifetime=0)

    house_search = [x for x in api.Show.search("house")]
    house = [x for x in house_search if x.name == "House M.D."][0]
    house_seasons = [x for x in house.seasons]
    house_season_4 = [x for x in house_seasons if x.name == "Temporada 4"][0]
    house_season_4_episodes = [x for x in house_season_4.episodes]
    house_season_4_episodes_names = [x.name for x in house_season_4_episodes]
    house_season_4_episodes_info = [x.info for x in house_season_4_episodes]
    house_season_4_episodes_description = [x.description for x in house_season_4_episodes]

    friends_search = [x for x in api.Show.search("friends")]
    friends = [x for x in friends_search if x.name == "Friends"][0]
    friends_seasons = [x for x in friends.seasons]
    friends_season_8 = [x for x in friends_seasons if x.name == "Temporada 8"][0]
    friends_season_8_episodes = [x for x in friends_season_8.episodes]
    friends_season_8_episodes_names = [x.name for x in friends_season_8_episodes]
    friends_season_8_episodes_info = [x.info for x in friends_season_8_episodes]
    friends_season_8_episodes_description = [x.description for x in friends_season_8_episodes]

    matrix_search = [x for x in api.Movie.search("matrix")]
    matrix = [x for x in matrix_search if x.name == "Matrix"][0]
    matrix_info = matrix.info
    matrix_description = matrix.description
Example #2
0
def client():
    '''
    Setup the api for testing
    '''
    app = api.setup('pytest')
    with app.test_client() as client:
        yield client
    api.db_connect.dispose()
Example #3
0
def setup():
    """
    Sets the application up
    """
    logger.debug("In setup...")

    # Set up the database
    db.setup()

    # First configure the main CP server with default, and optional site local
    # configs
    for cfg in configFiles('server', required=True):
        cherrypy.config.update(cfg)

    # Add the API app
    import api
    # Set it up
    app = api.setup()
Example #4
0
import api as mc
import pyglet

window = mc.Window(width=800, height=600, caption='CraftPy', resizable=True)
model = mc.Model()
model._initialize()
window.model = model
mc.setup()
pyglet.app.run()
Example #5
0
 def setUp(self):
     api.setup("guicavane", "guicavane", cache_dir="./", cache_lifetime=13**37)
from sanic import Sanic
from sanic.response import json, text
from sanic_graphql import GraphQLView

from api import schema, setup

app = Sanic()


@app.route("/")
async def root(request):
    return text("Welcome! Call me via POST with graphql query in body.")


@app.route("/", methods=['POST'])
async def post_root(request):
    result = schema.execute(request.json['query'])
    return json(result.data)


app.add_route(GraphQLView.as_view(schema=schema, graphiql=True), '/graphql')

if __name__ == "__main__":
    setup()
    app.run(host="0.0.0.0", port=4000)