Hello,
I am trying to create a function that will send a GET request and then will
go through the response looking for specific data.
When I type in the URL on a Firefox browser, this is the response that I
get (using Firebug):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--#FormVars--><script type='text/javascript' language='JavaScript'><!--
ps=0;
ls=0;
pf=450;
pd=50;
//--></script>
<html><head> <meta content="text/html;charset=ISO-8869-1"
http-equiv="content-type"></head></html>
The function that I am trying to write will call the URL directly and go
through the response looking for the values of "ps", "ls", "pf", "pd" and save
them to the database
So far I have:
def send_request():
import httplib
conn = httplib.HTTPConnection("169.254.22.2")
conn.request("GET", "/iocontrol.cgi?PWMFrequency=460&PWMDutyCycle=60")
answer = conn.getresponse()
return dict()
I created a button on my index page to be able to call this function and see
what response I get through Firebug to try to figure out my next step but I
don't get the response I showed above, I get a web2py response.
I'm not sure how to go about creating this function and saving the response
values to the database. Could anyone guide me in the right direction?
My end-goal is to have this function as a scheduled task in Google App Engine.
This function will be called every few minutes and the updated values will be
retrieved from the database and displayed on my web-app when the user logs in
or reloads the page.
Thank you in advance
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.