Skip to content

Commit

Permalink
format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
Mael-J committed Feb 3, 2024
1 parent 34df3fb commit 01f4afb
Show file tree
Hide file tree
Showing 6 changed files with 1,613 additions and 1,544 deletions.
13 changes: 8 additions & 5 deletions mstarpy/error.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
"""module to raise error"""

def not_200_response(url,response):

def not_200_response(url, response):
"""
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}.""")
raise ConnectionError(
f"""Error {response.status_code}
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.
"""
if not site or country == 'us':
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 {name} ({code}) cannot be scraped.")
Loading

0 comments on commit 01f4afb

Please sign in to comment.