diff --git a/batchspawner/api.py b/batchspawner/api.py index bbaacbcd..514dd0a5 100644 --- a/batchspawner/api.py +++ b/batchspawner/api.py @@ -12,10 +12,16 @@ def post(self): else: # Previous jupyterhub, 0.9.4 and before. user = self.get_current_user() + token = self.get_auth_token() + spawner = None + for s in user.spawners.values(): + if s.api_token == token: + spawner = s + break data = self.get_json_body() for key, value in data.items(): - if hasattr(user.spawner, key): - setattr(user.spawner, key, value) + if hasattr(spawner, key): + setattr(spawner, key, value) self.finish(json.dumps({"message": "BatchSpawner data configured"})) self.set_status(201) diff --git a/batchspawner/singleuser.py b/batchspawner/singleuser.py index afb171a2..e3ffab22 100644 --- a/batchspawner/singleuser.py +++ b/batchspawner/singleuser.py @@ -22,4 +22,4 @@ def main(argv=None): run_path(cmd_path, run_name="__main__") if __name__ == "__main__": - main() \ No newline at end of file + main()