Skip to content

Commit

Permalink
no flake8 for init
Browse files Browse the repository at this point in the history
  • Loading branch information
Mael-J committed Feb 10, 2024
1 parent 3f21a49 commit e1cd7d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions mstarpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# flake8: noqa

""" mstarpy init """
from .funds import Funds
from .stock import Stock
Expand Down
11 changes: 7 additions & 4 deletions mstarpy/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@

def not_200_response(url, response):
"""
This function raise a ConnectionError if the status code a requests is not 200.
This function raise a ConnectionError
if the status code a requests is not 200.
"""
if not response.status_code == 200:
raise ConnectionError(
f"""Error {response.status_code}
for the api {url}. Message : {response.reason}."""
for the api {url}. Message : {response.reason}."""
)


def no_site_error(code, name, country, site):
"""
This function raise a ValueError if the selected country is "us" or a site is not selected.
This function raise a ValueError if the
selected country is "us" or a site is not selected.
"""
if not site or country == "us":
if country:
raise ValueError(f"The funds of the country {country} cannot be scraped.")
raise ValueError(f"""The funds of the
country {country} cannot be scraped.""")
raise ValueError(f"The funds {name} ({code}) cannot be scraped.")

0 comments on commit e1cd7d1

Please sign in to comment.