mirror of
https://github.com/deesiigneer/pyspapi.git
synced 2026-04-20 12:35:26 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4ddd1fd93 | ||
|
|
5449659566 | ||
|
|
85ef993011 | ||
|
|
8e6664bc51 | ||
|
|
0d46f0a126 | ||
|
|
f5484d3900 | ||
|
|
1c35daf142 | ||
|
|
91ed017ac6 | ||
|
|
1806ba7929 | ||
|
|
f4623e9204 | ||
|
|
906060a4b7 | ||
|
|
6bf342a9f1 | ||
|
|
a6cbf2adcc | ||
|
|
59d43736c0 | ||
|
|
9429c443c4 |
25
.github/workflows/python-publish.yml
vendored
25
.github/workflows/python-publish.yml
vendored
@@ -12,28 +12,27 @@ on:
|
|||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
regular:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [ 3.9 ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install build
|
pip install twine
|
||||||
- name: Build package
|
- name: Compile package
|
||||||
run: python -m build
|
run: |
|
||||||
|
python3 setup.py sdist
|
||||||
- name: Publish package
|
- name: Publish package
|
||||||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
user: __token__
|
user: __token__
|
||||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
|||||||
40
README.rst
40
README.rst
@@ -18,46 +18,44 @@
|
|||||||
:alt: pyspapi documentation
|
:alt: pyspapi documentation
|
||||||
|
|
||||||
pyspapi
|
pyspapi
|
||||||
=======
|
========
|
||||||
|
|
||||||
`API <https://github.com/sp-worlds/api-docs>`_ обертка для серверов СП, написанная на Python.
|
`API <https://github.com/sp-worlds/api-docs>`_ wrapper for SP servers written in Python.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
-------------
|
||||||
Установка
|
**Requires Python 3.9 or higher**
|
||||||
==========
|
|
||||||
**Требуется Python 3.7 или выше**
|
|
||||||
|
|
||||||
*Windows*
|
*Windows*
|
||||||
|
|
||||||
|
|
||||||
.. code:: sh
|
.. code:: sh
|
||||||
|
|
||||||
pip install pyspapi
|
pip install pyspapi
|
||||||
|
|
||||||
*Linux*
|
*Linux/macOS*
|
||||||
|
|
||||||
.. code:: sh
|
.. code:: sh
|
||||||
|
|
||||||
sudo apt pip3 install pyspapi
|
sudo apt pip3 install pyspapi
|
||||||
|
|
||||||
Быстрый пример
|
Quick example
|
||||||
=========
|
--------------
|
||||||
|
|
||||||
Проверка баланса
|
Checking the balance
|
||||||
~~~~
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
.. code:: py
|
||||||
.. code:: python
|
|
||||||
|
|
||||||
import pyspapi
|
import pyspapi
|
||||||
|
|
||||||
print(pyspapi.SPAPI(card_id='card_id', token='token').balance)
|
print(pyspapi.SPAPI(card_id='card_id', token='token').balance)
|
||||||
|
|
||||||
|
More examples can be found in the `examples <https://github.com/deesiigneer/pyspapi/tree/main/examples>`_
|
||||||
|
|
||||||
Больше примеров можно найти в каталоге `examples <https://github.com/deesiigneer/pyspapi/tree/main/examples>`_
|
Links
|
||||||
|
------
|
||||||
|
|
||||||
Ссылки
|
- `Discord server <https://discord.gg/VbyHaKRAaN>`_
|
||||||
=======
|
- `pyspapi documentation <https://pyspapi.readthedocs.io/>`_
|
||||||
* `Discord сервер <https://discord.gg/VbyHaKRAaN>`_
|
- `PyPi <https://pypi.org/project/pyspapi/>`_
|
||||||
* `Документация pyspapi <https://pyspapi.readthedocs.io/>`_
|
- `API documentation for SP sites <https://github.com/sp-worlds/api-docs>`_
|
||||||
* `PyPi <https://pypi.org/project/pyspapi/>`_
|
|
||||||
* `Документация API сайтов СП <https://github.com/sp-worlds/api-docs>`_
|
|
||||||
|
|||||||
BIN
assets/logo.png
Normal file
BIN
assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -1,3 +1,3 @@
|
|||||||
import pyspapi
|
import pyspapi
|
||||||
|
|
||||||
mojangapi = pyspapi.MojangAPI.get_name_history(uuid='63ed47877aa3470fbfc46c5356c3d797')
|
print(pyspapi.MojangAPI.get_name_history(uuid='63ed47877aa3470fbfc46c5356c3d797'))
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
import pyspapi
|
import pyspapi
|
||||||
|
|
||||||
mojangapi = pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797')
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797'))
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').timestamp)
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').id)
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').name)
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').is_legacy_profile)
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').cape_url)
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').skin_url)
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').skin_model)
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').skin)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import pyspapi
|
import pyspapi
|
||||||
|
|
||||||
mojangapi = pyspapi.MojangAPI.get_username(uuid='63ed47877aa3470fbfc46c5356c3d797')
|
print(pyspapi.MojangAPI.get_username(uuid='63ed47877aa3470fbfc46c5356c3d797'))
|
||||||
|
|||||||
5
examples/mojangapi/get_uuid and get_uuids.py
Normal file
5
examples/mojangapi/get_uuid and get_uuids.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import pyspapi
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_uuid(username='deesiigneer'))
|
||||||
|
|
||||||
|
print(pyspapi.MojangAPI.get_uuids(['deesiigneer', '5opka', 'OsterMiner']))
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import pyspapi
|
|
||||||
|
|
||||||
mojangapi = pyspapi.MojangAPI.get_uuid(username='deesiigneer')
|
|
||||||
@@ -4,4 +4,8 @@ spapi = pyspapi.SPAPI(card_id='card_id', token='token')
|
|||||||
|
|
||||||
print(spapi.get_user(262632724928397312))
|
print(spapi.get_user(262632724928397312))
|
||||||
|
|
||||||
|
print(spapi.get_user(262632724928397312).username)
|
||||||
|
|
||||||
|
print(spapi.get_user(262632724928397312).access)
|
||||||
|
|
||||||
print(spapi.get_users([262632724928397312, 264329096920563714]))
|
print(spapi.get_users([262632724928397312, 264329096920563714]))
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
from .api import *
|
from .api import *
|
||||||
|
|
||||||
__version__ = "2.0.0"
|
__version__ = "2.1.0"
|
||||||
|
|||||||
@@ -197,24 +197,23 @@ class MojangAPI:
|
|||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# TODO: check, why always errorMessage return invalid
|
@classmethod
|
||||||
# @classmethod
|
def get_uuids(cls, names: List[str]) -> Dict[str, str]:
|
||||||
# def get_uuids(cls, names: List[str]) -> Dict[str, str]:
|
"""
|
||||||
# """
|
Получить UUID's игроков Minecraft.\n
|
||||||
# Получить UUID's игроков Minecraft.\n
|
:param names: List[str] Список с никнеймами игроков Minecraft.
|
||||||
# :param names: List[str] Список с никнеймами игроков Minecraft.
|
:return: Dict[str, str] UUID игрока Minecraft.
|
||||||
# :return: Dict[str, str] UUID игрока Minecraft.
|
|
||||||
#
|
"""
|
||||||
# """
|
if len(names) > 10:
|
||||||
# if len(names) > 10:
|
names = names[:10]
|
||||||
# names = names[:10]
|
response = cls.__make_request('API', 'POST', '/profiles/minecraft', data=names).json()
|
||||||
# response = cls.__make_request('API', 'POST', '/profiles/minecraft', data=names).json()
|
if not isinstance(response, list):
|
||||||
# if not isinstance(response, list):
|
if response.get('error'):
|
||||||
# if response.get('error'):
|
raise ValueError(response['errorMessage'])
|
||||||
# raise ValueError(response['errorMessage'])
|
else:
|
||||||
# else:
|
raise _Error(response)
|
||||||
# raise Error(response)
|
return {uuids['name']: uuids['id'] for uuids in response}
|
||||||
# return {uuids['name']: uuids['id'] for uuids in response}
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_username(cls, uuid: str) -> Optional[str]:
|
def get_username(cls, uuid: str) -> Optional[str]:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
requests=2.28.1
|
requests==2.28.1
|
||||||
6
setup.py
6
setup.py
@@ -29,9 +29,13 @@ setup(
|
|||||||
name='pyspapi',
|
name='pyspapi',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
author='deesiigneer',
|
author='deesiigneer',
|
||||||
author_email='xdeesiigneerx@gmail.com',
|
|
||||||
version=version,
|
version=version,
|
||||||
url='https://github.com/deesiigneer/pyspapi',
|
url='https://github.com/deesiigneer/pyspapi',
|
||||||
|
project_urls={
|
||||||
|
"Documentation": "https://pyspapi.readthedocs.io/ru/latest/",
|
||||||
|
"GitHub": "https://github.com/deesiigneer/pyspapi",
|
||||||
|
"Discord": "https://discord.com/invite/VbyHaKRAaN"
|
||||||
|
},
|
||||||
description='API wrapper for SP servers written in Python',
|
description='API wrapper for SP servers written in Python',
|
||||||
long_description=readme,
|
long_description=readme,
|
||||||
long_description_content_type='text/x-rst',
|
long_description_content_type='text/x-rst',
|
||||||
|
|||||||
Reference in New Issue
Block a user