**README.md**

# malody

Python wrapper for Malody game API

```bash
pip install malody
```

## Quick Start

```python
import malody

key = "your_api_key_here"
uid = 1000  # Player ID

info = malody.player.info(uid, key)
print(info["username"])  # "chonicle"
```

## All Functions

### info(touid, key)
```python
malody.player.info(1000, "your_key")
```
**Returns:**
```json
{
  "username": "chonicle",
  "uid": 2,
  "avatar": "2.png",
  "gender": 2,
  "playTime": 88,
  "gold": 21494,
  "regtime": 1406271800,
  "area": 9,
  "active": 2,
  "banner": "/banner/2.jpg!banner"
}
```

### activity(touid, key)
```python
malody.player.activity(1000, "your_key")
```
**Returns:**
```json
{
  "code": 0,
  "data": [
    {
      "time": 1533644730,
      "msg": "chonicle's chart has been unstabled by xipigu",
      "link": "/chart/11359"
    },
    {
      "time": 1495596563,
      "msg": "chonicle has unlocked First ring",
      "link": "/accounts/user/achieve/2"
    }
  ],
  "hasMore": false,
  "next": 1458861740
}
```

### chart(touid, key)
```python
malody.player.chart(1000, "your_key")
```
**Returns:**
```json
{
  "code": 0,
  "data": [
    {
      "sid": 611,
      "cid": 1480,
      "title": "Hana wa Odore ya Irohaniho",
      "artist": "Team \"Hanayamata\"",
      "version": "7K easy voice",
      "level": 0,
      "length": 84,
      "mode": 0
    },
    {
      "sid": 511,
      "cid": 1206,
      "title": "Soutaisei VISION",
      "artist": "nao",
      "version": "Extreme Lv.22",
      "level": 22,
      "length": 99,
      "mode": 4
    }
  ],
  "hasMore": false,
  "next": 1436969618
}
```

### rank(touid, key)
```python
malody.player.rank(1000, "your_key")
```
**Returns:**
```json
{
  "code": 0,
  "data": [
    {
      "mode": 0,
      "rank": 329338,
      "level": 6,
      "pc": 19,
      "acc": 95.7246376811594,
      "combo": 728
    },
    {
      "mode": 4,
      "rank": 2976,
      "level": 6,
      "pc": 14,
      "acc": 96.5382484115106,
      "combo": 554
    }
  ],
  "hasMore": false,
  "next": 0
}
```

### wiki(touid, key, lang=0, raw=1)
```python
malody.player.wiki(1000, "your_key", lang=1)
```
**Returns:**
```json
{
  "code": 0,
  "wiki": "=Samplitude教程=\n\n[http://m.mugzone.net/page/444 tutorial]",
  "raw": true
}
```

## Full Example

```python
import malody

key = "L-IOzHDc4Ug8OWJsAwD89Y..."
uid = 1000

# Get all data
info = malody.player.info(uid, key)
activity = malody.player.activity(uid, key)
charts = malody.player.chart(uid, key)
rank = malody.player.rank(uid, key)
wiki = malody.player.wiki(uid, key)

print(f"Player: {info['username']}")
print(f"Created {len(charts['data'])} charts")
print(f"Key mode rank: {rank['data'][0]['rank']}")
print(f"Recent activity: {activity['data'][0]['msg']}")
```

## Notes

- `touid` = player ID to lookup
- `key` = your API key
- Returns dict on success
- Returns None on error

## todo

- add functions for skins/maps
- add skin/map downloader?
- write up on how to get api key