[OWSLib-users] WCS Cookie Generation [SEC=UNCLASSIFIED]

Dominic Lowe D.Lowe at bom.gov.au
Sun May 19 15:35:01 PDT 2013


You need to pass the cookie as a string. You can get the cookie text from the 'set-cookie' header in the http response ('handle' in your code).

So I *think* something like this should work:

# HTTP request
req = urllib2.Request(login_url, postfields, txheaders)
handle = urllib2.urlopen(req)
cookiestr = handle.headers['set-cookie']

# WCS handler
wcs = WebCoverageService(url=wcs_url, version='1.0.0', cookies=cookiestr)


Cheers,
Dom

________________________________
From: owslib-users-bounces at lists.osgeo.org [mailto:owslib-users-bounces at lists.osgeo.org] On Behalf Of Iñigo Hernáez Corres
Sent: Friday, 17 May 2013 5:47 PM
To: owslib-users at lists.osgeo.org
Subject: Re: [OWSLib-users] WCS Cookie Generation [SEC=UNCLASSIFIED]

Yes, I think this is the way to do this. However, I still have some doubts...

I handle the login cookie with urllib2 and cookielib, but then I am not sure about how is this passed to the WCS handler:

# Cookie handler
cj = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPSHandler, urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)

# HTTP request
req = urllib2.Request(login_url, postfields, txheaders)
handle = urllib2.urlopen(req)

# WCS handler
wcs = WebCoverageService(url=wcs_url, version='1.0.0', cookies=cj)



Not sure if the "cj" should be included directly, as "cj.as_lwp.str()" or any other way...


Iñigo Hernáez Corres

email: ihernaez at adasasistemas.com<mailto:ihernaez at adasasistemas.com>
tlf: (+34) 945 064483
C/Portal de Foronda, 41
01010, Vitoria-Gasteiz

Maintenance & Logistics Services (M&LS)
José Agustín Goytisolo, 30-32
08908 L'Hospitalet de Llobregat - Barcelona
T. (+34) 93 264 06 02
F. (+34) 93 264 06 56
www.comsaemte.com<https://correo.adasasistemas.com/owa/UrlBlockedError.aspx>

No imprimir si no es necesario. Protejamos el Medio Ambiente.
Please consider the environment before printing this email.

Este mensaje, y en su caso cualquier fichero anexo al mismo, es sólo para el destinatario a quien va dirigido y puede contener información privilegiada, profesional o privada. Si lo ha recibido por error, por favor notifíquelo inmediatamente el remitente y elimine el original. Cualquier otro uso que haga de este mensaje está prohibido.

This message and its attachments, if any, is solely for the attention of the addressee and may contain privileged confidential information of a professional or other nature. If you have received this message by mistake, please notify the senderimmediately and delete the original. It is prohibited to use this message for any other purpose.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/owslib-users/attachments/20130520/87d3896d/attachment.html>


More information about the OWSLib-users mailing list