Looks like maybe an error somewhere in your model files. Is that the 
traceback from the associated record in the scheduler_run table?

Anthony

On Monday, January 30, 2017 at 8:02:29 AM UTC-5, Gael Princivalle wrote:
>
> Hello.
>
> I've got a scheduler function that run each 30 seconds for sending web 
> push notifications:
>
> def process_webn_alerts():
>     webn_alerts = db(db.alerts.instant_webn_status == 1).select()
>     for webn_alert in webn_alerts:
>         onesignal_players = db(db.onesignal_players.created_by == 
> webn_alert.to_user).select()
>         for onesignal_player in onesignal_players:
>             header = {"Content-Type": "application/json; charset=utf-8",
>                 "Authorization": "Basic my_auth_key"}
>             payload = {"app_id": "my_app_id",
>                 "headings": {"en": webn_alert.title},
>                 "include_player_ids": [onesignal_player.uuid],
>                 "contents": {"en": webn_alert.body},
>                 "url": webn_alert.link,
>                 "chrome_web_icon": webn_alert.icon_url
>                 }
>             req = requests.post("
> https://onesignal.com/api/v1/notifications";, headers=header, data=json.
> dumps(payload))
>             print(req.status_code, req.reason)
>             db(db.alerts.id == webn_alert.id).update(instant_webn_status = 
> 2)
>     db.commit()
>
> It has run correctly for 10 hours, without any web push notification to 
> send. After that it failed with this ticket:
>
> Traceback (most recent call last):
>   File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/scheduler.py", line 
> 293, in executor
>     _env = env(a=a, c=c, import_models=True)
>   File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/shell.py", line 166, 
> in env
>     sys.exit(1)
> SystemExit: 1
>
> Does it mean that the http Onesignal call has failed?
>
> Thanks.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to