import requests

import floyd
from floyd.exceptions import AuthenticationException
from floyd.client.base import FloydHttpClient
from floyd.model.user import User


class AuthClient(FloydHttpClient):
    """
    Auth/User specific client
    """
    def __init__(self):
        self.base_url = "{}/api/v1/user/".format(floyd.floyd_host)

    def get_user(self, access_token):
        response = requests.get(self.base_url,
                                headers={"Authorization": "Bearer {}".format(access_token)})
        try:
            user_dict = response.json()
        except Exception:
            raise AuthenticationException("Invalid Token.\nSee http://docs.floydhub.com/faqs/authentication/ for help")

        return User.from_dict(user_dict)

@@ -1,21 +1,4 @@
-import requests%0A%0A
 impo
@@ -352,16 +352,33 @@
 token):%0A
+        try:%0A    
         
@@ -388,16 +388,21 @@
 ponse = 
+self.
 requests
@@ -421,16 +421,25 @@
 se_url,%0A
+         
         
@@ -523,29 +523,16 @@
 oken)%7D)%0A
-        try:%0A
         

Handle invalid token error