Re: Running a curl command within py script

Discussion in 'Python' started by Gisle Vanem, Nov 14, 2012.

  1. Gisle Vanem

    Gisle Vanem Guest

    "Smaran Harihar" <> 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
     
    Gisle Vanem, Nov 14, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris

    cURL in ASP.NET

    Chris, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    8,182
    Joerg Jooss
    Dec 19, 2004
  2. Shane Nayler

    IRB error using curl command.

    Shane Nayler, Sep 17, 2008, in forum: Ruby
    Replies:
    0
    Views:
    128
    Shane Nayler
    Sep 17, 2008
  3. ß Ø ® G

    Page Curl script wanted please

    ß Ø ® G, Jan 26, 2004, in forum: Javascript
    Replies:
    7
    Views:
    250
    Jim Ley
    Jan 26, 2004
  4. Fiaz Idris
    Replies:
    13
    Views:
    1,823
    ifiaz
    Mar 17, 2005
  5. Replies:
    4
    Views:
    297
    ccc31807
    Jul 29, 2011
Loading...

Share This Page