A full Python wrapper of Mojang's API and Authentication API.
Project description
mojang-api
==========
|python-versions| |implementation| |license|
A full Python wrapper of Mojang's `API`_ and `Authentication API`_.
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/mojang-api.svg
:alt: Python Versions
:scale: 100%
:target: https://pypi.python.org/project/mojang-api-3/
.. |implementation| image:: https://img.shields.io/pypi/implementation/mojang-api.svg
:alt: Implementation
:scale: 100%
:target: https://pypi.python.org/project/mojang-api-3/
.. |license| image:: https://img.shields.io/github/license/SynchronousX/mojang-api.svg
:alt: License
:scale: 100%
:target: LICENSE
.. _API: http://wiki.vg/Mojang_API
.. _Authentication API: http://wiki.vg/Authentication
version:3.0.4
Installation
------------
``$ pip install mojang-api-3``
Usage
------------
Using this API will often return dicts:
1. If response is empty, dict will contain response object.
Response['response'] contains Response object (Get status code via Response['response'].status_code)
2. If response contains data, dict will contain response object and data
Response['response'] contains Response object (Get status code via Response['response'].status_code)
Response['data'] contains response data
**Checking status of Mojang servers:**
``$ from mojang_api import get_status``
``$ response = get_status() ``
Response will be dict containing a Requests Response object and Response Data.
Response['response'] contains Response object (Get status code via Response['response'].status_code)
Response['data'] contains List of dicts with key of the servername and value of it's status
**Getting UUID from player name:**
``$ from mojang_api import Player``
``$ player = Player(username=myUsername)``
``$ player.username``
**Authenticating player:**
``$ from mojang_api import Player``
``$ player = Player(username=myUsername)``
``$ player.authenticate(email_address_or_legacy_username, password)``
Player authenticate will populate it's Access and Client Tokens, Username and UUID of the player.
**Check if player is authenticated with:**
``$ player.is_authenticated``
**Creating Player with access and client tokens:**
``$ from mojang_api import Player``
``$ player=Player(username=Last_saved_username)``
``$ player.tokens = (access_token, client_token)``
Once player.tokens is set, it will validate and refresh tokens and save the current Username, UUID, and refreshed Access and Client Tokens
**Signing out Player:**
``$ from mojang_api import Player``
``$ player = Player(username=myUsername)``
``$ player.authenticate(email_address_or_legacy_username, password)``
``$ player.signout()``
player.signout() will invalidate the tokens that are saved, which has the same effect as logging out.
==========
|python-versions| |implementation| |license|
A full Python wrapper of Mojang's `API`_ and `Authentication API`_.
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/mojang-api.svg
:alt: Python Versions
:scale: 100%
:target: https://pypi.python.org/project/mojang-api-3/
.. |implementation| image:: https://img.shields.io/pypi/implementation/mojang-api.svg
:alt: Implementation
:scale: 100%
:target: https://pypi.python.org/project/mojang-api-3/
.. |license| image:: https://img.shields.io/github/license/SynchronousX/mojang-api.svg
:alt: License
:scale: 100%
:target: LICENSE
.. _API: http://wiki.vg/Mojang_API
.. _Authentication API: http://wiki.vg/Authentication
version:3.0.4
Installation
------------
``$ pip install mojang-api-3``
Usage
------------
Using this API will often return dicts:
1. If response is empty, dict will contain response object.
Response['response'] contains Response object (Get status code via Response['response'].status_code)
2. If response contains data, dict will contain response object and data
Response['response'] contains Response object (Get status code via Response['response'].status_code)
Response['data'] contains response data
**Checking status of Mojang servers:**
``$ from mojang_api import get_status``
``$ response = get_status() ``
Response will be dict containing a Requests Response object and Response Data.
Response['response'] contains Response object (Get status code via Response['response'].status_code)
Response['data'] contains List of dicts with key of the servername and value of it's status
**Getting UUID from player name:**
``$ from mojang_api import Player``
``$ player = Player(username=myUsername)``
``$ player.username``
**Authenticating player:**
``$ from mojang_api import Player``
``$ player = Player(username=myUsername)``
``$ player.authenticate(email_address_or_legacy_username, password)``
Player authenticate will populate it's Access and Client Tokens, Username and UUID of the player.
**Check if player is authenticated with:**
``$ player.is_authenticated``
**Creating Player with access and client tokens:**
``$ from mojang_api import Player``
``$ player=Player(username=Last_saved_username)``
``$ player.tokens = (access_token, client_token)``
Once player.tokens is set, it will validate and refresh tokens and save the current Username, UUID, and refreshed Access and Client Tokens
**Signing out Player:**
``$ from mojang_api import Player``
``$ player = Player(username=myUsername)``
``$ player.authenticate(email_address_or_legacy_username, password)``
``$ player.signout()``
player.signout() will invalidate the tokens that are saved, which has the same effect as logging out.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mojang-api-3-3.0.4.tar.gz
(6.7 kB
view details)
Built Distribution
File details
Details for the file mojang-api-3-3.0.4.tar.gz
.
File metadata
- Download URL: mojang-api-3-3.0.4.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7da5e42ed63df636f00151158d6e91f9444cfd9057970bf2482246997d4e032 |
|
MD5 | aea0d21f873bd3324dffc11684b9df29 |
|
BLAKE2b-256 | c8a2a2eff8967ad753105f4265d39579bef1da44260101886cca36391e1c43dd |
File details
Details for the file mojang_api_3-3.0.4-py3-none-any.whl
.
File metadata
- Download URL: mojang_api_3-3.0.4-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc60ec96d5ff27f653997bb3986f195c2d7144f4b0ae747ce7d496a9326025fa |
|
MD5 | 5123c40feb42368fdab9af39178ce99e |
|
BLAKE2b-256 | 8cba4588048c3717feee42e2000eda0a0e71d6e5d266996459dda01e438fc8c2 |