Is it possible to make a cron request to a URL via Google App Engine using method=post
. I could not find anything in the documentation allowing different methods other than get
.
https://developers.google.com/appengine/docs/python/config/cron#Python_app_yaml_Cron_support_in_the_development_server
A cron job will invoke a URL, using an HTTP GET request that is subject to the same limits as other HTTP requests . Free applications can have up to 20 scheduled tasks. Paid applications can have up to 250 scheduled tasks.
The App Engine Cron Service allows you to configure regularly scheduled tasks that operate at defined times or regular intervals. These tasks are commonly known as cron jobs. These cron jobs are automatically triggered by the App Engine Cron Service.
The Cron service is designed to provide "at least once" delivery; that is, if a job is scheduled, App Engine sends the job request at least one time.
Well, it turns out that applying the recommended ingress controls also blocks requests from the App Engine Cron service. In some ways it makes sense — the ingress controls only allow requests from the load balancer, or from within the VPC. The Cron service does not satisfy those requirements and hence is blocked.
the simple answer is no. from the docs it is clearly stated that cron jobs use HTTP GET. the best thing is to change your method to GET and restrict direct access to the url in your app.yaml. like this:
handlers:
- url: /report/weekly
script: reports.app
login: admin
It's not possible. The requests will have a header 'X-AppEngine-Cron' that you can check for, that might help if you want to prevent accidental running from a browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With