Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Looker API Get/Set Setting endpoint is incomplete in Python

Hello, I am using Python to query the Looker API. I am having issues with the Setting type. Whether I try to use a GET or a PATCH request it looks like I can only do so for about half of the objects within the Setting type, more precisely everything between "extension_framework_enabled" and "onboarding_enabled". I am not able to get nor set settings from "timezone" - including "email_domain_allowlist" which is the one I am interested in.

What I'm doing when trying to get settings:

 

 

 

import looker_sdk

sdk = looker_sdk.init40("looker.ini")

def get_email_domain_allowlist():
    email_domain_allowlist = sdk.get_setting()
    return email_domain_allowlist

if __name__ == "__main__":
    print(get_email_domain_allowlist())

'''Returns the below
Setting(extension_framework_enabled=True, extension_load_url_enabled=True, marketplace_auto_install_enabled=False, marketplace_enabled=True, privatelabel_configuration=PrivatelabelConfiguration(logo_file=None, logo_url='', favicon_file=None, favicon_url='', default_title='', show_help_menu=True, show_docs=True, show_email_sub_options=False, allow_looker_mentions=True, allow_looker_links=True, custom_welcome_email_advanced=False, setup_mentions=False, alerts_logo=False, alerts_links=False, folders_mentions=False), custom_welcome_email=CustomWelcomeEmail(enabled=False, content='<span style="font-size:16px"><span>Hi there,<br />\n<br />\nAn admin has given you access to Looker. Once you&#39;ve activated your account you&#39;ll be able to dig deeper and do more with your data.<br />\n<br />\nReady to love your analytics? Let&#39;s begin...</span></span>\n<br />', subject='Welcome to Looker', header='You&#39;ve been invited to join Looker!'), onboarding_enabled=True)
'''

 

 

 

 What I'm doing when trying to set settings - note that when using "onboarding_enabled" for example I can see the setting being changed:

 

 

 

import looker_sdk

sdk = looker_sdk.init40("looker.ini")

def manage_email_domain_allowlist():
    email_domain_allowlist = ["google.com", "gmail.com"]
    sdk.set_setting(body=looker_sdk.models40.Setting(email_domain_allowlist=email_domain_allowlist))

if __name__ == "__main__":
    manage_email_domain_allowlist()

'''Returns the below
Traceback (most recent call last):
  File "/Users/thibaulthe/GitHub/looker-admin/scripts/configs/general/settings/manage_email_domain_allowlist.py", line 10, in <module>
    manage_email_domain_allowlist()
  File "/Users/thibaulthe/GitHub/looker-admin/scripts/configs/general/settings/manage_email_domain_allowlist.py", line 7, in manage_email_domain_allowlist
    sdk.set_setting(body=looker_sdk.models40.Setting(email_domain_allowlist=email_domain_allowlist))
TypeError: __init__() got an unexpected keyword argument 'email_domain_allowlist'
'''

 

 

 

Thanks for your help,

Thibonacci

0 1 163
1 REPLY 1

Just in case someone is facing the same issue: it does work when using the requests module rather than looker_sdk, so it looks like it's an issue with the Python SDK rather than the API itself.