__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#!/usr/bin/env python3
# Copyright (c) 2009 Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script which downloads wheel files hosted on GitHub:
https://github.com/giampaolo/psutil/actions
It needs an access token string generated from personal GitHub profile:
https://github.com/settings/tokens
The token must be created with at least "public_repo" scope/rights.
If you lose it, just generate a new token.
REST API doc:
https://developer.github.com/v3/actions/artifacts/.
"""
import argparse
import json
import os
import sys
import zipfile
import requests
from psutil import __version__
from psutil._common import bytes2human
from psutil.tests import safe_rmpath
USER = "giampaolo"
PROJECT = "psutil"
PROJECT_VERSION = __version__
OUTFILE = "wheels-github.zip"
TOKEN = ""
TIMEOUT = 30
def get_artifacts():
base_url = "https://api.github.com/repos/%s/%s" % (USER, PROJECT)
url = base_url + "/actions/artifacts"
res = requests.get(
url=url, headers={"Authorization": "token %s" % TOKEN}, timeout=TIMEOUT
)
res.raise_for_status()
data = json.loads(res.content)
return data
def download_zip(url):
print("downloading: " + url)
res = requests.get(
url=url, headers={"Authorization": "token %s" % TOKEN}, timeout=TIMEOUT
)
res.raise_for_status()
totbytes = 0
with open(OUTFILE, 'wb') as f:
for chunk in res.iter_content(chunk_size=16384):
f.write(chunk)
totbytes += len(chunk)
print("got %s, size %s)" % (OUTFILE, bytes2human(totbytes)))
def rename_win27_wheels():
# See: https://github.com/giampaolo/psutil/issues/810
src = 'dist/psutil-%s-cp27-cp27m-win32.whl' % PROJECT_VERSION
dst = 'dist/psutil-%s-cp27-none-win32.whl' % PROJECT_VERSION
if os.path.exists(src):
print("rename: %s\n %s" % (src, dst))
os.rename(src, dst)
src = 'dist/psutil-%s-cp27-cp27m-win_amd64.whl' % PROJECT_VERSION
dst = 'dist/psutil-%s-cp27-none-win_amd64.whl' % PROJECT_VERSION
if os.path.exists(src):
print("rename: %s\n %s" % (src, dst))
os.rename(src, dst)
def run():
data = get_artifacts()
download_zip(data['artifacts'][0]['archive_download_url'])
os.makedirs('dist', exist_ok=True)
with zipfile.ZipFile(OUTFILE, 'r') as zf:
zf.extractall('dist')
rename_win27_wheels()
def main():
global TOKEN
parser = argparse.ArgumentParser(description='GitHub wheels downloader')
parser.add_argument('--token')
parser.add_argument('--tokenfile')
args = parser.parse_args()
if args.tokenfile:
with open(os.path.expanduser(args.tokenfile)) as f:
TOKEN = f.read().strip()
elif args.token:
TOKEN = args.token
else:
return sys.exit('specify --token or --tokenfile args')
try:
run()
finally:
safe_rmpath(OUTFILE)
if __name__ == '__main__':
main()
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| README | File | 105 B | 0644 |
|
| appveyor_run_with_compiler.cmd | File | 3.29 KB | 0644 |
|
| bench_oneshot.py | File | 3.26 KB | 0755 |
|
| bench_oneshot_2.py | File | 1.06 KB | 0755 |
|
| check_broken_links.py | File | 7.85 KB | 0755 |
|
| clinter.py | File | 2.26 KB | 0755 |
|
| convert_readme.py | File | 1.46 KB | 0755 |
|
| download_wheels_appveyor.py | File | 3.49 KB | 0755 |
|
| download_wheels_github.py | File | 2.95 KB | 0755 |
|
| generate_manifest.py | File | 884 B | 0755 |
|
| git_pre_commit.py | File | 4.54 KB | 0755 |
|
| print_access_denied.py | File | 3.21 KB | 0755 |
|
| print_announce.py | File | 3.22 KB | 0755 |
|
| print_api_speed.py | File | 6.56 KB | 0755 |
|
| print_dist.py | File | 3.58 KB | 0755 |
|
| print_downloads.py | File | 3.98 KB | 0755 |
|
| print_hashes.py | File | 1.1 KB | 0755 |
|
| print_timeline.py | File | 1.39 KB | 0755 |
|
| purge_installation.py | File | 1 KB | 0755 |
|
| winmake.py | File | 17.05 KB | 0755 |
|