On Oct 19, 9:15 pm, khany <sharif.k...@gmail.com> wrote: > On 19 Oct, 13:44, khany <sharif.k...@gmail.com> wrote: > > > hello all, > > > i am relatively new to python and i am trying to convert a php app i > > have over to it using googleapps. > > > anyway here is the problem. i poll ebay API which has in its XML "<? > > xml version="1.0" encoding="utf-8"?><findItemsAdvancedRequest > > xmlns="http://www.ebay.com/marketplace/search/v1/services"> .... " > > > however it fails to create the string UNLESS i remove the colon (:) in > > the http section. i tried to substitute it with chr(58) but it errors > > the same without showing why. does anyone know what i am doing wrong? > > is this peculiar to googleapps? > > > thanks > > OK > > first thanks for replying so soon (most other groups out there take > days) > > here is the code > > ======== > xml = '<?xml version="1.0" encoding="utf-8"?> \ > <findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/ > search/v1/services"> \ > <categoryId>%(category)i</categoryId> \ > <keywords>%(searchtext)s</keywords> \ > <paginationInput> \ > <pageNumber>%(page)i</pageNumber> \ > <entriesPerPage>10</entriesPerPage> \ > </paginationInput> \ > </findItemsAdvancedRequest>' % \ > {'category':9834, 'searchtext':"bmw", 'page':1} > print xml > ======== > > if i run this, the page is blank (even the source) with no errors or > anything. if i remove the colon from the string (after the http) it > prints the string on the browser fine. > > HTH
you can use a tri-quote string or make sure all lines end with \: xml1 = """<?xml version="1.0" encoding="utf-8"?> <findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/\ search/v1/services"> <categoryId>%(category)i</categoryId> <keywords>%(searchtext)s</keywords> <paginationInput> <pageNumber>%(page)i</pageNumber> <entriesPerPage>10</entriesPerPage> </paginationInput> </findItemsAdvancedRequest>""" % \ {'category':9834, 'searchtext':"bmw", 'page':1} xml2 = '<?xml version="1.0" encoding="utf-8"?>\n\ <findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/\ search/v1/services">\n\ <categoryId>%(category)i</categoryId>\n\ <keywords>%(searchtext)s</keywords>\n\ <paginationInput>\n\ <pageNumber>%(page)i</pageNumber>\n\ <entriesPerPage>10</entriesPerPage>\n\ </paginationInput>\n\ </findItemsAdvancedRequest>' % \ {'category':9834, 'searchtext':"bmw", 'page':1} print xml1 print xml2 -- http://mail.python.org/mailman/listinfo/python-list