Cronjob or Scheduler not working if there is request.get

I have scheduler and cron job that is to fetch data from API in remote server.
When I try running bench execute it works but it is not working when I schedule it.

Below is the function

def fill_orders():
    #example API call
    x = requests.get('https://w3schools.com')
    doc = frappe.new_doc('Orders')
    doc.my_id = "Test ID"
    doc.channel_id = "XYZABC"
    doc.insert()

bench execute path_to.function.fill_orders works but when I left it in the schedule in the hooks.py file, it fails. After commenting out the line with requests.get, it works again. Any help would be appreciated.

i am also facing this issue, if you find the solution can you share

Whitelist the function and try again