diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-06-24 10:05:22 +0200 |
|---|---|---|
| committer | Georgios Andreadis <info@gandreadis.com> | 2020-06-24 10:05:22 +0200 |
| commit | c7f773b027019086153f0260b507c8fa173ee5e8 (patch) | |
| tree | 982048b9a117f1c03abeb26ab84d70f4a82115f8 /opendc/util/rest.py | |
| parent | bae760a62fc6a480fbe615dff6a7de03c7fd6d1d (diff) | |
Fix API serialization issues
Diffstat (limited to 'opendc/util/rest.py')
| -rw-r--r-- | opendc/util/rest.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/opendc/util/rest.py b/opendc/util/rest.py index d5df5306..d892a358 100644 --- a/opendc/util/rest.py +++ b/opendc/util/rest.py @@ -40,16 +40,12 @@ class Request(object): # Parse the path and import the appropriate module try: - self.path = message['path'].encode('ascii', 'ignore').strip('/') + self.path = message['path'].strip('/') module_base = 'opendc.api.{}.endpoint' - module_path = self.path.translate(None, '{}').replace('/', '.') + module_path = self.path.replace('/', '.') self.module = importlib.import_module(module_base.format(module_path)) - - except UnicodeError: - raise exceptions.UnimplementedEndpointError('Non-ASCII path') - except ImportError: raise exceptions.UnimplementedEndpointError('Unimplemented endpoint: {}.'.format(self.path)) @@ -68,7 +64,7 @@ class Request(object): self.google_id = self._verify_token(self.token) except crypt.AppIdentityError as e: - raise exceptions.AuthorizationTokenError(e.message) + raise exceptions.AuthorizationTokenError(e) def _verify_token(self, token): """Return the ID of the signed-in user. |
