mirror of
https://github.com/deesiigneer/pyspapi.git
synced 2026-04-20 12:35:26 +00:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c905ea097 | ||
|
|
83d9663da3 | ||
|
|
93760d2d87 | ||
|
|
108d30ebac | ||
|
|
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:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
||||
regular:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ 3.9 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build
|
||||
- name: Build package
|
||||
run: python -m build
|
||||
pip install twine
|
||||
- name: Compile package
|
||||
run: |
|
||||
python3 setup.py sdist
|
||||
- name: Publish package
|
||||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
|
||||
3
MANIFEST.in
Normal file
3
MANIFEST.in
Normal file
@@ -0,0 +1,3 @@
|
||||
include README.rst
|
||||
include LICENSE
|
||||
include requirements.txt
|
||||
44
README.rst
44
README.rst
@@ -18,46 +18,44 @@
|
||||
:alt: pyspapi documentation
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
Установка
|
||||
==========
|
||||
**Требуется Python 3.7 или выше**
|
||||
Installation
|
||||
-------------
|
||||
**Requires Python 3.8 or higher**
|
||||
|
||||
*Windows*
|
||||
|
||||
|
||||
.. code:: sh
|
||||
|
||||
pip install pyspapi
|
||||
|
||||
*Linux*
|
||||
|
||||
*Linux/macOS*
|
||||
|
||||
.. code:: sh
|
||||
|
||||
sudo apt pip3 install pyspapi
|
||||
|
||||
Быстрый пример
|
||||
=========
|
||||
Quick example
|
||||
--------------
|
||||
|
||||
Проверка баланса
|
||||
~~~~
|
||||
|
||||
.. code:: python
|
||||
Checking the balance
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
.. code:: py
|
||||
|
||||
import pyspapi
|
||||
|
||||
|
||||
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 сервер <https://discord.gg/VbyHaKRAaN>`_
|
||||
* `Документация pyspapi <https://pyspapi.readthedocs.io/>`_
|
||||
* `PyPi <https://pypi.org/project/pyspapi/>`_
|
||||
* `Документация API сайтов СП <https://github.com/sp-worlds/api-docs>`_
|
||||
- `Discord server <https://discord.gg/VbyHaKRAaN>`_
|
||||
- `pyspapi documentation <https://pyspapi.readthedocs.io/>`_
|
||||
- `PyPi <https://pypi.org/project/pyspapi/>`_
|
||||
- `API documentation for SP sites <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
|
||||
|
||||
mojangapi = pyspapi.MojangAPI.get_name_history(uuid='63ed47877aa3470fbfc46c5356c3d797')
|
||||
print(pyspapi.MojangAPI.get_name_history(uuid='63ed47877aa3470fbfc46c5356c3d797'))
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
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
|
||||
|
||||
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')
|
||||
@@ -1,5 +1,5 @@
|
||||
import pyspapi
|
||||
|
||||
spapi = pyspapi.SPAPI(card_id='card_id', token='token').balance
|
||||
spapi = pyspapi.SPAPI(card_id='card_id', token='token')
|
||||
|
||||
print(spapi.check_users_access([262632724928397312, 264329096920563714]))
|
||||
@@ -4,4 +4,8 @@ spapi = pyspapi.SPAPI(card_id='card_id', token='token')
|
||||
|
||||
print(spapi.get_user(262632724928397312))
|
||||
|
||||
print(spapi.get_user(262632724928397312).username)
|
||||
|
||||
print(spapi.get_user(262632724928397312).access)
|
||||
|
||||
print(spapi.get_users([262632724928397312, 264329096920563714]))
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from .api import *
|
||||
|
||||
__version__ = "2.0.0"
|
||||
__version__ = "2.1.1"
|
||||
|
||||
@@ -197,24 +197,23 @@ class MojangAPI:
|
||||
except json.decoder.JSONDecodeError:
|
||||
return None
|
||||
|
||||
# TODO: check, why always errorMessage return invalid
|
||||
# @classmethod
|
||||
# def get_uuids(cls, names: List[str]) -> Dict[str, str]:
|
||||
# """
|
||||
# Получить UUID's игроков Minecraft.\n
|
||||
# :param names: List[str] Список с никнеймами игроков Minecraft.
|
||||
# :return: Dict[str, str] UUID игрока Minecraft.
|
||||
#
|
||||
# """
|
||||
# if len(names) > 10:
|
||||
# names = names[:10]
|
||||
# response = cls.__make_request('API', 'POST', '/profiles/minecraft', data=names).json()
|
||||
# if not isinstance(response, list):
|
||||
# if response.get('error'):
|
||||
# raise ValueError(response['errorMessage'])
|
||||
# else:
|
||||
# raise Error(response)
|
||||
# return {uuids['name']: uuids['id'] for uuids in response}
|
||||
@classmethod
|
||||
def get_uuids(cls, names: List[str]) -> Dict[str, str]:
|
||||
"""
|
||||
Получить UUID's игроков Minecraft.\n
|
||||
:param names: List[str] Список с никнеймами игроков Minecraft.
|
||||
:return: Dict[str, str] UUID игрока Minecraft.
|
||||
|
||||
"""
|
||||
if len(names) > 10:
|
||||
names = names[:10]
|
||||
response = cls.__make_request('API', 'POST', '/profiles/minecraft', data=names).json()
|
||||
if not isinstance(response, list):
|
||||
if response.get('error'):
|
||||
raise ValueError(response['errorMessage'])
|
||||
else:
|
||||
raise _Error(response)
|
||||
return {uuids['name']: uuids['id'] for uuids in response}
|
||||
|
||||
@classmethod
|
||||
def get_username(cls, uuid: str) -> Optional[str]:
|
||||
|
||||
@@ -1 +1 @@
|
||||
requests=2.28.1
|
||||
requests==2.28.1
|
||||
8
setup.py
8
setup.py
@@ -29,14 +29,18 @@ setup(
|
||||
name='pyspapi',
|
||||
license='MIT',
|
||||
author='deesiigneer',
|
||||
author_email='xdeesiigneerx@gmail.com',
|
||||
version=version,
|
||||
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',
|
||||
long_description=readme,
|
||||
long_description_content_type='text/x-rst',
|
||||
packages=packages,
|
||||
include_package_data=True,
|
||||
install_requires=requirements,
|
||||
python_requires='>=3.9.0',
|
||||
python_requires='>=3.8.0',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user