Jul-21-2019, 01:37 PM
I have a python file in which I have written the following data
I have written the code snippet but I am not sure how to print the result as it brought upon errors
@dataclass class Email: resource_uri : str address : str person : str time : str origin : str primary : bool active : bool class DataTracker: """ A class for interacting with the IETF DataTracker. """ def __init__(self): self.session = requests.Session() self.base_url = "https://datatracker.ietf.org" def __del__(self): self.session.close() def email(self, email: str): """ Lookup information about an email address in the datatracker. Parameters: email : the email address to lookup Returns: An Email object """ response = self.session.get(self.base_url + "/api/v1/person/email/" + email + "/", verify=True) if response.status_code == 200: return Pavlova().from_mapping(response.json(), Email) else: return NoneHow do I print the details of an object of email type and a particular attribute say "address" of the email??
I have written the code snippet but I am not sure how to print the result as it brought upon errors
import datatracker ##Creating an object of Datatracker type datatracker_object=datatracker.DataTracker() ## calling the email function and storing in object email_object=datatracker_object.email('https://datatracker.ietf.org/api/v1/person/email/[email protected]/') print(email_object['address'])Kindly help.Thanks