We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] cachet URL error
Currently when sending requests to the status page we are getting the error 

```Unexpected: Failed to create fixed cachet incident. Reason: ValueError("Cannot determine api version based on endpoint 'https://cachet.apps.uclapi.com/api/v1/'. If the api version is not present in the url, please supply it on client creation.")```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `backend/uclapi/common/cachet.py`
Content:
```
1 import cachetclient
2 from cachetclient.v1 import enums
3 from django.conf import settings
4 
5 """
6 This file handles all things cachet. From creating incidents to deleting
7 them when fixed. The results can be seen on our cachet status dashboard at
8 https://cachet.apps.uclapi.com/ .
9 
10 Incidents can be added to components of which we currently have 8 indicating
11 problems with that specific system.
12 List of components and their ID's:
13 Gencache-Staging 1,
14 Occupeye-Staging 3,
15 Occupeye-Mini-Staging 6,
16 OAuth-Staging 7,
17 Gencache-Prod 2,
18 Occupeye-Prod 4,
19 Occupeye-Mini-Prod 5,
20 OAuth-Prod 8
21 
22 You can add a component in the admin dashboard and then reference it using
23 the functions in this file without finding out its ID or attached information.
24 
25 More documentation on cachet endpoints can be found at
26 https://docs.cachethq.io/reference
27 and general documentation at
28 https://docs.cachethq.io/docs
29 """
30 
31 
32 class CachetException(Exception):
33     pass
34 
35 
36 def get_incident_name(base: str) -> str:
37     """
38     Get and append the appropriate suffix for the component using the current
39     domain. For example if we are running on staging.ninja we add the
40     '-staging' suffix.
41 
42     :param base: Base incident name
43     :type base: str
44     :return: Base incident name with correct environment suffix such as
45     -prod or -staging
46     :rtype: str
47 
48     """
49 
50     incident_name = ""
51 
52     if settings.UCLAPI_DOMAIN_CURRENT == "staging.ninja":
53         incident_name = base + "-Staging"
54     elif settings.UCLAPI_DOMAIN_CURRENT == "uclapi.com":
55         incident_name = base + "-Prod"
56 
57     return incident_name
58 
59 
60 def create_incident(error_message: str, component_name: str,
61                     incident_status: int, comp_status: int):
62     """
63     Create an incident with the error message and status specified for the
64     component with its name and new status specified. The status is specified
65     by the
66     cachet.enums enum. Only creates an incident if the component isn't
67     already down.
68 
69     :param error_message: Error message to display on incident
70     :type error_message: str
71     :param component_name: Component name to create incident for
72     :type component_name: str
73     :param incident_status: Status for the incident
74     :type incident_status: int
75     :param comp_status: Status for the component
76     :type comp_status: int
77     """
78 
79     cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,
80                                         api_token=settings.CACHET_TOKEN)
81 
82     target_comp = _get_component(cachet_client, component_name)
83 
84     if target_comp.status == enums.COMPONENT_STATUS_OPERATIONAL:
85 
86         message = (f"{component_name} failed on "
87                    f"{settings.UCLAPI_DOMAIN_CURRENT}"
88                    f" with error: {repr(error_message)}")
89 
90         cachet_client.incidents.create(
91             name=f"{component_name} failed",
92             message=message,
93             status=incident_status,
94             component_id=target_comp.id,
95             component_status=comp_status
96         )
97 
98 
99 def update_incident(update_message: str, component_name: str,
100                     status: int):
101     """
102     Update an incident with the update message and status specified for the
103     component with its name specified . The status is specified by the
104     cachet.enums enum. Only updates if the component is down.
105 
106     :param update_message: Update message to display on incident
107     :type update_message: str
108     :param component_name: Component name to create incident for
109     :type component_name: str
110     :param status: Status for the incident
111     :type status: int
112     """
113 
114     cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,
115                                         api_token=settings.CACHET_TOKEN)
116 
117     target_comp = _get_component(cachet_client, component_name)
118 
119     target_incident = _get_incident(cachet_client, target_comp)
120 
121     if target_comp.status != enums.COMPONENT_STATUS_OPERATIONAL:
122         cachet_client.incident_updates.create(
123             incident_id=target_incident.id,
124             status=status,
125             message=update_message
126         )
127 
128         if status == enums.INCIDENT_FIXED:
129             target_comp.status = enums.COMPONENT_STATUS_OPERATIONAL
130             target_comp.update()
131 
132 
133 def _get_component(client: cachetclient.v1.Client, comp_name: str) -> \
134         cachetclient.v1.components.Component:
135     """
136     Given a component name returns the actual component object.
137 
138     :param client: cachet client instance
139     :type client: cachetclient.v1.Client
140     :param comp_name: Component name to fetch
141     :type comp_name: str
142     :return: Component object with the given name
143     :rtype: cachetclient.v1.components.Component
144     """
145 
146     for i in client.components.list():
147         if i.name == comp_name:
148             return i
149 
150     # If we fail to find it raise an error
151 
152     raise CachetException(
153         "Failed to get cachet incident: Cachet component not found!"
154     )
155 
156 
157 def _get_incident(cachet_client: cachetclient.v1.Client, target_comp:
158                   cachetclient.v1.components.Component) -> \
159         cachetclient.v1.incidents.Incident:
160     """
161 
162     :param cachet_client: cachet client instance
163     :type cachet_client: cachetclient.v1.Client
164     :param target_comp: Component to get incident from
165     :type target_comp: cachetclient.v1.components.Component
166     :return: Incident to update
167     :rtype: cachetclient.v1.incidents.Incident
168     """
169 
170     incidents = cachet_client.incidents.list()
171     for i in incidents:
172         if i.component_id == target_comp.id and i.status != \
173                 enums.INCIDENT_FIXED:
174             return i
175 
176     raise CachetException("Failed to get cachet incident: Cachet Incident not "
177                           "found!")
178
```
--- 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/backend/uclapi/common/cachet.py b/backend/uclapi/common/cachet.py
--- a/backend/uclapi/common/cachet.py
+++ b/backend/uclapi/common/cachet.py
@@ -77,7 +77,8 @@
     """
 
     cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,
-                                        api_token=settings.CACHET_TOKEN)
+                                        api_token=settings.CACHET_TOKEN,
+                                        version="1")
 
     target_comp = _get_component(cachet_client, component_name)
 
@@ -112,7 +113,8 @@
     """
 
     cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,
