# fortnitepy (Fix)
[![Supported py versions](https://img.shields.io/pypi/pyversions/fortnitepyfix.svg)](https://pypi.org/project/fortnitepyfix/)*Old Fortnitepy*
[![Current pypi version](https://img.shields.io/pypi/v/fortnitepyfix.svg)](https://pypi.org/project/fortnitepyfix/) *Old Fortnitepy*
Asynchronous library for interacting with Fortnite and EpicGames' API and XMPP services.
**Note:** This library is still under developement so breaking changes might happen at any time.
**Some key features:**
- Full support for Friends.
- Support for XMPP events including friend and party messages + many more.
- Support for Parties.
- Support for Battle Royale stats.
# Documentation
https://fortnitepy.readthedocs.io/en/latest/
# Installing
```
# windows
py -3 -m pip install -U fortnitepyfix
# linux
python3 -m pip install -U fortnitepyfix
```
# Basic usage
```py
import fortnitepyfix
import json
import os
from fortnitepyfix.ext import commands
email = 'email@email.com'
password = 'password1'
filename = 'device_auths.json'
def get_device_auth_details():
if os.path.isfile(filename):
with open(filename, 'r') as fp:
return json.load(fp)
return {}
def store_device_auth_details(email, details):
existing = get_device_auth_details()
existing[email] = details
with open(filename, 'w') as fp:
json.dump(existing, fp)
device_auth_details = get_device_auth_details().get(email, {})
bot = commands.Bot(
command_prefix='!',
auth=fortnitepy.AdvancedAuth(
email=email,
password=password,
prompt_authorization_code=True,
prompt_code_if_invalid=True,
delete_existing_device_auths=True,
**device_auth_details
)
)
@bot.event
async def event_device_auth_generate(details, email):
store_device_auth_details(email, details)
@bot.event
async def event_ready():
print('----------------')
print('Bot ready as')
print(bot.user.display_name)
print(bot.user.id)
print('----------------')
@bot.event
async def event_friend_request(request):
await request.accept()
@bot.command()
async def hello(ctx):
await ctx.send('Hello!')
bot.run()
```
# Authorization
How to get a one time authorization code:
1. Log into the epic games account of your choice [here](https://www.epicgames.com/id/logout?redirectUrl=https%3A//www.epicgames.com/id/login%3FredirectUrl%3Dhttps%253A%252F%252Fwww.epicgames.com%252Fid%252Fapi%252Fredirect%253FclientId%253D3446cd72694c4a4485d81b77adbb2141%2526responseType%253Dcode).
2. Copy the hex part from the url that shows up as showcased by the image below:
![Authorization Code](https://raw.githubusercontent.com/Terbau/fortnitepy/dev/docs/resources/images/authorization_code.png)
Raw data
{
"_id": null,
"home_page": "https://www.klld.000.pe",
"name": "fortnitepyfix",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "klld",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/dd/62/b9bcb45dc300b950838091c5d510ded8b3d1d531f0e387f896d99c80be4d/fortnitepyfix-1.0.0.tar.gz",
"platform": null,
"description": " # fortnitepy (Fix)\n\n[![Supported py versions](https://img.shields.io/pypi/pyversions/fortnitepyfix.svg)](https://pypi.org/project/fortnitepyfix/)*Old Fortnitepy*\n[![Current pypi version](https://img.shields.io/pypi/v/fortnitepyfix.svg)](https://pypi.org/project/fortnitepyfix/) *Old Fortnitepy*\n\nAsynchronous library for interacting with Fortnite and EpicGames' API and XMPP services.\n\n**Note:** This library is still under developement so breaking changes might happen at any time.\n\n**Some key features:**\n- Full support for Friends.\n- Support for XMPP events including friend and party messages + many more.\n- Support for Parties.\n- Support for Battle Royale stats.\n\n# Documentation\nhttps://fortnitepy.readthedocs.io/en/latest/\n\n# Installing\n```\n# windows\npy -3 -m pip install -U fortnitepyfix\n\n# linux\npython3 -m pip install -U fortnitepyfix\n```\n\n# Basic usage\n```py\nimport fortnitepyfix\nimport json\nimport os\n\nfrom fortnitepyfix.ext import commands\n\nemail = 'email@email.com'\npassword = 'password1'\nfilename = 'device_auths.json'\n\ndef get_device_auth_details():\n if os.path.isfile(filename):\n with open(filename, 'r') as fp:\n return json.load(fp)\n return {}\n\ndef store_device_auth_details(email, details):\n existing = get_device_auth_details()\n existing[email] = details\n\n with open(filename, 'w') as fp:\n json.dump(existing, fp)\n\ndevice_auth_details = get_device_auth_details().get(email, {})\nbot = commands.Bot(\n command_prefix='!',\n auth=fortnitepy.AdvancedAuth(\n email=email,\n password=password,\n prompt_authorization_code=True,\n prompt_code_if_invalid=True,\n delete_existing_device_auths=True,\n **device_auth_details\n )\n)\n\n@bot.event\nasync def event_device_auth_generate(details, email):\n store_device_auth_details(email, details)\n\n@bot.event\nasync def event_ready():\n print('----------------')\n print('Bot ready as')\n print(bot.user.display_name)\n print(bot.user.id)\n print('----------------')\n\n@bot.event\nasync def event_friend_request(request):\n await request.accept()\n\n@bot.command()\nasync def hello(ctx):\n await ctx.send('Hello!')\n\nbot.run()\n```\n\n# Authorization\nHow to get a one time authorization code:\n1. Log into the epic games account of your choice [here](https://www.epicgames.com/id/logout?redirectUrl=https%3A//www.epicgames.com/id/login%3FredirectUrl%3Dhttps%253A%252F%252Fwww.epicgames.com%252Fid%252Fapi%252Fredirect%253FclientId%253D3446cd72694c4a4485d81b77adbb2141%2526responseType%253Dcode).\n2. Copy the hex part from the url that shows up as showcased by the image below:\n\n![Authorization Code](https://raw.githubusercontent.com/Terbau/fortnitepy/dev/docs/resources/images/authorization_code.png)\n\n\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "klldFN",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://fortnitepy.readthedocs.io/en/latest/",
"Homepage": "https://www.klld.000.pe",
"Issue tracker": "https://github.com/Terbau/fortnitepy/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e86323b6e3a7c0d0b368469b2510fa1ad445642cbd2d615db7ee093368c3dd63",
"md5": "aeb1d20977aeb838e0f2c063861fc564",
"sha256": "f211d32b27bf1d81f9cc79bf5a3ec4a83b1a358b2c127fe0e0fbc1800fcc0864"
},
"downloads": -1,
"filename": "fortnitepyfix-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aeb1d20977aeb838e0f2c063861fc564",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 180265,
"upload_time": "2023-09-25T11:36:44",
"upload_time_iso_8601": "2023-09-25T11:36:44.885105Z",
"url": "https://files.pythonhosted.org/packages/e8/63/23b6e3a7c0d0b368469b2510fa1ad445642cbd2d615db7ee093368c3dd63/fortnitepyfix-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dd62b9bcb45dc300b950838091c5d510ded8b3d1d531f0e387f896d99c80be4d",
"md5": "a75fc4e5c0e888d4ac84be52a44a39a2",
"sha256": "9025602b1d903ded719aff73398e6758a69ed788c4ac9215905955c2f50870ec"
},
"downloads": -1,
"filename": "fortnitepyfix-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a75fc4e5c0e888d4ac84be52a44a39a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 155740,
"upload_time": "2023-09-25T11:36:48",
"upload_time_iso_8601": "2023-09-25T11:36:48.045019Z",
"url": "https://files.pythonhosted.org/packages/dd/62/b9bcb45dc300b950838091c5d510ded8b3d1d531f0e387f896d99c80be4d/fortnitepyfix-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-25 11:36:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Terbau",
"github_project": "fortnitepy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "fortnitepyfix"
}