Example #1
0
 def get(self, username):
     """ launch build  from github webhook"""
     access_token = pecan.request.GET.get('access_token')
     if access_token:
         # Check if this user exists in DB
         # if not we need to create it
         data = github.get_user(username, access_token)
         if data:
             # Save this new user
             user = User({"username": data['login'],
                          "name": data['name'],
                          "github_url": data['html_url'],
                          "email": data['email'],
                          "token_github": access_token
                          })
             if not user.create():
                 return None
         return github.update_user_info_from_github(username, access_token)
     return None
Example #2
0
 def get(self, username):
     """Sync users organisations"""
     access_token = pecan.request.GET.get('access_token')
     if access_token:
         github.update_user_info_from_github(username, access_token)
     return None