diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-mojang.spec | 322 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 324 insertions, 0 deletions
@@ -0,0 +1 @@ +/mojang-1.1.0.tar.gz diff --git a/python-mojang.spec b/python-mojang.spec new file mode 100644 index 0000000..bc8e6ff --- /dev/null +++ b/python-mojang.spec @@ -0,0 +1,322 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mojang +Version: 1.1.0 +Release: 1 +Summary: A Python wrapper for the Mojang API and Minecraft website +License: MIT +URL: https://github.com/summer/mojang +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d6/a1/5043c107234ea09cde5f575a7cb8b267ab63a0bb266d828aa9468839378b/mojang-1.1.0.tar.gz +BuildArch: noarch + +Requires: python3-requests + +%description +#
+[](https://badge.fury.io/py/mojang)
+
+
+[](https://mojang.readthedocs.io/en/latest/)
+[](https://github.com/summer/mojang/blob/master/LICENSE/)
+[](https://pypistats.org/packages/mojang)
+
+[**Documentation**](https://mojang.readthedocs.io/en/latest/)
+
+```Mojang``` is a Python package for accessing Mojang's services. This library can be used to convert UUIDs, get a profile's information, change your Minecraft username or skin, and much more.
+
+There are 2 components to this package, which are imported in different ways:
+
+- **Public API** - Used to parse information about Minecraft profiles and more. Authentication is not required.
+- **Client API** - Used to login to a Mojang account and access it.
+
+At the moment, the Client API only supports authenticating to a Minecraft account via Microsoft's authentication scheme, so your Minecraft account must already be migrated. Alternatively, you may authenticate to a Mojang account directly with a Bearer token.
+
+
+## Installation
+**Python 3.7 or higher is required.**
+
+The easiest way to install the library is using `pip`. Just run the following console command:
+
+```
+python -m pip install mojang
+```
+
+
+## **Public API Quickstart**
+
+```py
+from mojang import API
+
+# Create a Public API instance
+api = API()
+
+uuid = api.get_uuid("Notch")
+
+if not uuid:
+ print("Notch is not a taken username.")
+else:
+ print(f"Notch's UUID is {uuid}")
+
+ profile = api.get_profile(uuid)
+ print(f"Notch's skin URL is {profile.skin_url}")
+ print(f"Notch's skin variant is {profile.skin_variant}")
+ print(f"Notch's cape URL is {profile.cape_url}")
+```
+
+- [Full Public API documentation](https://mojang.readthedocs.io/en/latest/api/)
+
+
+## **Client API Quickstart**
+To log into a Mojang account, the account must already be migrated to Microsoft.
+This means that you will be using your Microsoft credentials to login.
+
+```py
+from mojang import Client
+
+client = Client("YOUR_MICROSOFT_EMAIL", "YOUR_PASSWORD")
+
+# Get the account's profile information
+profile = client.get_profile()
+
+print(profile.id)
+print(profile.name)
+
+for skin in profile.skins:
+ print(skin.id)
+ print(skin.enabled)
+ print(skin.url)
+ print(skin.variant)
+```
+
+Alternatively, supply a Bearer token and skip the Microsoft authentication process.
+```py
+client = Client(bearer_token="MOJANG_BEARER_TOKEN_HERE")
+```
+If authentication fails, such as due to an incorrect email or password, a `LoginFailure` exception will occur.
+
+- [Full Client API documentation](https://mojang.readthedocs.io/en/latest/client/)
+ + +%package -n python3-mojang +Summary: A Python wrapper for the Mojang API and Minecraft website +Provides: python-mojang +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mojang +#
+[](https://badge.fury.io/py/mojang)
+
+
+[](https://mojang.readthedocs.io/en/latest/)
+[](https://github.com/summer/mojang/blob/master/LICENSE/)
+[](https://pypistats.org/packages/mojang)
+
+[**Documentation**](https://mojang.readthedocs.io/en/latest/)
+
+```Mojang``` is a Python package for accessing Mojang's services. This library can be used to convert UUIDs, get a profile's information, change your Minecraft username or skin, and much more.
+
+There are 2 components to this package, which are imported in different ways:
+
+- **Public API** - Used to parse information about Minecraft profiles and more. Authentication is not required.
+- **Client API** - Used to login to a Mojang account and access it.
+
+At the moment, the Client API only supports authenticating to a Minecraft account via Microsoft's authentication scheme, so your Minecraft account must already be migrated. Alternatively, you may authenticate to a Mojang account directly with a Bearer token.
+
+
+## Installation
+**Python 3.7 or higher is required.**
+
+The easiest way to install the library is using `pip`. Just run the following console command:
+
+```
+python -m pip install mojang
+```
+
+
+## **Public API Quickstart**
+
+```py
+from mojang import API
+
+# Create a Public API instance
+api = API()
+
+uuid = api.get_uuid("Notch")
+
+if not uuid:
+ print("Notch is not a taken username.")
+else:
+ print(f"Notch's UUID is {uuid}")
+
+ profile = api.get_profile(uuid)
+ print(f"Notch's skin URL is {profile.skin_url}")
+ print(f"Notch's skin variant is {profile.skin_variant}")
+ print(f"Notch's cape URL is {profile.cape_url}")
+```
+
+- [Full Public API documentation](https://mojang.readthedocs.io/en/latest/api/)
+
+
+## **Client API Quickstart**
+To log into a Mojang account, the account must already be migrated to Microsoft.
+This means that you will be using your Microsoft credentials to login.
+
+```py
+from mojang import Client
+
+client = Client("YOUR_MICROSOFT_EMAIL", "YOUR_PASSWORD")
+
+# Get the account's profile information
+profile = client.get_profile()
+
+print(profile.id)
+print(profile.name)
+
+for skin in profile.skins:
+ print(skin.id)
+ print(skin.enabled)
+ print(skin.url)
+ print(skin.variant)
+```
+
+Alternatively, supply a Bearer token and skip the Microsoft authentication process.
+```py
+client = Client(bearer_token="MOJANG_BEARER_TOKEN_HERE")
+```
+If authentication fails, such as due to an incorrect email or password, a `LoginFailure` exception will occur.
+
+- [Full Client API documentation](https://mojang.readthedocs.io/en/latest/client/)
+ + +%package help +Summary: Development documents and examples for mojang +Provides: python3-mojang-doc +%description help +#
+[](https://badge.fury.io/py/mojang)
+
+
+[](https://mojang.readthedocs.io/en/latest/)
+[](https://github.com/summer/mojang/blob/master/LICENSE/)
+[](https://pypistats.org/packages/mojang)
+
+[**Documentation**](https://mojang.readthedocs.io/en/latest/)
+
+```Mojang``` is a Python package for accessing Mojang's services. This library can be used to convert UUIDs, get a profile's information, change your Minecraft username or skin, and much more.
+
+There are 2 components to this package, which are imported in different ways:
+
+- **Public API** - Used to parse information about Minecraft profiles and more. Authentication is not required.
+- **Client API** - Used to login to a Mojang account and access it.
+
+At the moment, the Client API only supports authenticating to a Minecraft account via Microsoft's authentication scheme, so your Minecraft account must already be migrated. Alternatively, you may authenticate to a Mojang account directly with a Bearer token.
+
+
+## Installation
+**Python 3.7 or higher is required.**
+
+The easiest way to install the library is using `pip`. Just run the following console command:
+
+```
+python -m pip install mojang
+```
+
+
+## **Public API Quickstart**
+
+```py
+from mojang import API
+
+# Create a Public API instance
+api = API()
+
+uuid = api.get_uuid("Notch")
+
+if not uuid:
+ print("Notch is not a taken username.")
+else:
+ print(f"Notch's UUID is {uuid}")
+
+ profile = api.get_profile(uuid)
+ print(f"Notch's skin URL is {profile.skin_url}")
+ print(f"Notch's skin variant is {profile.skin_variant}")
+ print(f"Notch's cape URL is {profile.cape_url}")
+```
+
+- [Full Public API documentation](https://mojang.readthedocs.io/en/latest/api/)
+
+
+## **Client API Quickstart**
+To log into a Mojang account, the account must already be migrated to Microsoft.
+This means that you will be using your Microsoft credentials to login.
+
+```py
+from mojang import Client
+
+client = Client("YOUR_MICROSOFT_EMAIL", "YOUR_PASSWORD")
+
+# Get the account's profile information
+profile = client.get_profile()
+
+print(profile.id)
+print(profile.name)
+
+for skin in profile.skins:
+ print(skin.id)
+ print(skin.enabled)
+ print(skin.url)
+ print(skin.variant)
+```
+
+Alternatively, supply a Bearer token and skip the Microsoft authentication process.
+```py
+client = Client(bearer_token="MOJANG_BEARER_TOKEN_HERE")
+```
+If authentication fails, such as due to an incorrect email or password, a `LoginFailure` exception will occur.
+
+- [Full Client API documentation](https://mojang.readthedocs.io/en/latest/client/)
+ + +%prep +%autosetup -n mojang-1.1.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-mojang -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.0-1 +- Package Spec generated @@ -0,0 +1 @@ +688432e5472d839fc942099628bd96e1 mojang-1.1.0.tar.gz |