-                                        api_token=settings.CACHET_TOKEN)
+                                        api_token=settings.CACHET_TOKEN,
+                                        version="1")
 
     target_comp = _get_component(cachet_client, component_name)

{"golden_diff": "diff --git a/backend/uclapi/common/cachet.py b/backend/uclapi/common/cachet.py\n--- a/backend/uclapi/common/cachet.py\n+++ b/backend/uclapi/common/cachet.py\n@@ -77,7 +77,8 @@\n     \"\"\"\n \n     cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,\n-                                        api_token=settings.CACHET_TOKEN)\n+                                        api_token=settings.CACHET_TOKEN,\n+                                        version=\"1\")\n \n     target_comp = _get_component(cachet_client, component_name)\n \n@@ -112,7 +113,8 @@\n     \"\"\"\n \n     cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,\n-                                        api_token=settings.CACHET_TOKEN)\n+                                        api_token=settings.CACHET_TOKEN,\n+                                        version=\"1\")\n \n     target_comp = _get_component(cachet_client, component_name)\n", "issue": "[BUG] cachet URL error\nCurrently when sending requests to the status page we are getting the error \r\n\r\n```Unexpected: Failed to create fixed cachet incident. Reason: ValueError(\"Cannot determine api version based on endpoint 'https://cachet.apps.uclapi.com/api/v1/'. If the api version is not present in the url, please supply it on client creation.\")```\r\n\n", "before_files": [{"content": "import cachetclient\nfrom cachetclient.v1 import enums\nfrom django.conf import settings\n\n\"\"\"\nThis file handles all things cachet. From creating incidents to deleting\nthem when fixed. The results can be seen on our cachet status dashboard at\nhttps://cachet.apps.uclapi.com/ .\n\nIncidents can be added to components of which we currently have 8 indicating\nproblems with that specific system.\nList of components and their ID's:\nGencache-Staging 1,\nOccupeye-Staging 3,\nOccupeye-Mini-Staging 6,\nOAuth-Staging 7,\nGencache-Prod 2,\nOccupeye-Prod 4,\nOccupeye-Mini-Prod 5,\nOAuth-Prod 8\n\nYou can add a component in the admin dashboard and then reference it using\nthe functions in this file without finding out its ID or attached information.\n\nMore documentation on cachet endpoints can be found at\nhttps://docs.cachethq.io/reference\nand general documentation at\nhttps://docs.cachethq.io/docs\n\"\"\"\n\n\nclass CachetException(Exception):\n    pass\n\n\ndef get_incident_name(base: str) -> str:\n    \"\"\"\n    Get and append the appropriate suffix for the component using the current\n    domain. For example if we are running on staging.ninja we add the\n    '-staging' suffix.\n\n    :param base: Base incident name\n    :type base: str\n    :return: Base incident name with correct environment suffix such as\n    -prod or -staging\n    :rtype: str\n\n    \"\"\"\n\n    incident_name = \"\"\n\n    if settings.UCLAPI_DOMAIN_CURRENT == \"staging.ninja\":\n        incident_name = base + \"-Staging\"\n    elif settings.UCLAPI_DOMAIN_CURRENT == \"uclapi.com\":\n        incident_name = base + \"-Prod\"\n\n    return incident_name\n\n\ndef create_incident(error_message: str, component_name: str,\n                    incident_status: int, comp_status: int):\n    \"\"\"\n    Create an incident with the error message and status specified for the\n    component with its name and new status specified. The status is specified\n    by the\n    cachet.enums enum. Only creates an incident if the component isn't\n    already down.\n\n    :param error_message: Error message to display on incident\n    :type error_message: str\n    :param component_name: Component name to create incident for\n    :type component_name: str\n    :param incident_status: Status for the incident\n    :type incident_status: int\n    :param comp_status: Status for the component\n    :type comp_status: int\n    \"\"\"\n\n    cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,\n                                        api_token=settings.CACHET_TOKEN)\n\n    target_comp = _get_component(cachet_client, component_name)\n\n    if target_comp.status == enums.COMPONENT_STATUS_OPERATIONAL:\n\n        message = (f\"{component_name} failed on \"\n                   f\"{settings.UCLAPI_DOMAIN_CURRENT}\"\n                   f\" with error: {repr(error_message)}\")\n\n        cachet_client.incidents.create(\n            name=f\"{component_name} failed\",\n            message=message,\n            status=incident_status,\n            component_id=target_comp.id,\n            component_status=comp_status\n        )\n\n\ndef update_incident(update_message: str, component_name: str,\n                    status: int):\n    \"\"\"\n    Update an incident with the update message and status specified for the\n    component with its name specified . The status is specified by the\n    cachet.enums enum. Only updates if the component is down.\n\n    :param update_message: Update message to display on incident\n    :type update_message: str\n    :param component_name: Component name to create incident for\n    :type component_name: str\n    :param status: Status for the incident\n    :type status: int\n    \"\"\"\n\n    cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,\n                                        api_token=settings.CACHET_TOKEN)\n\n    target_comp = _get_component(cachet_client, component_name)\n\n    target_incident = _get_incident(cachet_client, target_comp)\n\n    if target_comp.status != enums.COMPONENT_STATUS_OPERATIONAL:\n        cachet_client.incident_updates.create(\n            incident_id=target_incident.id,\n            status=status,\n            message=update_message\n        )\n\n        if status == enums.INCIDENT_FIXED:\n            target_comp.status = enums.COMPONENT_STATUS_OPERATIONAL\n            target_comp.update()\n\n\ndef _get_component(client: cachetclient.v1.Client, comp_name: str) -> \\\n        cachetclient.v1.components.Component:\n    \"\"\"\n    Given a component name returns the actual component object.\n\n    :param client: cachet client instance\n    :type client: cachetclient.v1.Client\n    :param comp_name: Component name to fetch\n    :type comp_name: str\n    :return: Component object with the given name\n    :rtype: cachetclient.v1.components.Component\n    \"\"\"\n\n    for i in client.components.list():\n        if i.name == comp_name:\n            return i\n\n    # If we fail to find it raise an error\n\n    raise CachetException(\n        \"Failed to get cachet incident: Cachet component not found!\"\n    )\n\n\ndef _get_incident(cachet_client: cachetclient.v1.Client, target_comp:\n                  cachetclient.v1.components.Component) -> \\\n        cachetclient.v1.incidents.Incident:\n    \"\"\"\n\n    :param cachet_client: cachet client instance\n    :type cachet_client: cachetclient.v1.Client\n    :param target_comp: Component to get incident from\n    :type target_comp: cachetclient.v1.components.Component\n    :return: Incident to update\n    :rtype: cachetclient.v1.incidents.Incident\n    \"\"\"\n\n    incidents = cachet_client.incidents.list()\n    for i in incidents:\n        if i.component_id == target_comp.id and i.status != \\\n                enums.INCIDENT_FIXED:\n            return i\n\n    raise CachetException(\"Failed to get cachet incident: Cachet Incident not \"\n                          \"found!\")\n", "path": "backend/uclapi/common/cachet.py"}], "after_files": [{"content": "import cachetclient\nfrom cachetclient.v1 import enums\nfrom django.conf import settings\n\n\"\"\"\nThis file handles all things cachet. From creating incidents to deleting\nthem when fixed. The results can be seen on our cachet status dashboard at\nhttps://cachet.apps.uclapi.com/ .\n\nIncidents can be added to components of which we currently have 8 indicating\nproblems with that specific system.\nList of components and their ID's:\nGencache-Staging 1,\nOccupeye-Staging 3,\nOccupeye-Mini-Staging 6,\nOAuth-Staging 7,\nGencache-Prod 2,\nOccupeye-Prod 4,\nOccupeye-Mini-Prod 5,\nOAuth-Prod 8\n\nYou can add a component in the admin dashboard and then reference it using\nthe functions in this file without finding out its ID or attached information.\n\nMore documentation on cachet endpoints can be found at\nhttps://docs.cachethq.io/reference\nand general documentation at\nhttps://docs.cachethq.io/docs\n\"\"\"\n\n\nclass CachetException(Exception):\n    pass\n\n\ndef get_incident_name(base: str) -> str:\n    \"\"\"\n    Get and append the appropriate suffix for the component using the current\n    domain. For example if we are running on staging.ninja we add the\n    '-staging' suffix.\n\n    :param base: Base incident name\n    :type base: str\n    :return: Base incident name with correct environment suffix such as\n    -prod or -staging\n    :rtype: str\n\n    \"\"\"\n\n    incident_name = \"\"\n\n    if settings.UCLAPI_DOMAIN_CURRENT == \"staging.ninja\":\n        incident_name = base + \"-Staging\"\n    elif settings.UCLAPI_DOMAIN_CURRENT == \"uclapi.com\":\n        incident_name = base + \"-Prod\"\n\n    return incident_name\n\n\ndef create_incident(error_message: str, component_name: str,\n                    incident_status: int, comp_status: int):\n    \"\"\"\n    Create an incident with the error message and status specified for the\n    component with its name and new status specified. The status is specified\n    by the\n    cachet.enums enum. Only creates an incident if the component isn't\n    already down.\n\n    :param error_message: Error message to display on incident\n    :type error_message: str\n    :param component_name: Component name to create incident for\n    :type component_name: str\n    :param incident_status: Status for the incident\n    :type incident_status: int\n    :param comp_status: Status for the component\n    :type comp_status: int\n    \"\"\"\n\n    cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,\n                                        api_token=settings.CACHET_TOKEN,\n                                        version=\"1\")\n\n    target_comp = _get_component(cachet_client, component_name)\n\n    if target_comp.status == enums.COMPONENT_STATUS_OPERATIONAL:\n\n        message = (f\"{component_name} failed on \"\n                   f\"{settings.UCLAPI_DOMAIN_CURRENT}\"\n                   f\" with error: {repr(error_message)}\")\n\n        cachet_client.incidents.create(\n            name=f\"{component_name} failed\",\n            message=message,\n            status=incident_status,\n            component_id=target_comp.id,\n            component_status=comp_status\n        )\n\n\ndef update_incident(update_message: str, component_name: str,\n                    status: int):\n    \"\"\"\n    Update an incident with the update message and status specified for the\n    component with its name specified . The status is specified by the\n    cachet.enums enum. Only updates if the component is down.\n\n    :param update_message: Update message to display on incident\n    :type update_message: str\n    :param component_name: Component name to create incident for\n    :type component_name: str\n    :param status: Status for the incident\n    :type status: int\n    \"\"\"\n\n    cachet_client = cachetclient.Client(endpoint=settings.CACHET_URL,\n                                        api_token=settings.CACHET_TOKEN,\n                                        version=\"1\")\n\n    target_comp = _get_component(cachet_client, component_name)\n\n    target_incident = _get_incident(cachet_client, target_comp)\n\n    if target_comp.status != enums.COMPONENT_STATUS_OPERATIONAL:\n        cachet_client.incident_updates.create(\n            incident_id=target_incident.id,\n            status=status,\n            message=update_message\n        )\n\n        if status == enums.INCIDENT_FIXED:\n            target_comp.status = enums.COMPONENT_STATUS_OPERATIONAL\n            target_comp.update()\n\n\ndef _get_component(client: cachetclient.v1.Client, comp_name: str) -> \\\n        cachetclient.v1.components.Component:\n    \"\"\"\n    Given a component name returns the actual component object.\n\n    :param client: cachet client instance\n    :type client: cachetclient.v1.Client\n    :param comp_name: Component name to fetch\n    :type comp_name: str\n    :return: Component object with the given name\n    :rtype: cachetclient.v1.components.Component\n    \"\"\"\n\n    for i in client.components.list():\n        if i.name == comp_name:\n            return i\n\n    # If we fail to find it raise an error\n\n    raise CachetException(\n        \"Failed to get cachet incident: Cachet component not found!\"\n    )\n\n\ndef _get_incident(cachet_client: cachetclient.v1.Client, target_comp:\n                  cachetclient.v1.components.Component) -> \\\n        cachetclient.v1.incidents.Incident:\n    \"\"\"\n\n    :param cachet_client: cachet client instance\n    :type cachet_client: cachetclient.v1.Client\n    :param target_comp: Component to get incident from\n    :type target_comp: cachetclient.v1.components.Component\n    :return: Incident to update\n    :rtype: cachetclient.v1.incidents.Incident\n    \"\"\"\n\n    incidents = cachet_client.incidents.list()\n    for i in incidents:\n        if i.component_id == target_comp.id and i.status != \\\n                enums.INCIDENT_FIXED:\n            return i\n\n    raise CachetException(\"Failed to get cachet incident: Cachet Incident not \"\n                          \"found!\")\n", "path": "backend/uclapi/common/cachet.py"}]}