diff --git a/README.md b/README.md index 324fde4..323eab0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,10 @@ fenix_python_sdk #### Instantiating the client * Instantiate an API client object in your source code -client = fenixedu.FenixEduClient(config) +client = fenixedu.FenixEduClient(config, LOCALE) + +where LOCALE is an optional argument. LOCALE can be 'pt-PT' or 'en-GB'. + ### Authentication diff --git a/fenixedu/__init__.py b/fenixedu/__init__.py index 62f46b5..49dd073 100644 --- a/fenixedu/__init__.py +++ b/fenixedu/__init__.py @@ -15,17 +15,19 @@ class FenixEduClient(object): - def __init__(self, config): + def __init__(self, config, local = None): self.config = config self.api_url = self.config.base_url + self.config.api_endpoint + 'v' + str(self.config.api_version) self.oauth_url = self.config.base_url + endpoints.OAUTH - + self.locale = locale + def _get_api_endpoint_url(self, endpoint, endpoint_params=None): url = self.api_url + '/' + endpoint if endpoint_params: for key, value in endpoint_params.items(): url = url.replace(':' + key, str(value), 1) - + if self.locale: + url = url + '?lang=' + str(self.locale) return url def _get_oauth_endpoint_url(self, endpoint):