Skip to content

Commit

Permalink
Merge pull request #109 from vpodzime/master-no_requests
Browse files Browse the repository at this point in the history
Remove the dependency on the 'requests' Python package
  • Loading branch information
olehermanse authored Apr 25, 2022
2 parents 8a06039 + 269c181 commit 5d910cc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ $ cfbs install .
`cfbs` is implemented in Python and has a few dependencies:

* Python 3.5 or newer
* `requests` python library
* `git` CLI installed and in PATH
* `rsync`
* `autoconf` for configuring masterfiles module (typical usage but not required)
Expand Down
9 changes: 4 additions & 5 deletions cfbs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import subprocess
import hashlib
import urllib
import urllib.request # needed on some platforms
from collections import OrderedDict
from shutil import rmtree

import requests

from cfbs.pretty import pretty

SHA1_RE = re.compile(r"^[0-9a-f]{40}$")
Expand Down Expand Up @@ -84,9 +83,9 @@ def user_error(msg: str):


def get_json(url: str) -> OrderedDict:
r = requests.get(url)
assert r.status_code >= 200 and r.status_code < 300
return r.json(object_pairs_hook=OrderedDict)
with urllib.request.urlopen(url) as r:
assert r.status >= 200 and r.status < 300
return json.loads(r.read().decode(), object_pairs_hook=OrderedDict)


def get_or_read_json(path: str) -> OrderedDict:
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
requests>=2.25.1
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@
]
},
install_requires=[
"requests >= 2.25.1",
],
)

0 comments on commit 5d910cc

Please sign in to comment.