Example #1
0
 def put(cls):
     parser = reqparse.RequestParser()
     parser.add_argument('token', type=str)
     args = parser.parse_args()
     token: str = args['token']
     put_github_info(GitHubInfoModel(token=token))
     return {'token': get_github_info().token}
Example #2
0
 def get(cls):
     github_info_model: [GitHubInfoModel, None] = get_github_info()
     if not github_info_model:
         abort(404, message="GitHub token doesn't exist")
     return {
         "token":
         f"{github_info_model.token[:4]}***{github_info_model.token[-4:]}"
     }
Example #3
0
def get_github_token() -> str:
    github_info: Union[GitHubInfoModel, None] = get_github_info()
    return github_info.token if github_info else ""