[Python-modules-commits] [python-social-auth] 08/32: Withings Backend

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:13:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.12
in repository python-social-auth.

commit 9fc8d4e3f039b76639e59652fa89299eceb67e66
Author: Tomas <tomas.garzon at iactiveit.com>
Date:   Thu Jun 25 09:07:29 2015 +0200

    Withings Backend
---
 README.rst                  |  1 +
 docs/backends/index.rst     |  1 +
 docs/backends/withings.rst  | 13 +++++++++++++
 social/backends/withings.py | 14 ++++++++++++++
 4 files changed, 29 insertions(+)

diff --git a/README.rst b/README.rst
index ef2e992..0eea46d 100644
--- a/README.rst
+++ b/README.rst
@@ -120,6 +120,7 @@ or current ones extended):
     * Twitter_ OAuth1
     * VK.com_ OpenAPI, OAuth2 and OAuth2 for Applications
     * Weibo_ OAuth2
+    * Withings_ OAuth1
     * Wunderlist_ OAuth2
     * Xing_ OAuth1
     * Yahoo_ OpenId and OAuth2
diff --git a/docs/backends/index.rst b/docs/backends/index.rst
index fe9590a..8456946 100644
--- a/docs/backends/index.rst
+++ b/docs/backends/index.rst
@@ -132,6 +132,7 @@ Social backends
    vimeo
    vk
    weibo
+   withings
    wunderlist
    xing
    yahoo
diff --git a/docs/backends/withings.rst b/docs/backends/withings.rst
new file mode 100644
index 0000000..931626f
--- /dev/null
+++ b/docs/backends/withings.rst
@@ -0,0 +1,13 @@
+Withings
+=========
+
+Withings uses OAuth v1 for Authentication.
+
+- Register a new application at the `Withings API`_, and
+
+- fill ``Client ID`` and ``Client Secret`` from withings.com values in the settings::
+
+      SOCIAL_AUTH_WITHINGS_KEY = ''
+      SOCIAL_AUTH_WITHINGS_SECRET = ''
+
+.. _Withings API: https://oauth.withings.com/partner/add
diff --git a/social/backends/withings.py b/social/backends/withings.py
new file mode 100644
index 0000000..dbe5d6d
--- /dev/null
+++ b/social/backends/withings.py
@@ -0,0 +1,14 @@
+from social.backends.oauth import BaseOAuth1
+
+
+class WithingsOAuth(BaseOAuth1):
+    name = 'withings'
+    AUTHORIZATION_URL = 'https://oauth.withings.com/account/authorize'
+    REQUEST_TOKEN_URL = 'https://oauth.withings.com/account/request_token'
+    ACCESS_TOKEN_URL = 'https://oauth.withings.com/account/access_token'
+    ID_KEY = 'userid'
+
+    def get_user_details(self, response):
+        """Return user details from Withings account"""
+        return {'userid': response['access_token']['userid'],
+                'email': ''}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git



More information about the Python-modules-commits mailing list