i.wont.tell
CDCloudflare Developers
•Created by i.wont.tell on 4/15/2024 in #general-help
How to reset turnstile widget?
Currently for every callback that is not success one I ran a function that basically informs the user they need to reload the page or use other ways to perform the action because they are not passing the challenge. But there is this expired callback that I'm assuming fires after a challenge is completed successfully but it expires (It must be because my widget is invisible), so what I want to know is how do I do to reset the challenge in this case so the user doesn't have to reload the page? Is there a function? I trying looking for info but found nothing.
Thank you.
3 replies
CDCloudflare Developers
•Created by i.wont.tell on 4/8/2024 in #general-help
Problem(?) with the turnstile widget
I've added a turnstile widget to my site and depending if it's successful (both challenge and verification) an element is shown, the first time it worked well, then I reloaded the page and now I'm getting in the console:
(I also got an GET error 401)
But the logging of the Function that is called with
data-callback
returned that it indeed passed verification, why is that? First why is it that the function is called if I'm getting 401 and why even though it was called it passed verification?
What I'm also curious about is why it warns that I'm going to get a 401, like it knows about it before hand, why is this happening?
Thank you.5 replies
CDCloudflare Developers
•Created by i.wont.tell on 4/4/2024 in #workers-help
How to write python workers?
I'm trying to learn how to write python workers because I really don't know much about JS so I better try with python. The examples I found are different and I think some stuff is not being explained.
For example, here in the examples page: https://developers.cloudflare.com/workers/languages/python/examples it says that we should import
Response
and other stuff from the js
package, but there is no js
package, or well, there is one but I don't think it's related, there is no Response in that package. Then if I go to this example https://github.com/cloudflare/python-worker-hello-world/blob/master/index.py there is an addEventListener
which afaik is not part of python.
I'm trying to write the worker on python because I need to access environment variables and I don't quite understand how to do that in JS, but then again I don't know how to do that in python either.
In general, as far as I've understood, I should write an on_fetch()
function and call other functions from there as that's the only part where I can actually access the environment variables, is this right?
If this is true then how do I make it so that the function/worker is not available publicly, I mean if my function is at /api/function then anyone that finds out about it can make a request to it and the environment variables will be exposed. I'm using the functions
subdirectory to store the workers.
specifically what I'm want to write is a function to send mails to myself from the form data the worker receives, the logic is already done but how to access the environment variables is what I don't understand plus my concern about the public access of that function. Please help8 replies