def test_can_output_content_as_html(self): """ Should be able to transform a json transformed content into html content """ transformer = GooglePlayParsedResponseTransformer(self.__PARSED_RESPONSE) json = transformer.transform() json = json2html.convert(json = json) self.assertEqual(json, self.__EXPECTED_HTML)
def test_can_transform_parsed_content_into_json_formatted_output(self): """ Should be able to transform parsed content to a json formatted string Hint: If this fails there are chances that google changed the html response structure. """ transformer = GooglePlayParsedResponseTransformer(self.__PARSED_RESPONSE) json = transformer.transform() self.assertEqual(json, self.__EXPECTED_JSON)
def test_can_output_content_as_html(self): """ Should be able to transform a json transformed content into html content """ transformer = GooglePlayParsedResponseTransformer( self.__PARSED_RESPONSE) json = transformer.transform() json = json2html.convert(json=json) self.assertEqual(json, self.__EXPECTED_HTML)
def test_can_transform_parsed_content_into_json_formatted_output(self): """ Should be able to transform parsed content to a json formatted string Hint: If this fails there are chances that google changed the html response structure. """ transformer = GooglePlayParsedResponseTransformer( self.__PARSED_RESPONSE) json = transformer.transform() self.assertEqual(json, self.__EXPECTED_JSON)
""" from docopt import docopt from gpengine.scrapengine import ScrapEngine from gputils.gpparser import GooglePlayResponseParser from gputils.gptransformer import GooglePlayParsedResponseTransformer #to generate the html output from json2html import * if __name__ == '__main__': arguments = docopt(__doc__, version='Google Play Review Scrapper V1.0') application_id = arguments["--appid"] page_number = arguments["--pagenum"] output_format = arguments["--format"] scrapper = ScrapEngine(application_id, page_number) response = scrapper.go() gpparser = GooglePlayResponseParser(response) parsed_response = gpparser.parseResponse() gptransformer = GooglePlayParsedResponseTransformer(parsed_response) json = gptransformer.transform() if output_format == "html": json = json2html.convert(json = json) print(json)
""" from docopt import docopt from gpengine.scrapengine import ScrapEngine from gputils.gpparser import GooglePlayResponseParser from gputils.gptransformer import GooglePlayParsedResponseTransformer #to generate the html output from json2html import * if __name__ == '__main__': arguments = docopt(__doc__, version='Google Play Review Scrapper V1.0') application_id = arguments["--appid"] page_number = arguments["--pagenum"] output_format = arguments["--format"] scrapper = ScrapEngine(application_id, page_number) response = scrapper.go() gpparser = GooglePlayResponseParser(response) parsed_response = gpparser.parseResponse() gptransformer = GooglePlayParsedResponseTransformer(parsed_response) json = gptransformer.transform() if output_format == "html": json = json2html.convert(json=json) print(json)