Skip to content

Commit

Permalink
Merge pull request #35 from nathanielvarona/improvement/return-keys-a…
Browse files Browse the repository at this point in the history
…s-default-to-json

Return Keys as default to JSON
  • Loading branch information
nathanielvarona committed Apr 26, 2024
2 parents f174e38 + 2af914b commit 354d510
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pritunl_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get(self, org_id=None, usr_id=None):
if org_id and usr_id:
self.r = self.root.auth_request(method="GET", path="/key/{0}/{1}".format(org_id, usr_id))
if self.r.status_code == 200:
return self.r
return self.r.json()
raise PritunlErr("{0}:{1}".format(sys._getframe().f_code.co_name, self.root.BASE_URL))
except Exception:
raise PritunlErr("{0}:{1}".format(sys._getframe().f_code.co_name, self.root.BASE_URL))
Expand Down
4 changes: 2 additions & 2 deletions pritunl_api/utils/keygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
def profile_key(pritunl, org_id, usr_id):
key = pritunl.key.get(org_id=org_id, usr_id=usr_id)
if key:
key_uri_url = urlparse(pritunl.BASE_URL)._replace(scheme='pritunl').geturl() + key.json()['uri_url']
key_view_url = pritunl.BASE_URL + key.json()['view_url']
key_uri_url = urlparse(pritunl.BASE_URL)._replace(scheme='pritunl').geturl() + key['uri_url']
key_view_url = pritunl.BASE_URL + key['view_url']
return key_uri_url, key_view_url
else:
return None, None

0 comments on commit 354d510

Please sign in to comment.