this is a pycurl error. Why not user urllib and simplejson?
def import_data():
import urllib
from simplejson import loads
url_eq = 'http://%s/welcome/default/call/json/get_data/' % '
192.168.0.10:8000'
data_new = loads(urllib.urlopen(url_eq).read())
On Thursday, 15 January 2015 11:44:38 UTC-6, www.diazluis.com wrote:
>
> greetings.
> excuse me I'm using google translator (my language is Spanish)
> location:
> a control system for assistance.
> * A central computer where managers come and go down the reports.
> * Some stations where the person registers its input and output (such
> equipment may or may not be connected to the network)
>
> for computers that are not connected, a download of care in a text
> file that is then loaded into the central computer. (this works)
>
> for computers that are connected, the idea is that the core team, make
> the request for the past attendance records.
>
> path query:
> http://192.168.0.10:8000/welcome/default/call/json/get_data/
>
> if I test from the browser to that route, the system throws the form
> corect information in json.
>
> but if from the central computer, from a web2py controller, run the
> following instruction (I can not find another way .. I see
> documentation for applications to communicate, I see only external
> examples)
>
>
> def import_data():
> import pycurl, urllib
> from StringIO import StringIO
> from gluon.serializers import json, loads_json
>
> buffer = StringIO()
> c = pycurl.Curl()
>
> url_eq = 'http://%s/welcome/default/call/json/get_data/' %
> '192.168.0.10:8000'
>
> c.setopt(c.URL, url_eq)
> c.setopt(c.WRITEDATA, buffer)
> c.perform()
> c.close()
> data_new = loads_json(buffer.getvalue())
>
>
>
> ERROR
> <type 'exceptions.TypeError'> invalid arguments to setopt
>
>
> anyone can help me?
> I need the data request web2py make it.
> and hoping to eventually be automated using cron
>
> --
> http://diazluis.com
> Analista Programador
> User Linux 532223
>
--
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/d/optout.