We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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/

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `snippets/base/slack.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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

{"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"}], "after_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.encode('utf-8'),\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"}]}