Skip to content

Commit

Permalink
Fix pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lmello committed Sep 9, 2024
1 parent 3502acb commit fa0df7b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/storage/gcp_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
This module provides an implementation of the BaseStorage class for Google Cloud Storage.
"""

from io import BytesIO
import logging
from google.cloud import storage
from google.oauth2 import service_account
from io import BytesIO
from google.api_core import exceptions as gcp_exceptions
import pandas as pd
from .base_storage import BaseStorage

Expand Down Expand Up @@ -72,7 +73,17 @@ def save_data(self, data: pd.core.frame.DataFrame, config) -> str | None:
blob.upload_from_file(
parquet_file, content_type='application/octet-stream')
return blob.public_url
except Exception as e:
logger.error(e)
except gcp_exceptions.BadRequest as e:
logger.error("Bad Request Error: %s", e)
except gcp_exceptions.Forbidden as e:
logger.error("Forbidden Error: %s", e)
except gcp_exceptions.NotFound as e:
logger.error("Not Found Error: %s", e)
except gcp_exceptions.TooManyRequests as e:
logger.error("Too Many Requests Error: %s", e)
except gcp_exceptions.InternalServerError as e:
logger.error("Internal Server Error: %s", e)
except gcp_exceptions.GoogleAPIError as e:
logger.error("Google API Error: %s", e)

return None

0 comments on commit fa0df7b

Please sign in to comment.