def _process_store_data(cls, data, update=True): ''' Internal, parse the Query data and populate the database, for Play Store only ''' parser = GooglePlayStoreScraper() if data: parser.feed(data.decode('utf-8')) apps = parser.apps else: apps = [] for app in apps: entity = AppInfo( name=app.get('name'), bundleid=app.get('docid'), icon=None, icon_url=app.get('image-small'), description=app.get('description'), version=None, developer=app.get('developer'), company_name=app.get('developer'), app_url=app.get('link'), platform=PlatformType.ANDROID ) if update: AppInfo.update(entity) logging.getLogger().debug("Inserted %s successfully", len(apps)) return apps
def app_store_search(cls, update=True, **parameters): ''' Run the Search Query on the Apple App Store and thereafter populate the database ''' apps = iTunesAppStoreRSSAndSearch.search(**parameters) if apps: apps = json.loads(apps) else: return [] for app in apps.get('results', []): entity = AppInfo( name=app.get('trackName'), bundleid=app.get('bundleId'), icon=None, icon_url=app.get('artworkUrl60'), description=app.get('description'), version=None, developer=app.get('artistName'), company_name=app.get('artistName'), app_url=app.get('trackViewUrl'), platform=PlatformType.IOS ) if update: AppInfo.update(entity) return apps.get('results', [])
def app_store_fetch(cls, **parameters): ''' Run the Fetch Query on the Apple App Store and thereafter populate the database ''' data = iTunesAppStoreRSSAndSearch.fetch(**parameters) if data: apps = iTunesAppStoreRSSAndSearch.parse_xml(data) else: apps = [] for app in apps: entity = AppInfo( name=app.get('name'), bundleid=app.get('bundleid'), icon=None, icon_url=app.get('image53'), description=app.get('summary'), version=None, developer=app.get('artist'), company_name=app.get('artist'), app_url=app.get('link'), platform=PlatformType.IOS ) AppInfo.update(entity) logging.getLogger().debug("Inserted %s successfully", len(apps)) return apps
def update_appinfo(self, request): resp = AppInfo.update(request) return ResponseMessage(success=True if resp else None)