5 Commits

Author SHA1 Message Date
Dima YaFlay
e4729e9cdf Update User.py
Profile больше не работает
2023-10-25 08:47:23 +03:00
Teleport
21ee8e1fa5 add __version__ to setup.py
v1.5.2
2023-07-18 02:27:39 +03:00
Teleport
0eebcca218 fix unreasonable spworlds api DDOS error
v1.5.2
2023-07-18 02:23:11 +03:00
Teleport
352ca0f032 fix broken package
v1.5.1
2023-07-13 16:53:52 +03:00
Teleport
dda2abd661 Fix README.md, change author email 2023-05-09 13:35:07 +03:00
8 changed files with 19 additions and 16 deletions

3
.gitignore vendored
View File

@@ -157,3 +157,6 @@ upload.bat
pypi.md pypi.md
_build _build
dotenv.sh
publish.sh

3
MANIFEST.in Normal file
View File

@@ -0,0 +1,3 @@
include LICENSE
include requirements.txt
include README.md

View File

@@ -30,5 +30,5 @@ print(api.check_access('437610383310716930'))
## Links ## Links
- [PyPi](https://pypi.org/project/Py-SPW) - [PyPi](https://pypi.org/project/Py-SPW)
- [Documentation](https://pyspw.xstl.ru/latest) - [Documentation](https://pyspw.xstl.ru/en/latest/)
- [API](https://github.com/sp-worlds/api-docs) - [API](https://github.com/sp-worlds/api-docs)

View File

@@ -57,7 +57,7 @@ class _SkinPart:
class Skin: class Skin:
__visage_surgeplay_url = 'https://visage.surgeplay.com/' __visage_surgeplay_url = 'https://visage.surgeplay.com/'
def __init__(self, profile: UserProfile): def __init__(self, profile: str):
self._profile = profile self._profile = profile
self._variant = SkinVariant(profile.skin_variant) self._variant = SkinVariant(profile.skin_variant)
@@ -98,7 +98,7 @@ class User:
self._uuid = mapi.get_uuid(nickname) self._uuid = mapi.get_uuid(nickname)
if self._uuid is None: if self._uuid is None:
raise MojangAccountNotFound(self._nickname) raise MojangAccountNotFound(self._nickname)
self._profile = mapi.get_profile(self._uuid)
@property @property
def nickname(self) -> str: def nickname(self) -> str:
@@ -108,12 +108,8 @@ class User:
def uuid(self) -> str: def uuid(self) -> str:
return self._uuid return self._uuid
@property
def profile(self) -> UserProfile:
return self._profile
def get_skin(self) -> Skin: def get_skin(self) -> Skin:
""" """
Получения объекта скина пользователя. Получения объекта скина пользователя.
""" """
return Skin(self._profile) return Skin(self._uuid)

View File

@@ -1,3 +1,3 @@
from .api import * from .api import *
__version__ = '1.5.0' __version__ = '1.5.2'

View File

@@ -1,3 +1,4 @@
import json
import platform import platform
from base64 import b64encode from base64 import b64encode
from dataclasses import dataclass from dataclasses import dataclass
@@ -57,7 +58,10 @@ class SpApi:
except rq.exceptions.ConnectionError as error: except rq.exceptions.ConnectionError as error:
raise err.SpwApiError(error) raise err.SpwApiError(error)
if response.headers.get('Content-Type') != 'application/json': try:
response.json()
except json.JSONDecodeError:
raise err.SpwApiDDOS() raise err.SpwApiDDOS()
if response.ok or response.status_code in ignore_codes: if response.ok or response.status_code in ignore_codes:

View File

@@ -1,3 +0,0 @@
[egg_info]
tag_build =
tag_date = 0

View File

@@ -1,8 +1,6 @@
from os import path from os import path
from setuptools import setup from setuptools import setup
from pyspw import __version__
this_directory = path.abspath(path.dirname(__file__)) this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
@@ -10,6 +8,8 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
requirements = open('requirements.txt', 'r').read().split('\n') requirements = open('requirements.txt', 'r').read().split('\n')
exec(sorted([el if el.startswith('__version__') else 'Z' for el in open('./pyspw/__init__.py', 'r').read().split('\n')], reverse=True)[0])
setup( setup(
name='Py-SPW', name='Py-SPW',
version=__version__, version=__version__,
@@ -17,7 +17,7 @@ setup(
url='https://github.com/teleportx/Py-SPW', url='https://github.com/teleportx/Py-SPW',
license='MIT License', license='MIT License',
author='Stepan Khozhempo', author='Stepan Khozhempo',
author_email='stepan@khoz.ru', author_email='stepan@xstl.ru',
description='Python library for spworlds API', description='Python library for spworlds API',
long_description=description_md, long_description=description_md,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',