Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ nylas-python Changelog
Unreleased
--------------
* Add support for Scheduler APIs
* Fixed attachment download response handling

v6.4.0
----------------
Expand Down
6 changes: 4 additions & 2 deletions nylas/handler/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def _validate_response(response: Response) -> dict:

return json


def _build_query_params(base_url: str, query_params: dict = None) -> str:
query_param_parts = []
for key, value in query_params.items():
Expand Down Expand Up @@ -109,7 +108,7 @@ def _execute_download_request(
query_params=None,
stream=False,
overrides=None,
) -> Union[bytes, Response]:
) -> Union[bytes, Response,dict]:
request = self._build_request("GET", path, headers, query_params, overrides)

timeout = self.timeout
Expand All @@ -124,6 +123,9 @@ def _execute_download_request(
stream=stream,
)

if not response.ok:
return _validate_response(response)

# If we stream an iterator for streaming the content, otherwise return the entire byte array
if stream:
return response
Expand Down
Loading