prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Google Pubsub push messages mis-identified as crawler
  ## Important Details
  
  How are you running Sentry?
  
  * [ ] On-Premise docker [Version xyz]
  * [x] Saas (sentry.io)
  * [ ] Other [briefly describe your environment]
  
  ## Description
  
  We get the Sentry API error `Sentry responded with an API error: APIError(Event dropped due to filter: web-crawlers)` when there's an exception in a [Google Pubsub push](https://cloud.google.com/pubsub/docs/push) handler.
  
  Apparently the user agent is `APIs-Google`.
  
  ## Steps to Reproduce
  
  1. Set up a Google Pubsub push HTTP event handler
  2. Have an exception in the message handler code
  3. Not get report in Sentry
  
  ### What you expected to happen
  
  `APIs-Google` isn't identified as a web crawler.
  
  ### Possible Solution
  
  Improve the regex? 😸 
  
  
  </issue>
  <code>
  [start of src/sentry/filters/web_crawlers.py]
  1 from __future__ import absolute_import
  2 
  3 import re
  4 
  5 from .base import Filter
  6 from sentry.utils.data_filters import FilterStatKeys
  7 from sentry.utils.safe import get_path
  8 
  9 # not all of these agents are guaranteed to execute JavaScript, but to avoid
  10 # overhead of identifying which ones do, and which ones will over time we simply
  11 # target all of the major ones
  12 CRAWLERS = re.compile(
  13     r'|'.join(
  14         (
  15             # various Google services
  16             r'AdsBot',
  17             # Google Adsense
  18             r'Mediapartners',
  19             # Google+ and Google web search
  20             r'Google',
  21             # Bing search
  22             r'BingBot',
  23             r'BingPreview',
  24             # Baidu search
  25             r'Baiduspider',
  26             # Yahoo
  27             r'Slurp',
  28             # Sogou
  29             r'Sogou',
  30             # facebook
  31             r'facebook',
  32             # Alexa
  33             r'ia_archiver',
  34             # Generic bot
  35             r'bots?[\/\s\)\;]',
  36             # Generic spider
  37             r'spider[\/\s\)\;]',
  38             # Slack - see https://api.slack.com/robots
  39             r'Slack',
  40             # Google indexing bot
  41             r'Calypso AppCrawler',
  42         )
  43     ),
  44     re.I
  45 )
  46 
  47 
  48 class WebCrawlersFilter(Filter):
  49     id = FilterStatKeys.WEB_CRAWLER
  50     name = 'Filter out known web crawlers'
  51     description = 'Some crawlers may execute pages in incompatible ways which then cause errors that are unlikely to be seen by a normal user.'
  52     default = True
  53 
  54     def get_user_agent(self, data):
  55         try:
  56             for key, value in get_path(data, 'request', 'headers', filter=True) or ():
  57                 if key.lower() == 'user-agent':
  58                     return value
  59         except LookupError:
  60             return ''
  61 
  62     def test(self, data):
  63         # TODO(dcramer): we could also look at UA parser and use the 'Spider'
  64         # device type
  65         user_agent = self.get_user_agent(data)
  66         if not user_agent:
  67             return False
  68         return bool(CRAWLERS.search(user_agent))
  69
  [end of src/sentry/filters/web_crawlers.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/sentry/filters/web_crawlers.py b/src/sentry/filters/web_crawlers.py
  --- a/src/sentry/filters/web_crawlers.py
  +++ b/src/sentry/filters/web_crawlers.py
  @@ -16,8 +16,8 @@
               r'AdsBot',
               # Google Adsense
               r'Mediapartners',
  -            # Google+ and Google web search
  -            r'Google',
  +            # Google+ and Google web search, but not apis-google
  +            r'(?<!APIs-)Google',
               # Bing search
               r'BingBot',
               r'BingPreview',
  
verification_info: {"golden_diff": "diff --git a/src/sentry/filters/web_crawlers.py b/src/sentry/filters/web_crawlers.py\n--- a/src/sentry/filters/web_crawlers.py\n+++ b/src/sentry/filters/web_crawlers.py\n@@ -16,8 +16,8 @@\n             r'AdsBot',\n             # Google Adsense\n             r'Mediapartners',\n-            # Google+ and Google web search\n-            r'Google',\n+            # Google+ and Google web search, but not apis-google\n+            r'(?<!APIs-)Google',\n             # Bing search\n             r'BingBot',\n             r'BingPreview',\n", "issue": "Google Pubsub push messages mis-identified as crawler\n## Important Details\r\n\r\nHow are you running Sentry?\r\n\r\n* [ ] On-Premise docker [Version xyz]\r\n* [x] Saas (sentry.io)\r\n* [ ] Other [briefly describe your environment]\r\n\r\n## Description\r\n\r\nWe get the Sentry API error `Sentry responded with an API error: APIError(Event dropped due to filter: web-crawlers)` when there's an exception in a [Google Pubsub push](https://cloud.google.com/pubsub/docs/push) handler.\r\n\r\nApparently the user agent is `APIs-Google`.\r\n\r\n## Steps to Reproduce\r\n\r\n1. Set up a Google Pubsub push HTTP event handler\r\n2. Have an exception in the message handler code\r\n3. Not get report in Sentry\r\n\r\n### What you expected to happen\r\n\r\n`APIs-Google` isn't identified as a web crawler.\r\n\r\n### Possible Solution\r\n\r\nImprove the regex? \ud83d\ude38 \r\n\n", "before_files": [{"content": "from __future__ import absolute_import\n\nimport re\n\nfrom .base import Filter\nfrom sentry.utils.data_filters import FilterStatKeys\nfrom sentry.utils.safe import get_path\n\n# not all of these agents are guaranteed to execute JavaScript, but to avoid\n# overhead of identifying which ones do, and which ones will over time we simply\n# target all of the major ones\nCRAWLERS = re.compile(\n    r'|'.join(\n        (\n            # various Google services\n            r'AdsBot',\n            # Google Adsense\n            r'Mediapartners',\n            # Google+ and Google web search\n            r'Google',\n            # Bing search\n            r'BingBot',\n            r'BingPreview',\n            # Baidu search\n            r'Baiduspider',\n            # Yahoo\n            r'Slurp',\n            # Sogou\n            r'Sogou',\n            # facebook\n            r'facebook',\n            # Alexa\n            r'ia_archiver',\n            # Generic bot\n            r'bots?[\\/\\s\\)\\;]',\n            # Generic spider\n            r'spider[\\/\\s\\)\\;]',\n            # Slack - see https://api.slack.com/robots\n            r'Slack',\n            # Google indexing bot\n            r'Calypso AppCrawler',\n        )\n    ),\n    re.I\n)\n\n\nclass WebCrawlersFilter(Filter):\n    id = FilterStatKeys.WEB_CRAWLER\n    name = 'Filter out known web crawlers'\n    description = 'Some crawlers may execute pages in incompatible ways which then cause errors that are unlikely to be seen by a normal user.'\n    default = True\n\n    def get_user_agent(self, data):\n        try:\n            for key, value in get_path(data, 'request', 'headers', filter=True) or ():\n                if key.lower() == 'user-agent':\n                    return value\n        except LookupError:\n            return ''\n\n    def test(self, data):\n        # TODO(dcramer): we could also look at UA parser and use the 'Spider'\n        # device type\n        user_agent = self.get_user_agent(data)\n        if not user_agent:\n            return False\n        return bool(CRAWLERS.search(user_agent))\n", "path": "src/sentry/filters/web_crawlers.py"}]}