def setUp(self): try: api_key = os.environ['API_KEY'] except: api_key = "a-test-api-key" self.client = swiftype.Client(api_key=api_key, host='localhost:3000') self.engine = 'api-test' self.document_type = 'books'
def setUp(self): try: api_key = os.environ['API_KEY'] except: api_key = "a-test-api-key" client_id = '3e4fd842fc99aecb4dc50e5b88a186c1e206ddd516cdd336da3622c4afd7e2e9' client_secret = '4441879b5e2a9c3271f5b1a4bc223b715f091e5ed20fe75d1352e1290c7a6dfb' self.client = swiftype.Client(api_key=api_key, client_id=client_id, client_secret=client_secret, host='localhost:3000')
def search(per_page=10): USERNAME = settings.Config.SW_EMAIL PASSWORD = settings.Config.SW_PASSWORD API_KEY = settings.Config.SW_API_KEY SW_ENGINE_SLUG = settings.Config.SW_ENGINE_SLUG search_term = request.form.get('search') client = swiftype.Client(username=USERNAME, password=PASSWORD, api_key=API_KEY) results = client.search(SW_ENGINE_SLUG, search_term, options={"search_fields": {"trailer": ["title"]}}) results = [result for result in results['body']['records']['trailer']][:per_page] g.results = [{"thumbnail": result.get("picture"), "genres": result.get("genres"), "title": result.get("title"), "url": result.get("url"), "release_year": str(result.get("release_date")).split("-")[0], "cast": result.get("cast"), "synopsis": result.get("synopsis")} for result in results] g.search_term = search_term return render_template("search.html")
def setUp(self): access_token = '6cf7fbd297f00a8e3863a0595f55ff7d141cbef2fcbe00159d0f7403649b384e' self.engine = 'myusersengine' self.document_type = 'videos' self.client = swiftype.Client(access_token=access_token, host='localhost:3000')
def setUp(self): self.client = swiftype.Client(username='******', password='******', host='localhost:3000')