Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support installing/running with pipx - fixes #238 #241

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions peru/resources/plugins/curl/curl_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
from urllib.error import HTTPError, URLError
from urllib.parse import urlsplit
from urllib.request import Request
import peru.main
import urllib.request
import zipfile

try:
from peru.main import get_version
except ModuleNotFoundError:
get_version = None


def add_user_agent_to_request(request):
components = [
"peru/%s" % peru.main.get_version(),
"peru/%s" % get_version() if get_version else "peru",
urllib.request.URLopener.version
]
request.add_header("User-agent", " ".join(components))
Expand Down