Re: strange behaviour of colon within string

2009-10-19 Thread Diez B. Roggisch
khany 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?

Please show us code  actual stacktraces. Python can generate XML just fine,
so it's pretty likely that you are doing something wrong.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: strange behaviour of colon within string

2009-10-19 Thread Wolodja Wentland
On Mon, Oct 19, 2009 at 05:44 -0700, khany wrote:
 i am relatively new to python and i am trying to convert a php app i
 have over to it using googleapps.

Welcome!

 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?

Could you please elaborate on fails to create the string, preferably
in the form of a traceback. It might also help us if we knew what
behaviour you expected or what do you mean by i remove the colon .

Wolodja


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: strange behaviour of colon within string

2009-10-19 Thread khany
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 \
  entriesPerPage10/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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: strange behaviour of colon within string

2009-10-19 Thread StarWing
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 \
       entriesPerPage10/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
  entriesPerPage10/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\
  entriesPerPage10/entriesPerPage\n\
/paginationInput\n\
/findItemsAdvancedRequest' % \
{'category':9834, 'searchtext':bmw, 'page':1}

print xml1
print xml2

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: strange behaviour of colon within string

2009-10-19 Thread khany
On 19 Oct, 14:44, StarWing weasley...@sina.com wrote:
 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 \
        entriesPerPage10/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
       entriesPerPage10/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\
       entriesPerPage10/entriesPerPage\n\
     /paginationInput\n\
     /findItemsAdvancedRequest' % \
     {'category':9834, 'searchtext':bmw, 'page':1}

 print xml1
 print xml2

StarWing,

The triple String works a treat thanks. Not sure what the colon issue
was though. Now im getting Unsupported verb errors but thats an ebay
API issue i can work with.

Thanks to all for your help

khany
-- 
http://mail.python.org/mailman/listinfo/python-list