54 lines
1.1 KiB
Python
54 lines
1.1 KiB
Python
|
class Url:
|
||
|
"""
|
||
|
Class to build the python challenge url with the solution string and an
|
||
|
optional slug.
|
||
|
"""
|
||
|
|
||
|
def __init__(self):
|
||
|
self._url = ''
|
||
|
self._slug = 'html'
|
||
|
self._solution = ''
|
||
|
|
||
|
BASE_URL = 'http://www.pythonchallenge.com/pc/def'
|
||
|
|
||
|
@property
|
||
|
def url(self):
|
||
|
"""
|
||
|
Gets the url string of the builder.
|
||
|
:return: url string
|
||
|
"""
|
||
|
return f'{self.BASE_URL}/{self.solution}.{self.slug}'
|
||
|
|
||
|
@property
|
||
|
def solution(self):
|
||
|
"""
|
||
|
Returns the solution string
|
||
|
:return: solution string
|
||
|
"""
|
||
|
return self._solution
|
||
|
|
||
|
@solution.setter
|
||
|
def solution(self, solution):
|
||
|
"""
|
||
|
Sets the solution string
|
||
|
:param solution: str
|
||
|
"""
|
||
|
self._solution = solution
|
||
|
|
||
|
@property
|
||
|
def slug(self):
|
||
|
"""
|
||
|
Returns the slug string
|
||
|
:return: slug string
|
||
|
"""
|
||
|
return self._slug
|
||
|
|
||
|
@slug.setter
|
||
|
def slug(self, slug):
|
||
|
"""
|
||
|
Sets the slug string
|
||
|
:param slug: str
|
||
|
:return: slug string
|
||
|
"""
|
||
|
self._slug = slug
|