Skip to content

Commit

Permalink
fix connect client
Browse files Browse the repository at this point in the history
  • Loading branch information
helllllllder committed May 27, 2022
1 parent c6799b2 commit 26bb0bb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions bothub/api/v2/internal/connect_rest_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import requests
import json
from typing import List, Dict

from django.conf import settings
Expand Down Expand Up @@ -34,7 +33,7 @@ def list_classifiers(
params={"project_uuid": project_uuid, "user_email": user_email},
)

return request.json()
return request.json()["data"]

def list_authorizations(self, project_uuid: str, user_email: str) -> List[str]:
classifiers = self.list_classifiers(
Expand All @@ -55,7 +54,7 @@ def get_authorization_classifier(
classifiers,
)

return classifier.get("uuid")
return next(classifier).get("uuid")

def remove_authorization(
self, project_uuid: str, authorization_uuid: str, user_email: str
Expand All @@ -68,7 +67,7 @@ def remove_authorization(
request = requests.delete(
url=f"{self.base_url}/v1/organization/project/destroy_classifier/",
headers=self.headers,
json=json.dumps({"uuid": classifier_uuid, "user_email": user_email}),
params={"uuid": classifier_uuid, "user_email": user_email},
)

return request.json()
Expand All @@ -77,6 +76,6 @@ def create_classifier(self, **kwargs):
request = requests.post(
url=f"{self.base_url}/v1/organization/project/create_classifier/",
headers=self.headers,
json=json.dumps({**kwargs, "classifier_type": "bothub"}),
params={**kwargs, "classifier_type": "bothub"},
)
return request.json()

0 comments on commit 26bb0bb

Please sign in to comment.