From 27b2f5cd94089ddc1a4ac1ef0aa5985aa15cbb4bf9eb3bd0e3a4372bb7538140 Mon Sep 17 00:00:00 2001 From: PioApocalypse Date: Tue, 27 Jan 2026 16:44:55 +0100 Subject: [PATCH] adds (http requests) header class --- src/classes.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/classes.py 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