Cuidado com essa parte ↓↓↓
if method.upper() == Methods.GET: return requests.get(url,headers=headers)
elif method.upper() == Methods.PUT: return requests.put(url,headers=headers,data=json.dumps(data))
elif method.upper() == Methods.POST: return requests.post(url,headers=headers,data=json.dumps(data))
elif method.upper() == Methods.PATCH: return requests.patch(url,headers=headers,data=json.dumps(data))
elif method.upper() == Methods.DELETE: return requests.delete(url,headers=headers)
Caso o method for DELETE, ele terá que executar 5 vezes o mesmo método.
faça assim ↓↓↓
requestMethod = method.upper()
if requestMethod == Methods.GET: return requests.get(url,headers=headers)
elif requestMethod == Methods.PUT: return requests.put(url,headers=headers,data=json.dumps(data))
elif requestMethod == Methods.POST: return requests.post(url,headers=headers,data=json.dumps(data))
elif requestMethod == Methods.PATCH: return requests.patch(url,headers=headers,data=json.dumps(data))
elif requestMethod == Methods.DELETE: return requests.delete(url,headers=headers)
Aqui ele executa somente uma vez independente do method.
Daria para encaixar o match/case, mas ai é da sua escolha.