X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gitlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,12 @@ def auth(self):
def credentials_auth(self):
"""Performs an authentication using email/password."""
if not self.email or not self.password:
raise GitlabAuthenticationError("Missing email/password")
# raise GitlabAuthenticationError("Missing email/password")
data = json.dumps({'email':self.http_username,
'password':self.http_password})
else:
data = json.dumps({'email': self.email, 'password': self.password})

data = json.dumps({'email': self.email, 'password': self.password})
r = self._raw_post('/session', data, content_type='application/json')
raise_error_from_response(r, GitlabAuthenticationError, 201)
self.user = CurrentUser(self, r.json())
Expand Down
7 changes: 6 additions & 1 deletion gitlab/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def __init__(self, gitlab_id=None, config_files=None):

try:
self.url = self._config.get(self.gitlab_id, 'url')
self.token = self._config.get(self.gitlab_id, 'private_token')
except Exception:
raise GitlabDataError("Impossible to get gitlab informations from "
"configuration (%s)" % self.gitlab_id)
Expand All @@ -79,6 +78,12 @@ def __init__(self, gitlab_id=None, config_files=None):
except Exception:
pass

self.token = None
try:
self.token = self._config.get(self.gitlab_id, 'private_token')
except Exception:
pass

self.http_username = None
self.http_password = None
try:
Expand Down
X Tutup