File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 2424from __future__ import annotations
2525
2626import json
27- from typing import TYPE_CHECKING , Optional
27+ from typing import Optional
2828
2929import aiohttp
3030
3333from .objects import Paste , PasteData
3434
3535
36- if TYPE_CHECKING :
36+ try :
3737 import requests
38+ except ImportError :
39+ HAS_REQUESTS = False
40+ else :
41+ HAS_REQUESTS = True
3842
3943__all__ = (
4044 "Client" ,
@@ -143,6 +147,9 @@ async def close(self) -> None:
143147
144148class SyncClient :
145149 def __init__ (self , * , session : Optional [requests .Session ] = None ) -> None :
150+ if HAS_REQUESTS is not True :
151+ raise RuntimeError ("The `requests` addon is required to use the Sync client." )
152+
146153 self .session : requests .Session = session or requests .Session ()
147154
148155 def post (self , content : str , syntax : Optional [str ] = None ) -> Paste :
You can’t perform that action at this time.
0 commit comments