Merge pull request #1 from gechandesu/setup

Setup
This commit is contained in:
1ch 2022-04-08 21:43:22 +03:00 committed by GitHub
commit 773f9caed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 3 deletions

View File

@ -5,6 +5,18 @@ twvdscli
# Установка
## С помощью setup.py
Установка:
```sh
python setup.py install
```
Затем управлять пакетом можно как обычно через pip.
## Ручная установка
Потребуются пакеты typer, prettytable, requests. Ставим их из файла:
```commandline

33
setup.py Normal file
View File

@ -0,0 +1,33 @@
from setuptools import setup
with open("README.md", "r") as long_descr:
long_description = long_descr.read()
setup(
name = 'twvdscli',
version = '1.0',
author = 'L0sted',
description = 'Servers and services manage tool for Timeweb Cloud',
long_description = long_description,
long_description_content_type = "text/markdown",
url = 'https://github.com/L0sted/twvdscli',
classifiers = [
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: The Unlicense (Unlicense)",
"Operating System :: OS Independent",
],
python_requires = '>=3.6',
py_modules = ['twvdscli'],
install_requires = [
'click==7.1.1'
'typer==0.4.0',
'prettytable==3.2.0',
'wcwidth==0.2.5'
],
entry_points = {
'console_scripts': [
'twvdscli = twvdscli:main'
]
}
)

View File

@ -291,6 +291,7 @@ def auth(based):
json=dict(refresh_token="string"),
headers=headers
)
if not result.ok:
return None
else:
@ -322,11 +323,13 @@ def get_api_key():
result = auth(based)
return result
if __name__ == '__main__':
def main():
apikey = get_api_key()
if apikey is None:
print(typer.style("Auth Error", fg=typer.colors.RED))
sys.exit(1)
reqHeader = {"Authorization": "Bearer " + apikey}
app()
if __name__ == '__main__':
main()