@@ -341,10 +341,10 @@ class AsyncReader(typing.AsyncIterable[bytes], abc.ABC):
341341 detail is left to each implementation of this class to define.
342342 """
343343
344- filename : str = attr .ib ()
344+ filename : str = attr .ib (repr = True )
345345 """The filename of the resource."""
346346
347- mimetype : typing .Optional [str ] = attr .ib ()
347+ mimetype : typing .Optional [str ] = attr .ib (repr = True )
348348 """The mimetype of the resource. May be `builtins.None` if not known."""
349349
350350 async def data_uri (self ) -> str :
@@ -418,6 +418,12 @@ def url(self) -> str:
418418 def filename (self ) -> str :
419419 """Filename of the resource."""
420420
421+ @property
422+ def extension (self ) -> typing .Optional [str ]:
423+ """File extension, if there is one."""
424+ _ , _ , ext = self .filename .rpartition ("." )
425+ return ext if ext != self .filename else None
426+
421427 @abc .abstractmethod
422428 def stream (
423429 self , * , executor : typing .Optional [concurrent .futures .Executor ] = None , head_only : bool = False ,
@@ -433,7 +439,10 @@ def stream(
433439 head_only : builtins.bool
434440 Defaults to `builtins.False`. If `builtins.True`, then the
435441 implementation may only retrieve HEAD information if supported.
436- This currently only has any effect for web requests.
442+ This currently only has any effect for web requests. This will
443+ fetch the headers for the HTTP resource this object points to
444+ without downloading the entire content, which can be significantly
445+ faster if you are scanning file types in messages, for example.
437446
438447 Returns
439448 -------
@@ -465,10 +474,10 @@ def __hash__(self) -> int:
465474class WebReader (AsyncReader ):
466475 """Asynchronous reader to use to read data from a web resource."""
467476
468- stream : aiohttp .StreamReader = attr .ib ()
477+ stream : aiohttp .StreamReader = attr .ib (repr = False )
469478 """The `aiohttp.StreamReader` to read the content from."""
470479
471- url : str = attr .ib ()
480+ url : str = attr .ib (repr = False )
472481 """The URL being read from."""
473482
474483 status : int = attr .ib ()
0 commit comments