From 2698370a72051a7e451300a000540926551afd57 Mon Sep 17 00:00:00 2001 From: Wenlei Xie Date: Fri, 31 May 2024 19:42:19 -0700 Subject: [PATCH] Add type annotation for HTTPError --- aiogoogle/excs.py | 8 +++++++- aiogoogle/models.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/aiogoogle/excs.py b/aiogoogle/excs.py index 57a15d2..b160e15 100644 --- a/aiogoogle/excs.py +++ b/aiogoogle/excs.py @@ -1,5 +1,11 @@ +from __future__ import annotations +from typing import TYPE_CHECKING + __all__ = ["AiogoogleError", "ValidationError", "HTTPError", "AuthError"] +if TYPE_CHECKING: + from .models import Response + class AiogoogleError(Exception): pass @@ -14,7 +20,7 @@ class ValidationError(AiogoogleError): class HTTPError(AiogoogleError): - def __init__(self, msg, req=None, res=None): + def __init__(self, msg, req, res: Response): self.req = req self.res = res super().__init__(msg) diff --git a/aiogoogle/models.py b/aiogoogle/models.py index e3809e2..5270ed4 100644 --- a/aiogoogle/models.py +++ b/aiogoogle/models.py @@ -286,7 +286,7 @@ class Response: def __init__( self, - status_code=None, + status_code: int, headers=None, url=None, json=None,