diff --git a/src/classes.py b/src/classes.py new file mode 100644 index 0000000..802c9b5 --- /dev/null +++ b/src/classes.py @@ -0,0 +1,17 @@ +class Header: + ''' + Class to standardize the format of the headers of our http requests. + ''' + def __init__(self, apikey=""): + '''Init method, apikey suggested but not required (empty by default).''' + self.auth = {"Authorization" : apikey} + self.content = {"Content-Type" : "application/json"} + def dump(self): + '''Dumps the header in form of a dictionary.''' + dump = {**self.auth, **self.content} + return dump + +if __name__=="__main__": + head = Header("MyApiKey-123456789abcdef") + print(f"Example header: {head.dump()}") + print("Warning: you're not supposed to be running this as the main program.") \ No newline at end of file