Google-API Bad-Gateway-Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DierkErdmann@mail.com

    #1

    Google-API Bad-Gateway-Error

    Hi,

    I am trying to query google from within a python script using the
    Google-Api (pygoogle).
    The following piece of codes gives me a "SOAPpy.Errors. HTTPError:
    <HTTPError 502 Bad Gateway>", the full Traceback is shown below. I am
    aware of the incompatibiliti es between the Google-Api and older
    versions of the SOAP-Library; I do have installed a recent version of
    SOAP (v. 0.11.3) which is said to be supported by Google-API.

    Can someone help?
    TIA
    Dierk

    Source-Code:
    ######
    import google
    google.setLicen se('xxxxxxxxxxx xxxxxx') ##removed ;-)
    data = google.doGoogle Search('python' )
    data.meta.searc hTime
    data.results[0].URL
    data.results[0].title
    ########

    Full Traceback:
    #############
    Traceback (most recent call last):
    File "test.py", line 3, in ?
    data = google.doGoogle Search('python' )
    File "/windows/g/Download/webcrawler/pygoogle-0.6/google.py", line
    421, in doGoogleSearch
    outputencoding )
    File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 421,
    in __call__
    return self.__r_call(* args, **kw)
    File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 443,
    in __r_call
    self.__hd, self.__ma)
    File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 345,
    in __call
    config = self.config)
    File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 249,
    in call
    raise HTTPError(code, msg)
    SOAPpy.Errors.H TTPError: <HTTPError 502 Bad Gateway>
    #############

  • John Bokma

    #2
    Re: Google-API Bad-Gateway-Error

    DierkErdmann@ma il.com wrote:
    [color=blue]
    > Hi,
    >
    > I am trying to query google from within a python script using the
    > Google-Api (pygoogle).
    > The following piece of codes gives me a "SOAPpy.Errors. HTTPError:
    > <HTTPError 502 Bad Gateway>",[/color]

    Not with Python, but with Perl, I am seeing now and then the same error.
    If you rerun the script, does the message go away?

    A week or 2-3 ago I had even the feeling that the Google API was gone for
    about a day.

    --
    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

    • DierkErdmann@mail.com

      #3
      Re: Google-API Bad-Gateway-Error

      It's quite strange, after calling the script several times it started
      to work; but sometimes the error occurs again. Maybe google has
      technical probs.

      Dierk

      Comment

      • John Bokma

        #4
        Re: Google-API Bad-Gateway-Error

        DierkErdmann@ma il.com wrote:
        [color=blue]
        > It's quite strange, after calling the script several times it started
        > to work; but sometimes the error occurs again. Maybe google has
        > technical probs.[/color]

        Yup, I've seen exactly the same behavoir. So now I do several retry -
        sleep - retry steps before giving up.

        --
        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

        • Jack Diederich

          #5
          Re: Google-API Bad-Gateway-Error

          On Tue, May 16, 2006 at 01:24:25PM +0000, John Bokma wrote:[color=blue]
          > DierkErdmann@ma il.com wrote:
          >[color=green]
          > > It's quite strange, after calling the script several times it started
          > > to work; but sometimes the error occurs again. Maybe google has
          > > technical probs.[/color]
          >
          > Yup, I've seen exactly the same behavoir. So now I do several retry -
          > sleep - retry steps before giving up.[/color]

          Yup, me too.

          retries = 0
          while (retries < 5):
          try:
          gpage = google.doGoogle Search(keyword, start=start)
          break
          except:
          retries += 1
          time.sleep(30)
          else:
          raise # chronic failure, reraise the last error

          The job runs nightly at O'Dark thirty.
          I get one chronic failure every few months.

          -Jack

          Comment

          Working...