Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #3
- Loading branch information
Showing
13 changed files
with
105 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#! /usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
from __future__ import absolute_import | ||
|
||
from .base import AuthenticationMixinBase | ||
from . import GrantFailed | ||
|
||
|
||
class DeviceCodeMixin(AuthenticationMixinBase): | ||
""" | ||
Implement helpers for the Device Code grant for OAuth2. | ||
Attention! This is not (yet) part of the official vimeo.py library! | ||
""" | ||
|
||
def load_device_code(self, scope): | ||
"""Perform the request for device code.""" | ||
code, headers, resp = self.call_grant( | ||
'/oauth/device', { | ||
"grant_type": "device_grant", | ||
"scope": scope | ||
}) | ||
|
||
if not code == 200: | ||
raise GrantFailed() | ||
|
||
return resp | ||
|
||
def device_code_authorize(self, user_code, device_code): | ||
"""Perform the authorization step after the user entered the device code.""" | ||
code, headers, resp = self.call_grant( | ||
'/oauth/device/authorize', { | ||
"user_code": user_code, | ||
"device_code": device_code | ||
}) | ||
|
||
if not code == 200: | ||
raise GrantFailed() | ||
|
||
self.token = resp['access_token'] | ||
|
||
return self.token, resp['user'], resp['scope'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
PATH_ROOT = "/" | ||
PATH_AUTH_LOGIN = "/auth/login/" | ||
PATH_AUTH_LOGOUT = "/auth/logout/" | ||
PATH_CATEGORIES = "/categories/" | ||
PATH_FEATURED = "/featured/" | ||
PATH_PLAY = "/play/" | ||
PATH_PROFILE = "/profile/" | ||
PATH_SEARCH = "/search/" | ||
PATH_SETTINGS_CACHE_CLEAR = "/settings/cache/clear/" | ||
PATH_TRENDING = "/trending/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/resources/lib/vimeo/test_utils.py → tests/resources/lib/test_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.