Skip to content

Commit

Permalink
Blacked
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-moreno committed May 26, 2021
1 parent 32bb512 commit 46f8775
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spook/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def get_response_data(self, response) -> Union[dict, str]:
return response_data

def map_response(
self, data: Union[str, dict, list], action: str = 'get', status: int = 200,
self,
data: Union[str, dict, list],
action: str = "get",
status: int = 200,
) -> Union[str, dict, list]:
"""
Maps the response to a custom format
Expand Down Expand Up @@ -123,7 +126,7 @@ def get(self, url: str, **params) -> APIResourceResponse:
"""
response = self.http.get(url, headers=self.get_headers(), params=params)
data = self.get_response_data(response)
data = self.map_response(data, action='get', status=response.status_code)
data = self.map_response(data, action="get", status=response.status_code)

return APIResourceResponse(data=data, status=response.status_code)

Expand Down Expand Up @@ -205,7 +208,9 @@ def patch(self, pk: Any, data: dict, query: dict = None) -> APIResourceResponse:
self.get_url(pk), json=data, headers=self.get_headers(), params=query
)
data = self.get_response_data(response)
data = self.map_response(data, action="partial_update", status=response.status_code)
data = self.map_response(
data, action="partial_update", status=response.status_code
)

return APIResourceResponse(data=data, status=response.status_code)

Expand Down

0 comments on commit 46f8775

Please sign in to comment.