Grokbase Groups Python tutor May 2011
Hi all,

I need a python script to upload a xml file to a web page using python.

I have tried using pycurl but I am still getting errors.

import urllib2

import pycurl


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ProvisioningRequest SYSTEM "ProvisioningRequest.dtd">

<ProvisioningRequest TransactionId="0000000332" Version="1.2"
TransactionType="Activate" ProductType="BlackBerry">


<Sender id="0000349114" name="GTT">







<ProvisioningEntity name="subscriber">


<ProvisioningEntity name="service">

<ProvisioningDataItem name="ServiceName">Enterprise






headers = ["Content-Type:text/xml"]

#data = open("d:\\dump\\activation.xml")

c = pycurl.Curl()

c.setopt(c.URL, "")


c.setopt(pycurl.SSL_VERIFYPEER, 0)

c.setopt(pycurl.SSL_VERIFYHOST, 0)

c.setopt(pycurl.HTTPHEADER, headers)

c.setopt(pycurl.POSTFIELDS, data)

c.setopt(c.VERBOSE, 1)



this is the error I am getting.

* About to connect() to port 443 (#0)

* Trying * connected

* Connected to ( port 443 (#0)

* libcurl is now using a weak random seed!

* SSL connection using RC4-MD5

* Server certificate:

* subject: CÊ; ST=Ontario; L=Waterloo; O=Research In Motion
Limited; OU=IT;

* start date: 2011-03-28 00:00:00 GMT

* expire date: 2012-03-27 23:59:59 GMT

* issuer: C=US; O=Thawte, Inc.; CN=Thawte SSL CA

* SSL certificate verify result: self signed certificate in
certificate chain (19), continuing anyway.
POST /ari/submitXML HTTP/1.1 User-Agent: PycURL/7.19.7 Host: Accept: */* Content-Type:text/xml
Content-Length: 836 < HTTP/1.1 500 Internal Server Error < Connection:
close < Date: Fri, 13 May 2011 18:35:24 GMT < Content-Length: 90 <
Content-Type: text/html < X-Powered-By: Servlet/2.5 JSP/2.1 < * Closing
connection #0


DESCRIPTION=Request parsing failed: Tag in line:2 Ending column:6

Regards Rayon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

Search Discussions

  • Brett Ritter at May 14, 2011 at 9:58 pm

    On Friday, May 13, 2011, Rayon wrote:
    Hi all, I need a python script to upload a xml file to a web page using python. I have tried using pycurl but I am still getting
    Fyi, the XML spec allows for no characters or whitespace before the
    XML declaration, that could be your error,

    Brett Ritter / SwiftOne
    swiftone at

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouptutor @
postedMay 13, '11 at 6:36p
activeMay 14, '11 at 9:58p

2 users in discussion

Brett Ritter: 1 post Rayon: 1 post



site design / logo © 2022 Grokbase