Metadata-Version: 2.4
Name: python-eveauth
Version: 0.1.0
Summary: A library for authorizing desktop apps with the EVE online SSO.
Author-email: Erik Kalkoken <kalkoken87@gmail.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: python-jose
Requires-Dist: pdoc ; extra == "docs"
Requires-Dist: requests-mock ; extra == "test"
Requires-Dist: coverage ; extra == "test"
Project-URL: homepage, https://github.com/ErikKalkoken/python-eveauth
Project-URL: issues, https://github.com/ErikKalkoken/python-eveauth/issues
Project-URL: source, https://github.com/ErikKalkoken/python-eveauth
Provides-Extra: docs
Provides-Extra: test

# python-eveauth

A Python library for authorizing desktop apps with the EVE online SSO.

[![release](https://img.shields.io/pypi/v/python-eveauth?label=release)](https://pypi.org/project/python-eveauth/)
[![python](https://img.shields.io/pypi/pyversions/python-eveauth)](https://pypi.org/project/python-eveauth/)
[![CI/CD](https://github.com/ErikKalkoken/python-eveauth/actions/workflows/cicd.yaml/badge.svg)](https://github.com/ErikKalkoken/python-eveauth/actions/workflows/cicd.yaml)
[![codecov](https://codecov.io/gh/ErikKalkoken/python-eveauth/graph/badge.svg?token=NBGLASsNXq)](https://codecov.io/gh/ErikKalkoken/python-eveauth)
[![license](https://img.shields.io/badge/license-MIT-green)](https://gitlab.com/ErikKalkoken/python-eveauth/-/blob/master/LICENSE)

## Description

**python-eveauth** is a library for authorizing Python scripts on desktops with the EVE online SSO.
It enables a Python script (e.g. CLI tools, GUI apps or Jupiter notebooks) to obtain SSO tokens that grant authenticated access to the EVE Online API (ESI).

## Installation

```sh
pip install python-eveauth
```

## Quick Start

First you need to create an EVE SSO app for your script on [Eve Online's developers site](https://developers.eveonline.com/):

- Name: Any name
- Callback URL: The default callback for your SSO app is: `http://127.0.0.1:8080/callback`
- Enabled Scopes: Select all scopes needed for your app (you can change this later if you want). Select at least one scope, e.g. `publicData`

This will create a SSO app and give you a SSO client ID.

Then you can start authorizing your script with **eveauth**.

Below is an basic example that show how you can use **eveauth**.
It first authorizes the script and obtains a token.
Then fetches the wallet balance for the authorized character with the token.
The token can later be refreshed as needed.

```python
import requests
from eveauth import Client

# Create an auth client
c = Client(client_id="YOUR-SSO-CLIENT-ID")

# Authorize the current script with the character wallet scope
token = c.authorize("esi-wallet.read_character_wallet.v1")

# Request the wallet balance for the authorized character
r = requests.get(
    url=f"https://esi.evetech.net/characters/{token.character_id}/wallet",
    headers={"Authorization": f"Bearer {token.access_token}"},
)
r.raise_for_status()

# Print the balance
print(r.text)


# Refresh the token
# c.refresh_token(token)
```

You can find more examples in the directory `/examples`.

## Documentation

The full documentation can be found here: [Documentation](https://erikkalkoken.github.io/python-eveauth).

