We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Update removed `platform.linux_distribution` funtion call in Python 3.8
## Description

We are using [platform.linux_distribution](https://github.com/freedomofpress/securedrop/blob/4c73102ca9151a86a08396de40163b48a5a21768/securedrop/source_app/api.py#L20) function in our metadata endpoint. But, this function was deprecated from Python3.5 and totally removed from Python 3.8. 

## Solution

We can directly read the `/etc/lsb-release` and `/etc/os-release` file as required.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `securedrop/source_app/api.py`
Content:
```
1 import json
2 import platform
3 
4 from flask import Blueprint, current_app, make_response
5 
6 from source_app.utils import get_sourcev2_url, get_sourcev3_url
7 
8 import version
9 
10 
11 def make_blueprint(config):
12     view = Blueprint('api', __name__)
13 
14     @view.route('/metadata')
15     def metadata():
16         meta = {
17             'allow_document_uploads': current_app.instance_config.allow_document_uploads,
18             'gpg_fpr': config.JOURNALIST_KEY,
19             'sd_version': version.__version__,
20             'server_os': platform.linux_distribution()[1],
21             'supported_languages': config.SUPPORTED_LOCALES,
22             'v2_source_url': get_sourcev2_url(),
23             'v3_source_url': get_sourcev3_url()
24         }
25         resp = make_response(json.dumps(meta))
26         resp.headers['Content-Type'] = 'application/json'
27         return resp
28 
29     return view
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/securedrop/source_app/api.py b/securedrop/source_app/api.py
--- a/securedrop/source_app/api.py
+++ b/securedrop/source_app/api.py
@@ -1,5 +1,4 @@
 import json
-import platform
 
 from flask import Blueprint, current_app, make_response
 
@@ -8,6 +7,10 @@
 import version
 
 
+with open("/etc/lsb-release", "r") as f:
+    server_os = f.readlines()[1].split("=")[1].strip("\n")
+
+
 def make_blueprint(config):
     view = Blueprint('api', __name__)
 
@@ -17,7 +20,7 @@
             'allow_document_uploads': current_app.instance_config.allow_document_uploads,
             'gpg_fpr': config.JOURNALIST_KEY,
             'sd_version': version.__version__,
-            'server_os': platform.linux_distribution()[1],
+            'server_os': server_os,
             'supported_languages': config.SUPPORTED_LOCALES,
             'v2_source_url': get_sourcev2_url(),
             'v3_source_url': get_sourcev3_url()

{"golden_diff": "diff --git a/securedrop/source_app/api.py b/securedrop/source_app/api.py\n--- a/securedrop/source_app/api.py\n+++ b/securedrop/source_app/api.py\n@@ -1,5 +1,4 @@\n import json\n-import platform\n \n from flask import Blueprint, current_app, make_response\n \n@@ -8,6 +7,10 @@\n import version\n \n \n+with open(\"/etc/lsb-release\", \"r\") as f:\n+    server_os = f.readlines()[1].split(\"=\")[1].strip(\"\\n\")\n+\n+\n def make_blueprint(config):\n     view = Blueprint('api', __name__)\n \n@@ -17,7 +20,7 @@\n             'allow_document_uploads': current_app.instance_config.allow_document_uploads,\n             'gpg_fpr': config.JOURNALIST_KEY,\n             'sd_version': version.__version__,\n-            'server_os': platform.linux_distribution()[1],\n+            'server_os': server_os,\n             'supported_languages': config.SUPPORTED_LOCALES,\n             'v2_source_url': get_sourcev2_url(),\n             'v3_source_url': get_sourcev3_url()\n", "issue": "Update removed `platform.linux_distribution` funtion call in Python 3.8\n## Description\r\n\r\nWe are using [platform.linux_distribution](https://github.com/freedomofpress/securedrop/blob/4c73102ca9151a86a08396de40163b48a5a21768/securedrop/source_app/api.py#L20) function in our metadata endpoint. But, this function was deprecated from Python3.5 and totally removed from Python 3.8. \r\n\r\n## Solution\r\n\r\nWe can directly read the `/etc/lsb-release` and `/etc/os-release` file as required.\r\n\n", "before_files": [{"content": "import json\nimport platform\n\nfrom flask import Blueprint, current_app, make_response\n\nfrom source_app.utils import get_sourcev2_url, get_sourcev3_url\n\nimport version\n\n\ndef make_blueprint(config):\n    view = Blueprint('api', __name__)\n\n    @view.route('/metadata')\n    def metadata():\n        meta = {\n            'allow_document_uploads': current_app.instance_config.allow_document_uploads,\n            'gpg_fpr': config.JOURNALIST_KEY,\n            'sd_version': version.__version__,\n            'server_os': platform.linux_distribution()[1],\n            'supported_languages': config.SUPPORTED_LOCALES,\n            'v2_source_url': get_sourcev2_url(),\n            'v3_source_url': get_sourcev3_url()\n        }\n        resp = make_response(json.dumps(meta))\n        resp.headers['Content-Type'] = 'application/json'\n        return resp\n\n    return view\n", "path": "securedrop/source_app/api.py"}], "after_files": [{"content": "import json\n\nfrom flask import Blueprint, current_app, make_response\n\nfrom source_app.utils import get_sourcev2_url, get_sourcev3_url\n\nimport version\n\n\nwith open(\"/etc/lsb-release\", \"r\") as f:\n    server_os = f.readlines()[1].split(\"=\")[1].strip(\"\\n\")\n\n\ndef make_blueprint(config):\n    view = Blueprint('api', __name__)\n\n    @view.route('/metadata')\n    def metadata():\n        meta = {\n            'allow_document_uploads': current_app.instance_config.allow_document_uploads,\n            'gpg_fpr': config.JOURNALIST_KEY,\n            'sd_version': version.__version__,\n            'server_os': server_os,\n            'supported_languages': config.SUPPORTED_LOCALES,\n            'v2_source_url': get_sourcev2_url(),\n            'v3_source_url': get_sourcev3_url()\n        }\n        resp = make_response(json.dumps(meta))\n        resp.headers['Content-Type'] = 'application/json'\n        return resp\n\n    return view\n", "path": "securedrop/source_app/api.py"}]}