prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  UnicodeEncodeError when Slack request.post
  UnicodeEncodeError: 'latin-1' codec can't encode characters in position 258-264: Body ('γιώργος') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
  
  Sentry Issue: https://sentry.prod.mozaws.net/operations/snippets/issues/4891896/
  
  </issue>
  <code>
  [start of snippets/base/slack.py]
  1 import logging
  2 
  3 from django.conf import settings
  4 from django.template.loader import render_to_string
  5 
  6 import requests
  7 from raven.contrib.django.models import client as sentry_client
  8 
  9 logger = logging.getLogger(__name__)
  10 
  11 
  12 def send_slack(template_name, snippet):
  13     data = render_to_string('slack/{}.jinja.json'.format(template_name),
  14                             context={'snippet': snippet})
  15     _send_slack(data)
  16 
  17 
  18 def _send_slack(data):
  19     if not (settings.SLACK_ENABLE and settings.SLACK_WEBHOOK):
  20         logger.info('Slack is not enabled.')
  21         return
  22 
  23     try:
  24         response = requests.post(settings.SLACK_WEBHOOK, data=data,
  25                                  headers={'Content-Type': 'application/json'},
  26                                  timeout=4)
  27         response.raise_for_status()
  28     except requests.exceptions.RequestException:
  29         sentry_client.captureException()
  30
  [end of snippets/base/slack.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/snippets/base/slack.py b/snippets/base/slack.py
  --- a/snippets/base/slack.py
  +++ b/snippets/base/slack.py
  @@ -21,7 +21,7 @@
           return
   
       try:
  -        response = requests.post(settings.SLACK_WEBHOOK, data=data,
  +        response = requests.post(settings.SLACK_WEBHOOK, data=data.encode('utf-8'),
                                    headers={'Content-Type': 'application/json'},
                                    timeout=4)
           response.raise_for_status()
  
verification_info: {"golden_diff": "diff --git a/snippets/base/slack.py b/snippets/base/slack.py\n--- a/snippets/base/slack.py\n+++ b/snippets/base/slack.py\n@@ -21,7 +21,7 @@\n         return\n \n     try:\n-        response = requests.post(settings.SLACK_WEBHOOK, data=data,\n+        response = requests.post(settings.SLACK_WEBHOOK, data=data.encode('utf-8'),\n                                  headers={'Content-Type': 'application/json'},\n                                  timeout=4)\n         response.raise_for_status()\n", "issue": "UnicodeEncodeError when Slack request.post\nUnicodeEncodeError: 'latin-1' codec can't encode characters in position 258-264: Body ('\u03b3\u03b9\u03ce\u03c1\u03b3\u03bf\u03c2') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.\r\n\r\nSentry Issue: https://sentry.prod.mozaws.net/operations/snippets/issues/4891896/\n", "before_files": [{"content": "import logging\n\nfrom django.conf import settings\nfrom django.template.loader import render_to_string\n\nimport requests\nfrom raven.contrib.django.models import client as sentry_client\n\nlogger = logging.getLogger(__name__)\n\n\ndef send_slack(template_name, snippet):\n    data = render_to_string('slack/{}.jinja.json'.format(template_name),\n                            context={'snippet': snippet})\n    _send_slack(data)\n\n\ndef _send_slack(data):\n    if not (settings.SLACK_ENABLE and settings.SLACK_WEBHOOK):\n        logger.info('Slack is not enabled.')\n        return\n\n    try:\n        response = requests.post(settings.SLACK_WEBHOOK, data=data,\n                                 headers={'Content-Type': 'application/json'},\n                                 timeout=4)\n        response.raise_for_status()\n    except requests.exceptions.RequestException:\n        sentry_client.captureException()\n", "path": "snippets/base/slack.py"}]}