curl-library
Re: Simple encoding problem (perhaps :-) )
Date: Thu, 4 Nov 2004 11:43:21 -0000
> Thank you for your kindness. Anyway I am rather sure it is an encoding
> problem. If I mangle the IST field from the CUrl command line, I get
> the same wrong result I have from libCUrl
Im a bit confused. This is (almost) the same email than yesterday.
Except the code is a bit different but the text of the email is the same ?!
> Thank you for your kindness. Anyway I am rather sure it is an encoding
> problem. If I mangle the IST field from the CUrl command line, I get
> the same wrong result I have from libCUrl
Meanwhile we exchanged two emails in private where I said it could be an
authentification problem (some curlsetopt not properly set) and you seemed
to agree ? Did you look at
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTSSLVERIFYHOST ?
> self.curl.setopt(pycurl.USERPWD, username:password)
This doesnt work in python I suppose you meant 'username:password'
As I still dont have the password I cant help you further than that :
Try to put VERBOSE to 1 and --verbose for the command line version and
compare the two.
I have _exactly_ the same output in both cases (even the POST data return by
the debug !) except of course the date :) But without the password of course
I cant see a difference in the page returned of course...
____________________
<Gu>[W]ill[i]a<u>m<e>
http://www.lacde.net
----- Original Message -----
From: "Nico Alberti" <nico.alberti_at_gmail.com>
Cc: "libcurl development" <curl-library_at_cool.haxx.se>
Sent: Thursday, November 04, 2004 11:17 AM
Subject: Re: Simple encoding problem (perhaps :-) )
> On Wed, 3 Nov 2004 16:28:18 -0000, Guillaume Arluison <ga_at_lacde.net>
wrote:
> > I'm a python user too.
> >
> > Try to make your python code as simple as possible with the same problem
and
> > send it, Ill run it myself/see the code more clearly.
> >
> The site is password protected, and I have no control over the
> password I am using (it is managed by another department), so
> infortunately I am not authorized to give it to you. :-(
>
> Anyway
>
> Command line:
>
> curl --data
"H1APPA1=1000062&H1APPA2=RE0U&H1APPA3=C&H1APPA4=VC&H1APPA5=IST%23&H1APPA6=00
000&H1APPA7=CONSORZIO+DI+BONIFICA+PARMIGIANA+MOGLIA+SECCHIA&H_TIPO_VIS=V&NAS
COSTO=1&H_DBHOST=A&H_CATASTO=FABBRICATI,F&H_COMUNEALL=A162,RE,ALBINEA&H_SOUR
CE=RICERCA&H_SRCVIS=DIRETTA&TFGL=0018&TNUM=07786&TNUM1=&TSUB=&TIPODEN=0&TPRO
T=&TANNO=&TB2=Ricerca&ANNULLA2=Cancella"
> -k --user username:password
> https://web.site/servlet/NWEF00SJ
>
> python:
>
>
pf='''H1APPA1=1000062&H1APPA2=RE0U&H1APPA3=C&H1APPA4=VC&H1APPA5=IST%23&H1APP
A6=00000&H1APPA7=CONSORZIO+DI+BONIFICA+PARMIGIANA+MOGLIA+SECCHIA&H_TIPO_VIS=
V&NASCOSTO=1&H_DBHOST=A&H_CATASTO=FABBRICATI,F&H_COMUNEALL=A162,RE,ALBINEA&H
_SOURCE=RICERCA&H_SRCVIS=DIRETTA&TFGL=0018&TNUM=07786&TNUM1=&TSUB=&TIPODEN=0
&TPROT=&TANNO=&TB2=Ricerca&ANNULLA2=Cancella'''
> d= Curl()
> d.post('https://web.site/servlet/NWEF00SJ', pf)
> HTML=d.contents
>
> while the Curl object is defined this way:
>
> class Test:
> def __init__(self):
> self.contents = ''
>
> def body_callback(self, buf):
> self.contents = self.contents + buf
>
> class Curl:
> t = Test()
> def __init__(self):
> self.curl = pycurl.Curl()
> self.curl.setopt(pycurl.WRITEFUNCTION, self.t.body_callback)
> self.curl.setopt(pycurl.SSL_VERIFYPEER, 0)
> self.curl.setopt(pycurl.NOSIGNAL, 1)
> self.curl.setopt(pycurl.CONNECTTIMEOUT, 30)
> self.curl.setopt(pycurl.TIMEOUT, 300)
> self.curl.setopt(pycurl.USERPWD, username:password)
>
> def post(self, url, postdata):
> self.curl.setopt(pycurl.URL, url)
> self.curl.setopt(pycurl.VERBOSE, 0)
> self.curl.setopt(pycurl.POSTFIELDS, postdata)
> self.curl.perform()
> self.contents=self.t.contents
>
>
> >
> > ''' means 3 times the single [']
>
> I already tried it. No luck.
>
> Thank you for your kindness. Anyway I am rather sure it is an encoding
> problem. If I mangle the IST field from the CUrl command line, I get
> the same wrong result I have from libCUrl
> --
> Ciao
> Nico
>
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.764 / Virus Database: 511 - Release Date: 18/09/2004Received on 2004-11-04