Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1db94ca9eb | ||
|
|
63ee509067 | ||
|
|
4ecafef192 | ||
|
|
d44199c4cc | ||
|
|
056ebce615 | ||
|
|
b00b2b76cd | ||
|
|
da86771e3c | ||
|
|
479a02b95f |
19
.readthedocs.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: 2
|
||||
formats: []
|
||||
|
||||
build:
|
||||
image: latest
|
||||
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
fail_on_warning: false
|
||||
builder: html
|
||||
|
||||
python:
|
||||
version: "3.8"
|
||||
install:
|
||||
- method: pip
|
||||
path: .
|
||||
extra_requirements:
|
||||
- docs
|
||||
- requirements: docs/requirements.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
.. image:: https://i.imgur.com/melhWhU.png
|
||||
.. image:: https://raw.githubusercontent.com/deesiigneer/pyspapi/main/assets/repo-banner.png
|
||||
:alt: pyspapi
|
||||
|
||||
.. image:: https://img.shields.io/discord/850091193190973472?color=5865F2&label=discord
|
||||
|
||||
BIN
assets/logo.png
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 30 KiB |
BIN
assets/pyspapi_repo_banner.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
assets/repo-banner.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
20
docs/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
BIN
docs/_static/404.png
vendored
Normal file
|
After Width: | Height: | Size: 29 KiB |
19
docs/_static/custom.css
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/* Background of stable should be green */
|
||||
#version_switcher a[data-version-name*="stable"] {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#version_switcher a[data-version-name*="stable"] span {
|
||||
color: var(--pst-color-success);
|
||||
}
|
||||
|
||||
#version_switcher a[data-version-name*="stable"] span:before {
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background-color: var(--pst-color-success);
|
||||
opacity: 0.1;
|
||||
}
|
||||
12
docs/_static/switcher.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"name": "latest",
|
||||
"version": "latest",
|
||||
"url": "https://pyspapi.readthedocs.io/en/latest/"
|
||||
},
|
||||
{
|
||||
"name": "stable",
|
||||
"version": "stable",
|
||||
"url": "https://pyspapi.readthedocs.io/en/stable/"
|
||||
}
|
||||
]
|
||||
74
docs/api.rst
Normal file
@@ -0,0 +1,74 @@
|
||||
.. py:currentmodule:: pyspapi
|
||||
|
||||
API Reference
|
||||
===============
|
||||
|
||||
The following section outlines the API of pyspapi.
|
||||
|
||||
Version Info
|
||||
---------------------
|
||||
|
||||
There are two main ways to query version information.
|
||||
|
||||
.. data:: version_info
|
||||
|
||||
A named tuple that is similar to :obj:`py:sys.version_info`.
|
||||
|
||||
Just like :obj:`py:sys.version_info` the valid values for ``releaselevel`` are
|
||||
'alpha', 'beta', 'candidate' and 'final'.
|
||||
|
||||
.. data:: __version__
|
||||
|
||||
A string representation of the version.
|
||||
|
||||
``pyspapi``
|
||||
-----------
|
||||
|
||||
``SPAPI``
|
||||
~~~~~
|
||||
.. autoclass:: SPAPI
|
||||
:members:
|
||||
|
||||
.. automethod:: SPAPI.event()
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.check_user_access
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.get_user
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.get_users
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.payment
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.transaction
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.webhook_verify
|
||||
:decorator:
|
||||
|
||||
MojangAPI
|
||||
~~~~~
|
||||
.. autoclass:: MojangAPI
|
||||
:members:
|
||||
|
||||
.. automethod:: SPAPI.event()
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.get_name_history
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.get_profile
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.get_username
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.get_uuid
|
||||
:decorator:
|
||||
|
||||
.. automethod:: SPAPI.get_uuids
|
||||
:decorator:
|
||||
76
docs/conf.py
Normal file
@@ -0,0 +1,76 @@
|
||||
from re import search, MULTILINE
|
||||
|
||||
project = 'pyspapi'
|
||||
copyright = '2022, deesiigneer'
|
||||
author = 'deesiigneer'
|
||||
with open("../pyspapi/__init__.py") as f:
|
||||
match = search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), MULTILINE)
|
||||
|
||||
if not match or match.group(1) is None:
|
||||
raise RuntimeError("The version could not be resolved")
|
||||
|
||||
version = match.group(1)
|
||||
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
|
||||
# -- General configuration
|
||||
|
||||
extensions = [
|
||||
'sphinx.ext.duration',
|
||||
'sphinx.ext.doctest',
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.autosummary',
|
||||
'sphinx.ext.intersphinx',
|
||||
]
|
||||
|
||||
intersphinx_mapping = {
|
||||
'python': ('https://docs.python.org/3/', None),
|
||||
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
|
||||
}
|
||||
intersphinx_disabled_domains = ['std']
|
||||
language = None
|
||||
locale_dirs = ["locale/"]
|
||||
exclude_patterns = []
|
||||
html_static_path = ["_static"]
|
||||
html_theme = "pydata_sphinx_theme"
|
||||
html_logo = "./images/logo.png"
|
||||
html_favicon = "./images/logo.ico"
|
||||
html_theme_options = {
|
||||
"external_links": [
|
||||
{
|
||||
"url": "https://github.com/deesiigneer/pyspapi/releases",
|
||||
"name": "Changelog",
|
||||
}
|
||||
],
|
||||
"icon_links": [
|
||||
{
|
||||
"name": "GitHub",
|
||||
"url": "https://github.com/deesiigneer/pyspapi",
|
||||
"icon": "fab fa-brands fa-github",
|
||||
"type": "fontawesome"
|
||||
},
|
||||
{
|
||||
"name": "Discord",
|
||||
"url": "https://discord.gg/VbyHaKRAaN",
|
||||
"icon": "fab fa-brands fa-discord",
|
||||
"type": "fontawesome"
|
||||
},
|
||||
{
|
||||
"name": "PyPi",
|
||||
"url": "https://pypi.org/project/pyspapi/",
|
||||
"icon": "fab fa-brands fa-python",
|
||||
"type": "fontawesome"
|
||||
}
|
||||
],
|
||||
"header_links_before_dropdown": 4,
|
||||
"show_toc_level": 1,
|
||||
"navbar_start": ["navbar-logo", "version-switcher"],
|
||||
"switcher": {
|
||||
"json_url": "https://pyspapi.readthedocs.io/en/latest/_static/switcher.json",
|
||||
"version_match": "latest"
|
||||
},
|
||||
"navigation_with_keys": True,
|
||||
}
|
||||
html_css_files = ["custom.css"]
|
||||
|
||||
BIN
docs/images/logo.ico
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
docs/images/logo.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
35
docs/index.rst
Normal file
@@ -0,0 +1,35 @@
|
||||
:theme_html_remove_secondary_sidebar:
|
||||
|
||||
Welcome to pyspapi
|
||||
===================
|
||||
|
||||
API wrapper for SP servers written in Python.
|
||||
|
||||
Getting started
|
||||
---------------
|
||||
|
||||
Is this your first time using the library? This is the place to get started!
|
||||
|
||||
- **First steps:** :ref:`Quickstart <quickstart>`
|
||||
- **Examples:** Many examples are available in the `examples directory <https://github.com/deesiigneer/pyspapi/tree/main/examples/>`_.
|
||||
|
||||
Getting help
|
||||
------------
|
||||
|
||||
If you're having trouble with something, these resources might help.
|
||||
|
||||
- Ask questions in `Discord <https://discord.gg/VbyHaKRAaN>`_ server.
|
||||
- If you're looking for something specific, try the :ref:`searching <search>`.
|
||||
- Report bugs in the `issue tracker <https://github.com/deesiigneer/pyspapi/issues>`_.
|
||||
- Ask in `GitHub discussions page <https://github.com/deesiigneer/pyspapi/discussions>`_.
|
||||
|
||||
Manuals
|
||||
-------
|
||||
|
||||
These pages go into great detail about everything the API can do.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
api
|
||||
quickstart
|
||||
35
docs/make.bat
Normal file
@@ -0,0 +1,35 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
||||
28
docs/quickstart.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
:orphan:
|
||||
|
||||
.. _quickstart:
|
||||
|
||||
.. currentmodule:: pyspapi
|
||||
|
||||
Quickstart
|
||||
==========
|
||||
|
||||
This page gives a brief introduction to the library.
|
||||
|
||||
Checking balance
|
||||
-------------
|
||||
|
||||
Let's output the amount of money remaining in the card account to the console.
|
||||
|
||||
It looks something like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import pyspapi
|
||||
|
||||
print(pyspapi.SPAPI(card_id='card_id', token='token').balance)
|
||||
|
||||
Make sure not to name it ``pyspapi`` as that'll conflict with the library.
|
||||
|
||||
|
||||
You can find more examples in the `examples directory <https://github.com/deesiigneer/pyspapi/tree/main/examples/>`_ on GitHub.
|
||||
1
docs/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
pydata_sphinx_theme
|
||||
@@ -1,3 +1,3 @@
|
||||
from .api import *
|
||||
|
||||
__version__ = "2.1.1"
|
||||
__version__ = "2.1.2"
|
||||
|
||||
@@ -140,7 +140,7 @@ class SPAPI:
|
||||
'amount': amount,
|
||||
'comment': comment
|
||||
}
|
||||
response = self.__make_request('POST', 'transactions', data=body)
|
||||
response = self.__make_request('POST', '/transactions', data=body)
|
||||
if not response.ok:
|
||||
return None
|
||||
try:
|
||||
|
||||