https://github.com/terror/kattis-api
A python wrapper for the Kattis API
https://github.com/terror/kattis-api
kattis kattis-api python-wrapper
Last synced: 4 months ago
JSON representation
A python wrapper for the Kattis API
- Host: GitHub
- URL: https://github.com/terror/kattis-api
- Owner: terror
- License: mit
- Created: 2020-12-11T22:16:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-24T03:42:04.000Z (about 2 years ago)
- Last Synced: 2025-02-06T16:54:02.671Z (5 months ago)
- Topics: kattis, kattis-api, python-wrapper
- Language: Python
- Homepage:
- Size: 59.6 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
README
## Kattis API
[](https://travis-ci.com/terror/kattis-api)
A python wrapper for the non-existent [Kattis](https://open.kattis.com/) API.
## Usage
You can simply install the package using pip
```bash
$ pip install kattis
```## Getting Started
import the kattis module
```python
import kattis
```## Examples
Some examples to get started.
### Authentication
You can authenticate a Kattis user by calling `kattis.auth`, this will
return a KattisUser object with a few callable methods.```python
user = kattis.auth('username', 'password')
```### User Methods
Methods that are callable on a KattisUser object.
`user.problems(pages) -> dict`: Fetches solved user problems
`user.stats() -> dict`: Fetches relevant user statistics
`user.data() -> dict`: Combines problems and statistics
```python
user = kattis.auth('username', 'password')problems = user.problems(1)
stats = user.stats()
info = user.data()
```### Problems
You can fetch kattis problems by ID or by full pages
`kattis.problem(id) -> dict`: Fetches problem information for a single problem
`kattis.problems(pages) -> list[dict]` Fetches problem information across specified pages
```python
problem = kattis.problem('2048') # Fetches information for problem with ID '2048'
problems = kattis.problems(2) # Fetches all problems on first 2 pages
```