diff --git a/src/APIHandler.py b/src/APIHandler.py index 31bcfcd..9a749f7 100644 --- a/src/APIHandler.py +++ b/src/APIHandler.py @@ -9,7 +9,7 @@ class APIHandler: '''Init method, apikey suggested but not required (empty by default).''' self.auth = {"Authorization" : apikey} self.content = {"Content-Type" : "application/json"} - self.dump = {**self.auth, **self.content} + self.header = {**self.auth, **self.content} self.elaburl = ELABFTW_API_URL def get_entry_from_elabid(self, elabid, entryType="items"): ''' @@ -18,7 +18,7 @@ class APIHandler: Entry type can be either "experiments" or "items". ''' # TO-DO: validation and error handling on entryType value. - header = self.dump + header = self.header response = requests.get( headers = header, url = f"{self.elaburl}/{entryType}/{elabid}", diff --git a/src/classes.py b/src/classes.py index c0d23bb..d42b4ee 100644 --- a/src/classes.py +++ b/src/classes.py @@ -133,5 +133,5 @@ class Material: if __name__=="__main__": head = Header("MyApiKey-123456789abcdef") - print(f"Example header:\n\t{head.dump}\n") + print(f"Example header:\n\t{head.header}\n") print("Warning: you're not supposed to be running this as the main program.") \ No newline at end of file diff --git a/tests/chained_requests.py b/tests/chained_requests.py index 23fe802..c8621c8 100644 --- a/tests/chained_requests.py +++ b/tests/chained_requests.py @@ -9,13 +9,13 @@ class Header: '''Init method, apikey suggested but not required (empty by default).''' self.auth = {"Authorization" : apikey} self.content = {"Content-Type" : "application/json"} - self.dump = {**self.auth, **self.content} + self.header = {**self.auth, **self.content} def get_entry_from_elabid(elabid, entryType="items"): ''' Function which returns entrypoint data (as dictionary) from its elabid. ''' - header = Header(apikey).dump + header = Header(apikey).header response = requests.get( headers = header, url = f"{ELABFTW_API_URL}/{entryType}/{elabid}",