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

[python-sdk] Remove requests dependency #198

Merged
Show file tree
Hide file tree
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
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/*']},
)