Skip to content

Commit

Permalink
Merge pull request #4 from InvisibleSymbol/master
Browse files Browse the repository at this point in the history
implement get_user_recent
  • Loading branch information
samuelhklumpers authored Feb 14, 2019
2 parents ddd8e1c + 5fee6bf commit 8f6f2b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
.vscode/
.idea/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

OsuAPI is a minimal python wrapper for the osu api. Endpoints are implemented as necessary for the [circleguard](https://github.com/circleguard/circleguard) project. Passed keys (endpoint parameter key/value pairs, not the api key) are checked to make sure the api will accept them, and that all required keys are present. No attempt is made to check http status codes or retry requests that fail.

Currently, only the `get_replay` and `get_scores` endpoints are implemented. Should you be a completionist, you are more than welcome to PR the rest in.
Currently, only the `get_replay`, `get_scores`, `get_user_best` and `get_user_recent` endpoints are implemented. Should you be a completionist, you are more than welcome to PR the rest in.

### Usage

Expand Down
5 changes: 5 additions & 0 deletions osuAPI/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ class GET_USER_BEST():
EXTENSION = "get_user_best"
REQUIRED = ["m", "u"]
POSSIBLE = ["m", "u", "limit", "type"]

class GET_USER_RECENT():
EXTENSION = "get_user_recent"
REQUIRED = ["u"]
POSSIBLE = ["m", "u", "limit", "type"]
8 changes: 8 additions & 0 deletions osuAPI/osuAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ def get_user_best(self, params):
url = self.base_url.format(ep.EXTENSION)
url = self._extend_url(url, params)
return self._process_url(url)

def get_user_recent(self, params):
"""Retrieves latest scores of a user."""
ep = ENDPOINTS.GET_USER_RECENT
self._check_parameters(ep, params)
url = self.base_url.format(ep.EXTENSION)
url = self._extend_url(url, params)
return self._process_url(url)

0 comments on commit 8f6f2b8

Please sign in to comment.