aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2020-04-12 10:37:09 +0200
committerneodarz <neodarz@neodarz.net>2020-04-12 10:37:09 +0200
commit2dffcdafbf939f3e51bd9c78832f86948e7a6c6c (patch)
treeea5b37bae06de8da10d59ffdd8e0d3370cdb7f96
parentcc1e4a3629e16d8d68c55e07c9e99c92c5814549 (diff)
downloadpyfunkwhale-2dffcdafbf939f3e51bd9c78832f86948e7a6c6c.tar.xz
pyfunkwhale-2dffcdafbf939f3e51bd9c78832f86948e7a6c6c.zip
Add endpoint for register an OAuth2 application
-rw-r--r--README.md2
-rw-r--r--pyfunkwhale/funkwhale.py22
2 files changed, 23 insertions, 1 deletions
diff --git a/README.md b/README.md
index fdf580e..d9fb025 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ List of features implemented or planned:
- [/] Auth
- [x] Login with OAuth2 Authorization Code flow
- - [ ] Register an OAuth2 application
+ - [x] Register an OAuth2 application
- [x] Get an JWT token
- [ ] Create an account
- [ ] Request a password request
diff --git a/pyfunkwhale/funkwhale.py b/pyfunkwhale/funkwhale.py
index 7d7bc3c..189b9cd 100644
--- a/pyfunkwhale/funkwhale.py
+++ b/pyfunkwhale/funkwhale.py
@@ -33,6 +33,28 @@ class Funkwhale(object):
return params
+ def create_app(self, name: str, redirect_uris: str = None,
+ scopes: str = None):
+ """
+ Register an OAuth application
+
+ Parameters
+ ----------
+ name : str
+ Name of the application
+ redirect_uris : str, optional
+ Uris where the instance will redirect
+ scopes : str, optional
+ Rights of the application on the instance
+ Default value: read
+ """
+
+ arguments = locals()
+
+ datas = self._build_params(arguments)
+
+ return self.client.call('/oauth/apps/', 'post', data=datas).json()
+
def artists(self, q: str = None, ordering: str = None,
playable: bool = None, page: int = None,
page_size: int = None) -> dict: