I have some dispute with a colleague. I work with some REST-service, from which I get always same type data.
class File():
def __init__(self, name, created, modified, media_type, path, md5, type, mime_type, size,
public_key=None, public_url=None, preview=None):
self.public_url = public_url
self.preview = preview
self.name = name
self.created = created
self.modified = modified
self.path = path
self.type = type
self.media_type = media_type
self.md5 = md5
self.mime_type = mime_type
self.size = size
The following code snippet demonstrate, how I work with File class
:
def get_list_of_all_files(self):
url = self._base_url + "/resources/files"
r = requests.get(url, headers=self.base_headers)
json_dict = r.json()
files = []
for item in json_dict["items"]:
f = File(**item)
files.append(f)
return files
My colleague says that the constructor is very large, and this code is horrible. Is he right? How should look like this code?