Grokbase Groups Python tutor May 2011
FAQ
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



data="""

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

<!DOCTYPE ProvisioningRequest SYSTEM "ProvisioningRequest.dtd">

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

<Header>

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

<Login>gtt_admin</Login>

<Password>Password2011</Password>

</Sender>

<TimeStamp>2001-11-15T13:18:08-08:00</TimeStamp>

</Header>

<Body>

<ProvisioningEntity name="subscriber">

<ProvisioningDataItem
name="BillingId">738002000417469</ProvisioningDataItem>

<ProvisioningEntity name="service">

<ProvisioningDataItem name="ServiceName">Enterprise
B</ProvisioningDataItem>

</ProvisioningEntity>

</ProvisioningEntity>

</Body>

</ProvisioningRequest>

"""



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

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

c = pycurl.Curl()

c.setopt(c.URL, "https://provisioning.etr.blackberry.net/ari/submitXML")

c.setopt(pycurl.POST,1)

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)

c.perform()

c.close()



this is the error I am getting.

* About to connect() to provisioning.etr.blackberry.net port 443 (#0)

* Trying 216.9.243.178... * connected

* Connected to provisioning.etr.blackberry.net (216.9.243.178) 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; CN=provisioning.etr.blackberry.net

* 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:
provisioning.etr.blackberry.net 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

ERROR_ID=PARSEING_ERROR

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





Regards Rayon



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110513/3faa5ace/attachment.html>

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 swiftone.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouptutor @
categoriespython
postedMay 13, '11 at 6:36p
activeMay 14, '11 at 9:58p
posts2
users2
websitepython.org

2 users in discussion

Brett Ritter: 1 post Rayon: 1 post

People

Translate

site design / logo © 2022 Grokbase