pycurl problem

P

pabloski

Hi to all, I have a problem with a snippet of code that creates a Curl
object

the code is

c = pycurl.Curl()

c.key = keyCurrent
c.proxy = proxyCurrent
c.url = "http://www.google." + lg + "/search?hl=" + lg + "&q=" + c.key +
"&meta=lr%3Dlang_" + lg + "&num=30"

c.setopt(pycurl.URL, c.url)
c.setopt(pycurl.PROXY, c.proxy)

the last two lines raise a TypeError

obviously proxyCurrent, lg and keyCurrent are parameters

I noted that if I define c.proxy and c.url as costants e.g. c.url =
"http://www.google.com/search?blah blah...." and c.proxy =
"127.0.0.1:8080" it works

However if I define them as described before pycurl raises the TypeError
 
G

Gabriel Genellina

I noted that if I define c.proxy and c.url as costants e.g. c.url =
"http://www.google.com/search?blah blah...." and c.proxy =
"127.0.0.1:8080" it works

However if I define them as described before pycurl raises the TypeError

Python -with its long "batteries included" tradition- comes with two
powerful tools for diagnosing problems: print and repr

print "c.url", type(c.url), repr(c.url)
print "c.proxy", type(c.proxy), repr(c.proxy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top