dimanche 22 novembre 2020

Implement a UML class model to a python code

According to the given UML class model UML Class model i want to access some activity objects from https://www.boredapi.com/ and have them sorted with a selected sort key. To facilitate the code for the uml class model i have written the following code.

class Activity_:
def __init__(self, payload{}):
    def call_api(self, payload{}):
        if len(payload)==1:
            import requests
            data=requests.get("http://www.boredapi.com/api/activity/? key=%s"%paylod['key']).json()
        else:
            import requests 
            data=requests.get("http://www.boredapi.com/api/activity/").json()

Can someone guide me how shall i implement the rest of the UML model and use str and repr?

Aucun commentaire:

Enregistrer un commentaire