problem with google api / xml

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • robin

    #1

    problem with google api / xml

    hello,

    i installed SOAPpy 0.12.0 and pyXML 0.8.4 in order to try out the
    google-search example in diveintopython
    Learn how to interact with web pages and APIs using the Requests module in Python. Send HTTP requests, handle responses, and customize requests with headers, cookies, and proxies.

    however, i'v been trying and trying and won't get it to work :-(
    whenever i run this code, i get the attached exception...

    from SOAPpy import WSDL
    WSDLFILE = '/pathtomy/googleapi/GoogleSearch.ws dl'
    APIKEY = '....'
    _server = WSDL.Proxy(WSDL FILE)

    any help would be very much appreciated!
    thanks in advance,
    robin

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File
    "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/site-packages/SOAPpy/WSDL.py",
    line 67, in __init__
    self.wsdl = reader.loadFrom String(str(wsdl source))
    File
    "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/site-packages/SOAPpy/wstools/WSDLTools.py",
    line 47, in loadFromString
    return self.loadFromSt ream(StringIO(d ata))
    File
    "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/site-packages/SOAPpy/wstools/WSDLTools.py",
    line 28, in loadFromStream
    document = DOM.loadDocumen t(stream)
    File
    "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/site-packages/SOAPpy/wstools/Utility.py",
    line 602, in loadDocument
    return xml.dom.minidom .parse(data)
    File
    "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/site-packages/_xmlplus/dom/minidom.py",
    line 1915, in parse
    return expatbuilder.pa rse(file)
    File
    "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/site-packages/_xmlplus/dom/expatbuilder.py ",
    line 930, in parse
    result = builder.parseFi le(file)
    File
    "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/site-packages/_xmlplus/dom/expatbuilder.py ",
    line 207, in parseFile
    parser.Parse(bu ffer, 0)
    xml.parsers.exp at.ExpatError: not well-formed (invalid token): line 1,
    column 0

  • Mike Kent

    #2
    Re: problem with google api / xml


    robin wrote:
    [color=blue]
    > from SOAPpy import WSDL
    > WSDLFILE = '/pathtomy/googleapi/GoogleSearch.ws dl'
    > APIKEY = '....'
    > _server = WSDL.Proxy(WSDL FILE)[/color]

    Robin, note this part of the URI set in WSDLFILE:
    '/pathtomy/googleapi'. Get it? 'path to my google api'. You must set
    this part to the actual path where the file 'GoogleSearch.w sdl' is
    found. In addition, doesn't APIKEY = '....' look a bit odd to you?
    Hmm, what could this mean. APIKEY. Perhaps you need to get an API key
    from Google in order to use their search API, and fill it in there?

    ;-)

    Comment

    • robin

      #3
      Re: problem with google api / xml

      hi kent,

      thanks for your reply. in fact it was me who put "pathtomy" into the
      path and exchanged my apikey with "...."
      i prefer not everyone to know the name of my directories and even less
      my apikey. so the problem isn't there :-(
      hope to find some other solution....
      thanks!!

      robin


      Mike Kent wrote:[color=blue]
      > robin wrote:
      >[color=green]
      > > from SOAPpy import WSDL
      > > WSDLFILE = '/pathtomy/googleapi/GoogleSearch.ws dl'
      > > APIKEY = '....'
      > > _server = WSDL.Proxy(WSDL FILE)[/color]
      >
      > Robin, note this part of the URI set in WSDLFILE:
      > '/pathtomy/googleapi'. Get it? 'path to my google api'. You must set
      > this part to the actual path where the file 'GoogleSearch.w sdl' is
      > found. In addition, doesn't APIKEY = '....' look a bit odd to you?
      > Hmm, what could this mean. APIKEY. Perhaps you need to get an API key
      > from Google in order to use their search API, and fill it in there?
      >
      > ;-)[/color]

      Comment

      • John Bokma

        #4
        Re: problem with google api / xml

        "robin" <robin.meier@gm ail.com> wrote:
        [color=blue]
        > hello,
        >
        > i installed SOAPpy 0.12.0 and pyXML 0.8.4 in order to try out the
        > google-search example in diveintopython
        > http://diveintopython.org/soap_web_services/index.html
        > however, i'v been trying and trying and won't get it to work :-(
        > whenever i run this code, i get the attached exception...
        >
        > from SOAPpy import WSDL
        > WSDLFILE = '/pathtomy/googleapi/GoogleSearch.ws dl'[/color]

        [...]
        [color=blue]
        > ackages/_xmlplus/dom/expatbuilder.py ", line 207, in parseFile
        > parser.Parse(bu ffer, 0)
        > xml.parsers.exp at.ExpatError: not well-formed (invalid token): line 1,
        > column 0[/color]

        Did you check your GoogleSearch.ws dl file? From the error I guess that
        something is wrong with the file itself. I Recommend to check it, or
        download it again:



        No experience with SOAPpy, but with SOAP::Lite (Perl), I can give the uri
        to that file (OTOH, hosting it localy might be faster).

        --
        John MexIT: http://johnbokma.com/mexit/
        personal page: http://johnbokma.com/
        Experienced programmer available: http://castleamber.com/
        Happy Customers: http://castleamber.com/testimonials.html

        Comment

        Working...