Skip to content

Commit

Permalink
Use local relative rather than global absolute import for __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
CAM-Gerlach committed Oct 21, 2023
1 parent 33f8284 commit d1be219
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions prawcore/requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import requests

import prawcore

from .const import TIMEOUT
from .exceptions import InvalidInvocation, RequestException

Expand Down Expand Up @@ -47,14 +45,15 @@ def __init__(
giving up (default: ``prawcore.const.TIMEOUT``).
"""
# Imported locally to avoid an import cycle, with __init__
from . import __version__

if user_agent is None or len(user_agent) < 7:
msg = "user_agent is not descriptive"
raise InvalidInvocation(msg)

self._http = session or requests.Session()
self._http.headers[
"User-Agent"
] = f"{user_agent} prawcore/{prawcore.__version__}"
self._http.headers["User-Agent"] = f"{user_agent} prawcore/{__version__}"

self.oauth_url = oauth_url
self.reddit_url = reddit_url
Expand Down

0 comments on commit d1be219

Please sign in to comment.