title: googlesearch library for python
body: <p>I have a large file of queries that I need search in google and return the resulting URLs for that query in another file. I'm using this package <a href="https://pypi.python.org/pypi/googlesearch/0.7.0" rel="nofollow">https://pypi.python.org/pypi/googlesearch/0.7.0</a> . </p>
  
  <p>While running my program in terminal, often times I get 20 or so URLs to print to the screen and then I get GoogleSearch switched to proxy number 1 printed to the screen. After a few minutes, a long list of errors that ends with Failed to establish a new connection: [Errno 60] Operation timed out' prints to the screen.</p>
  
  <p>My question is why am I getting results at first and then the proxy number switches? I suspect I am sending too many requests to google BUT some times when I run my program I'll get maybe 4 results and then I get the same message and error. What can I do? In the package there is a file search.py which determines which proxy is used or when it is changed. Is it possible to adjust the amount of time between requests if this is the reason for the error? </p>
  
  <p>The important part of search.py</p>
  
  <pre><code>def proxy(self):
      if self.use_proxy:
          return {"http": settings.PROXY_LIST[self.proxy_no]}
      else:
          return {"http": None}
  
  def switch_to_next_proxy(self):
      num_proxies = len(settings.PROXY_LIST)
      GoogleSearch.proxy_no = (self.proxy_no + 1) % num_proxies
      if self.verbose:
          print &gt;&gt; sys.stderr, ('GoogleSearch switched to '
                                'proxy number %i' % self.proxy_no)
  </code></pre>