-
-
Notifications
You must be signed in to change notification settings - Fork 124
fix cloudflare 403 with curl_cffi #205
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
base: master
Are you sure you want to change the base?
Conversation
|
Can confirm that this works as expected. Before this I had problem with authenticating. |
|
Works as expected - Was not able to authenticate before |
|
I tried to run this fix, but it throws an error - see below. |
|
The published |
|
I have tried this patch and it is not working for me. I tried Saturday and then again this morning thinking maybe my IP was still blocked. Mac OS 15.1.1 python 3.13 There are no errors other than the "403 Client Error: Forbidden for url: https://ocapi-app.arlo.com/api/auth" |
Sorry - it does work. I somehow had screwed up my venv and it was using system packages instead of the virtual environment. Thanks for working out a fix for this! |
|
This was working for me for months and today at 4 pm CST, I started getting the 403 again. Anyone else start having this issue with arlo? |
|
Per investigation here: twrecked/hass-aarlo#1033 The old Netgear "Arlo" user-agent is no longer being accepted. Updating to the "Linux" user-agent allows things to keep working. Note that streaming will return a MPD url when the user-agent matches a desktop/browser. I have found that this "Android" user-agent works to request RTSP like before. |
|
@bjia56 you are awesome. My app is working again with the Android user-agent. |
|
Randomly started getting this error: Failed to start eventstream thread: 403 Client Error: Forbidden for url: https://myapi.arlo.com. Anyone else seeing this? |
|
From inspection of Arlo's web dashboard, it seems they are not currently using SSE in the browser, and instead using MQTT over websockets. The old endpoint might still work with some tweaking however it will be difficult to know what exactly they're looking for without a reference. You could try updating curl_cffi or changing the impersonate target in request.py to latest supported Chrome ( Since this project doesn't have MQTT support, I would suggest moving off of this into one that's more maintained, such as pyaarlo. You could also try the one in our Scrypted plugin, which is a heavily modified version of this project to convert everything into async semantics. Or, take our implementation of MQTT and convert it into something that this project can use. |
|
@bjia56 grateful for your responses: I simple need a snapshot of the cameras to build out a time lapse video project. Based on your experience, which repo should I focus on for such a basic task, pyaarlo or your Scrypted Plugin? |
|
I'm not as familiar with how to use pyaarlo. It's probably more lightweight than setting up an entire Scrypted instance, however with Scrypted you could configure things up so that a snapshot is a simple curl command to a local url (using Arlo plugin + webhook plugin). Using the arlo module from within the Scrypted plugin might be a bit less straightforward since it wasn't designed to be used outside of the plugin. |
Cloudflare frequently returns a 403 on the Arlo login, which to the best of my understanding is decided on client heuristics, i.e. if a client is determined with some confidence to not be a browser, the request is blocked. One of the heuristics used is the TLS fingerprint of the client. The
curl_cffiproject aims to enable Python scripts to bypass this TLS fingerprinting check through creating TLS handshakes that are identical to a real Chrome browser. This is accomplished through the use of thecurl-impersonateproject, which compilescurlwith the exact TLS/SSL libraries used by Chrome and Firefox.We have seen reasonable success in using this option over
cloudscraperin the Scrypted home automation project. A caveat is thatcurl_cffiexposes arequests-like API, but does not implement the full API; therefore,curl_cffiis only used for the initial login, and subsequent requests fall back onrequestssosseclientcan continue working. Arlo appears to be happy with just the token in the header, and performs no additional TLS fingerprinting checks after login succeeds.Note that this is not tested comprehensively, since I do not use this version of the arlo library.
Fixes #204