Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33353

Re: Running a curl command within py script

From Gisle Vanem <gvanem@broadpark.no>
References <CAHRZm1unooSWnNaxP_bugRNE1NjrAvKZncOYN5fbe6NbwUvdbg@mail.gmail.com>
Subject Re: Running a curl command within py script
Date 2012-11-14 20:02 +0100
Newsgroups comp.lang.python
Message-ID <mailman.3697.1352923347.27098.python-list@python.org> (permalink)

Show all headers | View raw


"Smaran Harihar" <smaran.harihar@gmail.com> wrote:

> i found pycurl to execute python curl command but not sure how I can
> execute the curl command using the pycurl.
> 
> curl -u admin:geoserver -v -XPUT -H 'Content-type: text/plain' -d
> 'file:/var/www/geo/shapefile/csvQshp/Quercus_iltisii.shp'
> http://localhost:8080/geoserver/rest/workspaces/acme/datastores/Quercus_iltisii/external.shp
> ?

Off-topic, but here's an idea. Use the 'curl --libcurl foo' option to see
what setopt() calls to use in PyCurl. Like:

import sys, pycurl

c = pycurl.Curl()
c.setopt (c.URL, 'http://localhost:8080/geoserver/rest/workspaces/acme/datastores/Quercus_iltisii/external.shp')
c.setopt (c.USERPWD, 'admin:geoserver')
c.setopt (c.POSTFIELDS, 'file:/var/www/geo/shapefile/csvQshp/Quercus_iltisii.shp');

etc.

--gv

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Running a curl command within py script Gisle Vanem <gvanem@broadpark.no> - 2012-11-14 20:02 +0100

csiph-web