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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gvanem@broadpark.no>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; "'')": 0.07; 'sys,': 0.07; 'python': 0.09; 'subject:command': 0.09; 'subject:script': 0.09; 'url:localhost': 0.09; 'to:name:python-list': 0.15; 'wrote:': 0.17; 'import': 0.21; 'x-mailer:microsoft outlook express 6.00.2900.5931': 0.22; 'command': 0.24; "skip:' 50": 0.29; "skip:' 10": 0.30; 'url:non-standard http port': 0.30; 'like:': 0.33; 'to:addr:python-list': 0.33; 'but': 0.36; 'charset:us-ascii': 0.36; 'execute': 0.37; 'option': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'curl': 0.84
MIME-version 1.0
Content-transfer-encoding 7BIT
Content-type text/plain; CHARSET=US-ASCII; format=flowed; reply-type=original
From Gisle Vanem <gvanem@broadpark.no>
To python-list <python-list@python.org>
References <CAHRZm1unooSWnNaxP_bugRNE1NjrAvKZncOYN5fbe6NbwUvdbg@mail.gmail.com>
Subject Re: Running a curl command within py script
Date Wed, 14 Nov 2012 20:02:19 +0100
X-Priority 3
X-MSMail-priority Normal
X-Mailer Microsoft Outlook Express 6.00.2900.5931
X-MIMEOLE Produced By Microsoft MimeOLE V6.00.2900.6157
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3697.1352923347.27098.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352923347 news.xs4all.nl 6883 [2001:888:2000:d::a6]:36902
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33353

Show key headers only | 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