Skip to content
Myr

Lazily import 'netrc' module (#2910)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by GitHub · parent 9751f76 · Browse files · 1 file+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:httpx/_auth.py+4 added-1 removed
1import hashlib2import netrc2import os3import re4import time5import typing
140 unmodified lines
146 Use a 'netrc' file to lookup basic auth credentials based on the url host.147 """148149 def __init__(self, file: typing.Optional[str] = None):150 # Lazily import 'netrc'.151 # There's no need for us to load this module unless 'NetRCAuth' is being used.152 import netrc153154 self._netrc_info = netrc.netrc(file)155156 def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]:157 auth_info = self._netrc_info.authenticators(request.url.host)
195 unmodified lines