changes Header.dump from method to attribute

This commit is contained in:
2026-01-27 22:37:26 +01:00
parent da074b027b
commit b771fedf49
2 changed files with 2 additions and 6 deletions

View File

@@ -6,10 +6,7 @@ class Header:
'''Init method, apikey suggested but not required (empty by default).''' '''Init method, apikey suggested but not required (empty by default).'''
self.auth = {"Authorization" : apikey} self.auth = {"Authorization" : apikey}
self.content = {"Content-Type" : "application/json"} self.content = {"Content-Type" : "application/json"}
def dump(self): self.dump = {**self.auth, **self.content}
'''Dumps the header in form of a dictionary.'''
dump = {**self.auth, **self.content}
return dump
if __name__=="__main__": if __name__=="__main__":
head = Header("MyApiKey-123456789abcdef") head = Header("MyApiKey-123456789abcdef")

View File

@@ -41,7 +41,6 @@ def get_sample_layers_data(elabid):
return result return result
apikey = getpass("Paste API key here: ") # consider replacing with .env file apikey = getpass("Paste API key here: ") # consider replacing with .env file
header = Header(apikey) header = Header(apikey).dump
header = header.dump()
result = get_sample_layers_data(1108) # edit id at will in case of deletion of remote source result = get_sample_layers_data(1108) # edit id at will in case of deletion of remote source
print(json.dumps(result)) print(json.dumps(result))