Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oklahoma City, Oklahoma #764

Closed
Telain opened this issue Mar 16, 2023 · 6 comments
Closed

Oklahoma City, Oklahoma #764

Telain opened this issue Mar 16, 2023 · 6 comments
Labels
source request Request to add a new source

Comments

@Telain
Copy link

Telain commented Mar 16, 2023

Oklahoma City provides an API with a JSON response. RecordID is probably the most direct, but you can search by address as well.
Retrieving the proper format for either is easily done via: https://data.okc.gov/portal/page/viewer?datasetName=Address%20Trash%20Services

https://data.okc.gov/services/portal/api/data/records/Address%20Trash%20Services?recordID=######

API details: https://data.okc.gov/portal/page/api

@mampfes mampfes added the source request Request to add a new source label Mar 18, 2023
@5ila5
Copy link
Collaborator

5ila5 commented Apr 10, 2023

fixed by #764
they use incapsula which can block requests, so the response sometimes raises an Exception

@5ila5 5ila5 closed this as completed Apr 10, 2023
@sanctas
Copy link

sanctas commented Oct 5, 2023

I get blocked by Encapsula 100% of the time now.

For the time being I have set up a private API url that bypasses encapsula using Puppeteer in Node.JS and set it up as a drop in replacement for the add-on. I assume Selenium for Python would work as well, I'm just not familiar with python.

Would home assistant be able to use Selenium? I would guess not.

@sanctas
Copy link

sanctas commented Oct 5, 2023

Oh while I'm here, on trash days, the OKC API will drop the "upcoming trash day" item after about 10 am. Since the API only provides a single upcoming trash day in the response (as opposed to 3 upcoming for recycling day and bulky trash day) could we add a condition where if it is currently trash day according to the HA calendar, it will continue to return "0 days" until the next day passes?

@5ila5
Copy link
Collaborator

5ila5 commented Oct 6, 2023

Oh while I'm here, on trash days, the OKC API will drop the "upcoming trash day" item after about 10 am. Since the API only provides a single upcoming trash day in the response (as opposed to 3 upcoming for recycling day and bulky trash day) could we add a condition where if it is currently trash day according to the HA calendar, it will continue to return "0 days" until the next day passes?

it's probably not the website but the integration day_switch_time defaults to 10:00 AM you can change this to 24:00 (23:59 not sure weather 24:00 works)

@5ila5
Copy link
Collaborator

5ila5 commented Oct 6, 2023

fix #1306: I modified the requests headers to be more in line of what a browser would send and now the request work again

fix will be part of release 1.43.0 or is available now as master/git version

@sanctas
Copy link

sanctas commented Oct 6, 2023

Wow thanks so much for the quick response! I'll check the change out this evening!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source request Request to add a new source
Projects
None yet
Development

No branches or pull requests

4 participants