def set_geo_block_for_namespace(namespace_name, iso_country_code): NamespaceGeoRestriction.create( namespace=User.get(username=namespace_name), description="", unstructured_json={}, restricted_region_iso_code=iso_country_code, ) return "OK"
def list_namespace_geo_restrictions(namespace_name): """ Returns all of the defined geographic restrictions for the given namespace. """ return NamespaceGeoRestriction.select().join(User).where( User.username == namespace_name)