def edit_game_image(self, id, image): response, content = self.login_required_file(endpoint="/game/%d/edit_image/"%id, file=image) if not response.status == 200: self.error_handler(content) print "Image sent from frontend" return Game.from_dict(json.loads(content))
def edit_game_image(self, id, image): response, content = self.login_required_file( endpoint="/game/%d/edit_image/" % id, file=image) if not response.status == 200: self.error_handler(content) print "Image sent from frontend" return Game.from_dict(json.loads(content))
def games(self,search_term): games_dict = dict(search_term=search_term) response, content = self.request(endpoint="/games/", method="POST", body=games_dict) if not response.status == 200: self.error_handler(content) return [Game.from_dict(game) for game in json.loads(content).get("games")]
def get_games(self): response, content = self.request(endpoint="/games/") if not response.status == 200: self.error_handler(content) return [ Game.from_dict(game) for game in json.loads(content).get("games") ]
def add_game(self, title, platform_id): game_dict = dict(title=title, platform_id=str(platform_id)) response, content = self.login_required_request(endpoint="/game/add/", method="POST", body=game_dict) if not response.status == 200: print "/game/add/ error" self.error_handler(content) return Game.from_dict(json.loads(content))
def games(self, search_term): games_dict = dict(search_term=search_term) response, content = self.request(endpoint="/games/", method="POST", body=games_dict) if not response.status == 200: self.error_handler(content) return [ Game.from_dict(game) for game in json.loads(content).get("games") ]
def edit_game(self, id, title, platform_id, info, release_date, developer, publisher): # platform title developer publisher description release_date game_dict = dict(title=title, platform_id=platform_id, info=info, release_date=release_date, developer=developer, publisher=publisher) response, content = self.login_required_request(endpoint="/game/%d/edit/"%id, method="POST", body=game_dict) if not response.status == 200: self.error_handler(content) return Game.from_dict(json.loads(content))
def edit_game(self, id, title, platform_id, info, release_date, developer, publisher): # platform title developer publisher description release_date game_dict = dict(title=title, platform_id=platform_id, info=info, release_date=release_date, developer=developer, publisher=publisher) response, content = self.login_required_request( endpoint="/game/%d/edit/" % id, method="POST", body=game_dict) if not response.status == 200: self.error_handler(content) return Game.from_dict(json.loads(content))
def game(self, id): response, content = self.request(endpoint="/game/%d/"%id) if not response.status == 200: print "/game/id/ error" self.error_handler(content) return Game.from_dict(json.loads(content))
def get_games(self): response, content = self.request(endpoint="/games/") if not response.status == 200: self.error_handler(content) return [Game.from_dict(game) for game in json.loads(content).get("games")]
def game(self, id): response, content = self.request(endpoint="/game/%d/" % id) if not response.status == 200: print "/game/id/ error" self.error_handler(content) return Game.from_dict(json.loads(content))