Coder Social home page Coder Social logo

Comments (11)

dhimmel avatar dhimmel commented on August 26, 2024

Sorry for the slow response. I think my notifications were turned off somehow.

Anyways I think you are talking about this report date:

image

While it is posted above the "Donohue Exit Quota and Trailhead Space Available" section, I presume it refers to the date the remaining data on the webpage was updated on?

I'm happy to make this addition... shouldn't be too hard.

from hackjohn.

dhimmel avatar dhimmel commented on August 26, 2024

Currently, the date shown in the message is from the HTTP header:

text = f'''Spaces available as of {yose_response.headers['Date']}

You can see the headers that get returned using

curl --head https://www.nps.gov/yose/planyourvisit/fulltrailheads.htm

I believe this Date is set by the server that responds to the request.

I like that idea that we should default to using the date from report date, and only provide this date if that field cannot be found.

from hackjohn.

dhimmel avatar dhimmel commented on August 26, 2024

@neuhoffm see if 8ac9f7d implements your suggestion?

Hackjohn now uses "Report Date" for the date in the message. There is also a min_report_date setting that allows you to suppress notifications until the report date increases to the be >= to min_report_date. This could come in handy if Hackjohn identifies a spot, which is taken by time you call, and therefore you want to continue the search, but suppress notifications until the report updates.

from hackjohn.

neuhoffm avatar neuhoffm commented on August 26, 2024

from hackjohn.

dhimmel avatar dhimmel commented on August 26, 2024

do or don't send a notification based off of that if people wanted

It would be great if we could send only one notification per report date. This would require some sort of memory (persistence data between runs), which currently does not exist. Something to keep in mind, because it would prevent annoying over-notification.

I talked to the reservation office and they're updating the report very sporadically now so unfortunately the 11am M-F isn't a guarantee anymore.

Wow so the report hasn't been updated in 15 days. That is a real bummer. When you call, do they look through their internal systems to see the latest reservation info? Basically, I'm curious whether this change makes it so you just need to call them periodically to get any up to date information. Or is their internal information now only updated infrequently?

from hackjohn.

dhimmel avatar dhimmel commented on August 26, 2024

I see the website says:

This report does not reflect live numbers, so the trailhead may have filled after the last update. Please note the date and time of updates at the top right of the data.

I think "top right of the data" must refer to "Report Date", although this is on the left.

from hackjohn.

dhimmel avatar dhimmel commented on August 26, 2024

I have thought of another solution. We could have a setting to only notify about vacancies in reports less than days_until_stale days. For example, when days_until_stale=1, we would only send notifications when the Report Date was within one day of the current date. This would prevent getting notifications for a report that was already outdated, and does not require persistent data storage.

@neuhoffm would this address your issue?

from hackjohn.

neuhoffm avatar neuhoffm commented on August 26, 2024

from hackjohn.

dhimmel avatar dhimmel commented on August 26, 2024

That could work, are you worried about it persisting the date the last run pulled to a text file?

I wanted to avoid writing files, but I think that is the simplest (and only robust solution). @neuhoffm check out the changes in fbc511e. See if this works for you?

The program now defaults to writing a file to hackjohn-output.txt in the same directory that the script is located. If hackjohn-output.txt is unchanged, then Telegram notification is suppressed. This should ensure that you only get notifications when something has actually changed in the report or in your processing.

With the page being updated sporadically, I've set the script to run every couple of minutes

Got it. From my recent memory, the report was updated on April 3, April 19, and April 22. That two-week gap is scary, but hopefully they stick to the every-other-day frequency or so. Note that it is possible for sites to rate limit a specific IP address or completely block it for making too many requests. Probably not a big risk here, but who knows.

from hackjohn.

neuhoffm avatar neuhoffm commented on August 26, 2024

Looks great! I'll pull down latest and add a PR to support IFTTT if people want to use that instead of middle man

from hackjohn.

dhimmel avatar dhimmel commented on August 26, 2024

add a PR to support IFTTT if people want to use that instead of middle man

That would be a useful additional, I imagine (have never used IFTTT myself).

from hackjohn.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.