Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
TPA
Anonymous Ticket Portal
Commits
8cd06fbe
Commit
8cd06fbe
authored
Feb 18, 2021
by
ViolanteCodes
Browse files
added comments to gitlab_get_project and set timeout on gl_objects
parent
7cb63ff0
Changes
1
Show whitespace changes
Inline
Side-by-side
anonticket/views.py
View file @
8cd06fbe
...
...
@@ -214,16 +214,18 @@ def custom_ratelimit_post(
# ------------------SHARED FUNCTIONS, GITLAB---------------------------
# Easy to parse version of GitLab-Python functions.
# ----------------------------------------------------------------------
gl
=
gitlab
.
Gitlab
(
settings
.
GITLAB_URL
,
private_token
=
settings
.
GITLAB_SECRET_TOKEN
)
gl_public
=
gitlab
.
Gitlab
(
settings
.
GITLAB_URL
)
gl
=
gitlab
.
Gitlab
(
settings
.
GITLAB_URL
,
private_token
=
settings
.
GITLAB_SECRET_TOKEN
,
timeout
=
1
)
gl_public
=
gitlab
.
Gitlab
(
settings
.
GITLAB_URL
,
timeout
=
1
)
def
gitlab_get_project
(
project
,
lazy
=
False
,
public
=
False
):
"""Takes an integer, and grabs a gitlab project where gitlab_id
matches the integer."""
# choose the appropriate gl_object based on public API or token
if
public
==
True
:
gl_object
=
gl_public
else
:
gl_object
=
gl
# Fetch project with lazy == lazy.
working_project
=
gl_object
.
projects
.
get
(
project
,
lazy
=
lazy
)
return
working_project
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment