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


Groups > comp.lang.python > #33353 > unrolled thread

Re: Running a curl command within py script

Started byGisle Vanem <gvanem@broadpark.no>
First post2012-11-14 20:02 +0100
Last post2012-11-14 20:02 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#33353 — Re: Running a curl command within py script

FromGisle Vanem <gvanem@broadpark.no>
Date2012-11-14 20:02 +0100
SubjectRe: Running a curl command within py script
Message-ID<mailman.3697.1352923347.27098.python-list@python.org>
"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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web