Skip to content

Commit

Permalink
Merge pull request #30 from yarikoptic/opt-delay-requests
Browse files Browse the repository at this point in the history
RF/OPT: delay import of requests until used/needed in _etrequest
  • Loading branch information
satra authored Feb 9, 2021
2 parents ca72400 + 82893a6 commit fc36b72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion etelemetry/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from requests import request, ConnectionError, ReadTimeout
import os

try:
Expand All @@ -21,6 +20,9 @@ class BadVersionError(RuntimeError):


def _etrequest(endpoint, method="get", **kwargs):
# Delay requests import until actually used to at least not
# add runtime penalty of requests import whenever not needed
from requests import request, ConnectionError, ReadTimeout
if kwargs.get('timeout') is None:
kwargs['timeout'] = 5

Expand Down

0 comments on commit fc36b72

Please sign in to comment.