mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
wip
This commit is contained in:
parent
65175f3cf3
commit
37e2ba87a7
13 changed files with 134 additions and 0 deletions
16
pre_commit/request.py
Normal file
16
pre_commit/request.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import urllib.request
|
||||
from typing import IO
|
||||
|
||||
from pre_commit.constants import VERSION
|
||||
|
||||
|
||||
def fetch(url: str) -> IO[bytes]:
|
||||
pyver = '.'.join(str(v) for v in sys.version_info[:3])
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
headers={'User-Agent': f'pre-commit/{VERSION} python/{pyver}'},
|
||||
)
|
||||
return urllib.request.urlopen(req)
|
||||
Loading…
Add table
Add a link
Reference in a new issue