My python script is getting a stock price from google finance and then 
posting (using RESTful api) to my web2py application every 15 minutes. 
 When I look at the log files everything works for awhile, but after a 
couple hours every POST will timeout.  If I load the application's 
default/index page from a web browser then the RESTful POST works for 
another hour or two and then it times out again.  I've run the web2py 
server on pythonanywhere and on a local computer with the same results.

r = requests.post(url, headers=headers, data=json.dumps(payload), 
timeout=360)
    
def POST(table_name,**vars):
        if table_name == 'VEXMX':
            row = db(db.VEXMX.date==vars['date']).select().first()
            if row:
                result = {'exists':1, 'id':row.id, 'errors': {}}
                result = dict(result=result)
            else:
                result = dict(db.VEXMX.validate_and_insert(**vars))
                result['exists'] = 0
                result = dict(result=result)
            return result

On Friday, November 21, 2014 3:55:31 PM UTC-7, Massimo Di Pierro wrote:
>
> We need more details. How often do you post? How long does it take to get 
> a response?
>
> On Friday, 21 November 2014 09:36:36 UTC-6, Bart wrote:
>>
>> I have a python script that posts data to my web2py/application/projects 
>> database using RESTful services.  Everything works fine for an hour or two, 
>> but then all future posts will timeout.  If, using a web browser, I reload 
>> the web2py application's main page then the RESTful services start working 
>> again for another hour or two.  Any ideas why I cant run a script 24/7 to 
>> GET/POST data to my web2py application's RESTful services? 
>>
>

-- 
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