def get_board_entries(self, board: str, max_count: int, account: str='enterprise') -> List[Entry]: with FeedlySession(auth=self.token) as sess: if account == 'enterprise': feeds = sess.user.get_enterprise_tags() elif account == 'personal': feeds = sess.user.get_tags() else: raise ValueError("Only enterprise and personal account are taken into account") keep = None for feed in feeds: if feeds[feed].json['label'] == board: keep = feeds[feed] print(keep) category_id = keep.stream_id.content_id entries = [] if account == 'enterprise': entries = sess.user.get_enterprise_tag(category_id).stream_contents(options=StreamOptions(max_count=max_count)) elif account == 'personal': entries = sess.user.get_tag(category_id).stream_contents(options=StreamOptions(max_count=max_count)) else: raise ValueError("Only enterprise and personal account are taken into account") entries = list(entries) return entries
def example_stream_entries(): """ This example will prompt you to enter a category name, download the 10 latest articles from it, and display their titles. """ # Prompt for the category name/id to use user_category_name_or_id = input("> User category name or id: ") # Create the session using the default auth directory session = FeedlySession() # Fetch the category by its name/id # To use an enterprise category, change to `session.user.enterprise_categories`. Tags are also supported. category = session.user.user_categories.get(user_category_name_or_id) # Stream 10 articles with their contents from the category for article in category.stream_contents(options=StreamOptions( max_count=10)): # Print the title of each article print(article["title"])
def stream_ids(self, options: StreamOptions = None): if not options: options = StreamOptions() return IdStream(self._client, self._get_id(), options)
def stream_contents(self, options: StreamOptions = None) -> ContentStream: if not options: options = StreamOptions() return ContentStream(self._client, self._get_id(), options)
config['production']['instapaper']['password']) return instapaper_session_ with FeedlySession( auth=config['production']['feedly']['access_token'], user_id=config['production']['feedly']['client_id'], api_host=config['production']['feedly']['url']) as feedly_session: feeds = feedly_session.user.get_tags() keep = [] for feed in feeds: if feeds[feed].json['id'].find('global.saved') >= 0: keep = feeds[feed] category_id = keep.stream_id.content_id entries = feedly_session.user.get_tag(category_id).stream_contents( options=StreamOptions(max_count=sys.maxsize)) entries = list(entries) if len(entries) > 0: instapaper_session = establish_instapaper_session() instapaper_response = add_to_instapaper(instapaper_session, entries) if instapaper_response: mark_as_read(feedly_session, entries) mark_as_unsaved(feedly_session, entries) else: for _entry in instapaper_response: entries.remove(_entry) mark_as_read(feedly_session, entries) mark_as_unsaved(feedly_session, entries)