Hi David,
see my answers below:

2013/10/23 Laratta, David (IS) <[email protected]>

>  Originally I wrote the code in Perl, but I had to change it to Python. **
> **
>
> ** **
>
> def http_post(url, username, password, content):****
>
>                 user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64;
> rv:25.0) Gecko/20100101 Firefox/25.0'****
>
>                 base64string = base64.standard_b64encode('%s:%s' %
> (username, password))****
>
>                 headers = { 'User-Agent' : user_agent , 'Content-Type' :
> 'text/xml', 'Authorization' : 'Basic %s' % base64string }****
>
>                 request = urllib2.Request(url, content, headers)****
>
>                 try:****
>
>                                 result = urllib2.urlopen(request)****
>
>                                 print result.read()****
>
>                 except urllib2.URLError as e:****
>
>                                 if hasattr(e, 'reason'):****
>
>                                                 print 'We failed to reach
> a server.'****
>
>                                                 print 'Reason: ', e.reason
> ****
>
>                                 elif hasattr(e, 'code'):****
>
>                                                 print 'The server
> couldn\'t fulfill the request.'****
>
>                                                 print 'Error code: ',
> e.code****
>
> ** **
>
> username = sys.argv[1];****
>
> password = sys.argv[2];****
>
> data = sys.argv[3];
>

What are you using as the 3rd argument to the script, or better, what is
the content of the data variable after this line of code?


> ****
>
> fqhn = sys.argv[4];****
>
> ** **
>
> url = 'https://' + fqhn + ':7502/GeoServer/rest/workspaces/'****
>
> content = '<workspace><name>CADRG</name>'****
>
> http_post(url, username, password, content)****
>
> ** **
>
> url = 'https://' + fqhn +
> ':7502/GeoServer/rest/workspaces/CADRG/coveragestores?configure=all'****
>
> content =
> '<coverageStore><workspace>CADRG</workspace><name>JNC</name><enabled>true</enabled><type>ImagePyramid</type><url>'
> + data + '/CADRG/JNC</url></coverageStore>'****
>
> http_post(url, username, password, content)
>

So, what is the value of the content variable at this point?
What I'm thinking of is that in the url section maybe you are missing the
url protocol (file:). Is this the case?

Regards,
Mauro

-- 
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==

Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to