question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Public API for recently fetched entries, or entries added/modified since date?

See original GitHub issue

For app I’m working on, I wish to update some feeds and do something on entries that appeared. But I’m unsure how to implement this last part and get only new entries.

Workflow I sketched so far is:

  1. Disable updates for all feeds in db (because there might be some I don’t wish to update)
  2. Start adding feeds to db 2.1. If feed already exists, enable it for updates 2.2. If feed doesn’t exist, it will be added and enabled for updates automatically
  3. Update feeds through update_feeds or update_feeds_iter
  4. ???

update_feeds doesn’t return anything. update_feeds_iter gives me back list of UpdateResult, where each item will have url and counts or exception.

So, I think I can sum all the counts and ask for that many entries. Something like:

count = sum(
    sum(result.value.new, result.value.updated)
    for result in results
    if not isinstance(result.value, ReaderError)
)
new_entries = reader.get_entries(limit=count)

But is it guaranteed that get_entries(sort='recent') will include recently updated entry? Even if that entry originally appeared long time ago? I might be misunderstanding what it means for entry to be marked as “updated”, so any pointer on that would be helpful, too.

Perhaps I could change my workflow a little - first get monotonic timestamp, then run all the steps, and finally ask for all entries that were added or modified after timestamp. But it seems that there is no API for searching by date? search_entries is designed for full-text search and works only on few columns.

So, my question is:

  1. What is the preferred way of obtaining all entries added in update call? Counting and using get_entries? Calling get_entries for everything and discarding all results that were added / modified before timestamp? Something else?
  2. What does it mean that entry was “updated”?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mirekdlugoszcommented, Jun 20, 2021

Thanks for quick merge and all your help along the way. Please take your time with next release. I can wait a few weeks until you are comfortable with releasing.

And last but not least, thank you for creating the library. It made my life so much easier. I think it does everything that I need, but if I have another improvement idea or I encounter any bug, I’ll make sure to contribute again.

0reactions
lemon24commented, Nov 2, 2021
  1. Disable updates for all feeds in db (because there might be some I don’t wish to update)

Being able to filter by tag in update_feeds() would make this more ergonomic, but at the moment it’s not a priority for me (since it can be done as you suggested above).

@mirekdlugosz: I just resolved #193; update_feeds() can now filter feeds in all the ways get_feeds() can, including by tag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fetch records after a particular date - couchdb
This reads as "fetch documents whose 'effectiveDateOfAction' field is greater than or equal to 1st October 2018'. See this blog post on how...
Read more >
How to I get the last modified date of a custom object or field ...
In Apex you can get the LastModifiedDate by the name 'LastModifiedDate'. It returns a Date/Time object. Account a = [Select a. LastModifiedById ...
Read more >
REST API Developer Guide
REST API is one of several web interfaces that you can use to access your Salesforce data without using the Salesforce user interface....
Read more >
Python & APIs: A Winning Combo for Reading Public Data
In this tutorial, you'll learn what APIs are and how to consume them using Python. You'll also learn some core concepts for working...
Read more >
Search REST API Reference - Algolia
Typically, all your records would be tagged with their associated user_id , and you would add a filter at query time like ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found