Skip to content

Commit ad7ffb7

Browse files
committed
Add read only option to configuration
1 parent a255fc5 commit ad7ffb7

2 files changed

Lines changed: 38 additions & 40 deletions

File tree

.idea/workspace.xml

Lines changed: 34 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hdx/configuration.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ def __init__(self, **kwargs):
9999
if self.hdx_site not in self.data:
100100
raise ConfigurationError('%s not defined in configuration!' % self.hdx_site)
101101

102-
def get_api_key(self) -> str:
102+
def get_api_key(self) -> Optional[str]:
103103
"""
104104
105105
Returns:
106-
str: HDX api key
106+
Optional[str]: HDX api key or None if read only
107107
108108
"""
109+
if self.hdx_read_only:
110+
return None
109111
return self.data['api_key']
110112

111113
def get_hdx_site_url(self) -> str:

0 commit comments

Comments
 (0)