MCPcopy Create free account
hub / github.com/mlco2/codecarbon / _get_headers

Method _get_headers

codecarbon/core/api_client.py:66–73  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

64 self._create_run(self.experiment_id)
65
66 def _get_headers(self):
67 headers = {"Content-Type": "application/json"}
68 if self.api_key:
69 # set the x-api-token header
70 headers["x-api-token"] = self.api_key
71 elif self.access_token:
72 headers["Authorization"] = f"Bearer {self.access_token}"
73 return headers
74
75 def set_access_token(self, token: str):
76 """This method sets the access token to be used for the API.

Callers 14

check_authMethod · 0.95
create_organizationMethod · 0.95
get_organizationMethod · 0.95
update_organizationMethod · 0.95
create_projectMethod · 0.95
get_projectMethod · 0.95
add_emissionMethod · 0.95
_create_runMethod · 0.95
add_experimentMethod · 0.95

Calls

no outgoing calls