Skip to content

Commit

Permalink
Remove requests dependency (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey Bolmier authored Dec 30, 2021
1 parent 0aae49a commit 7907828
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
18 changes: 9 additions & 9 deletions extern-sdk/python/git_release.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
import requests
import os
import platform
import sys
import tarfile
import os
import urllib.request


REPOS = "kleveross/ormb"
Expand All @@ -21,12 +21,12 @@ def untar(fname, dirs):

def download():
url = 'https://api.github.com/repos/%s/releases/%s' % (REPOS, VERSION)
r = requests.get(url)
r = urllib.request.urlopen(url)

if r.status_code != 200:
raise Exception("get assets info err, ret code: %s" % r.status_code)
if r.status != 200:
raise Exception("get assets info err, ret code: %s" % r.status)

json_info = json.loads(r.text)
json_info = json.loads(r.read())

cur_version = json_info["tag_name"][1:]

Expand All @@ -47,15 +47,15 @@ def download():

# download the url contents in binary format
headers = {'Accept': 'application/octet-stream'}
r = requests.get(asset_url, headers=headers)
req = urllib.request.Request(asset_url, headers=headers)
r = urllib.request.urlopen(req)

# open method to open a file on your system and write the contents
with open(asset_name, "wb") as code:
code.write(r.content)
code.write(r.read())

if not os.path.exists(BIN_PATH):
os.mkdir(BIN_PATH)
untar(asset_name, BIN_PATH)

os.remove(asset_name)

3 changes: 0 additions & 3 deletions extern-sdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def read_version():
maintainer="gaocegege, ZhuYuJin",
description="ormb warehouse",
python_requires=">=3.6",
install_requires=[
"requests"
],
packages=find_packages(include=("ormb", "ormb.*")),
package_data={'ormb': ['bin/*']},
)

0 comments on commit 7907828

Please sign in to comment.