Commit 8cd06fbe authored by ViolanteCodes's avatar ViolanteCodes
Browse files

added comments to gitlab_get_project and set timeout on gl_objects

parent 7cb63ff0
...@@ -214,16 +214,18 @@ def custom_ratelimit_post( ...@@ -214,16 +214,18 @@ def custom_ratelimit_post(
# ------------------SHARED FUNCTIONS, GITLAB--------------------------- # ------------------SHARED FUNCTIONS, GITLAB---------------------------
# Easy to parse version of GitLab-Python functions. # Easy to parse version of GitLab-Python functions.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
gl = gitlab.Gitlab(settings.GITLAB_URL, private_token=settings.GITLAB_SECRET_TOKEN) gl = gitlab.Gitlab(settings.GITLAB_URL, private_token=settings.GITLAB_SECRET_TOKEN, timeout=1)
gl_public = gitlab.Gitlab(settings.GITLAB_URL) gl_public = gitlab.Gitlab(settings.GITLAB_URL, timeout=1)
def gitlab_get_project(project, lazy=False, public=False): def gitlab_get_project(project, lazy=False, public=False):
"""Takes an integer, and grabs a gitlab project where gitlab_id """Takes an integer, and grabs a gitlab project where gitlab_id
matches the integer.""" matches the integer."""
# choose the appropriate gl_object based on public API or token
if public == True: if public == True:
gl_object = gl_public gl_object = gl_public
else: else:
gl_object = gl gl_object = gl
# Fetch project with lazy == lazy.
working_project = gl_object.projects.get(project, lazy=lazy) working_project = gl_object.projects.get(project, lazy=lazy)
return working_project return working_project
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment