Skip to content
Snippets Groups Projects
Commit 5b784037 authored by daniquilez's avatar daniquilez
Browse files

linter corrections

parent 53458480
No related branches found
No related tags found
3 merge requests!253[REL] Release 06/11/23,!238Feature/energy communities translations,!224Community maps fetcher v1
Pipeline #59624 passed
......@@ -16,6 +16,23 @@ class Client:
def __init__(self, baseurl):
self.baseurl = baseurl
def get(self, route, token=None):
"""Send a GET HTTP requests
Args:
route (str): String with the route to the endpoint
Return:
**response**: Return the response object
"""
headers = {"Authorization": token, "Content-Type": "application/json"}
return self._send_request(
verb="GET",
url=self._format_url(route),
payload={},
extra_headers=headers,
)
def post(self, route, token=None, body=None):
"""Send a POST HTTP requests
......@@ -26,10 +43,7 @@ class Client:
Return:
**response**: Return the response object
"""
headers = {
"Authorization": token,
"Content-Type": "application/json"
}
headers = {"Authorization": token, "Content-Type": "application/json"}
return self._send_request(
verb="POST",
url=self._format_url(route),
......@@ -47,10 +61,7 @@ class Client:
Return:
**response**: Return the response object
"""
headers = {
"Authorization": token,
"Content-Type": "application/json"
}
headers = {"Authorization": token, "Content-Type": "application/json"}
return self._send_request(
verb="PUT", url=self._format_url(route), payload=body, extra_headers=headers
)
......@@ -84,8 +95,7 @@ class Client:
if headers.get("Content-Type") == "application/json":
payload = json.dumps(payload)
logger.info("{verb} {url} \n {body}".format(
verb=verb, url=url, body=payload))
logger.info("{verb} {url} \n {body}".format(verb=verb, url=url, body=payload))
try:
response = requests.request(
......
......@@ -10,6 +10,15 @@ class LandingPage:
self.token = token
self.id = id
def get(self):
"""
Get Landing Page data.
"""
response_data = Client(self.baseurl).get(
"{url_path}/{id}".format(url_path=self._url_path, id=self.id), self.token
)
return response_data
def create(self, body):
"""
Creates a Landing Page instance.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment