Shinya Okano avatar Shinya Okano committed c57b4f7


Comments (0)

Files changed (3)

+export PYTHONPATH=`pwd`
+python skypelaunchd/


     def launch_skype(self, username, password, dispnum):
-'launch skype username=%s, dispnum=%d' % (
+'launch skype username=%s, dispnum=%s' % (
             username, dispnum))
         return_code =
-            [self.get_script_path(), username, password, dispnum])
-        self.launched(username, password, dispnum, return_code)
+            [self.get_script_path(), username, password, str(dispnum)])
+        self.launched(username, dispnum, return_code)
         return return_code
     def launched(self, username, dispnum, return_code):


     def __call__(self, environ, start_response):
         """entry point
-        http_method = environ.get('HTTP_METHOD')
+        http_method = environ.get('REQUEST_METHOD')
         path = environ.get('PATH_INFO')
         params = cgi.parse_qs(environ.get('QUERY_STRING', ''))
         self.dispatch(path, http_method, params, environ, start_response)
-    def dispatch(path, http_method, params, environ, start_response):
+    def dispatch(self, path, http_method, params, environ, start_response):
         if http_method != 'GET':
             return self.badrequest(start_response)
+        if path != '/':
+            return self.badrequest(start_response)
         username = params.get('username') and params['username'][0]
         password = params.get('password') and params['password'][0]
         dispnum = params.get('dispnum') and params['dispnum'][0]
+        try:
+            dispnum = int(dispnum)
+        except ValueError:
+            return self.badrequest(start_response)
         pid = self.launch(username, password, dispnum)
         return self.ok(pid, start_response)
         start_response('400 BadRequest', [
             ('Content-Type', 'application/json')
-        return '{"status": ""}'
+        return '{"status": "NG"}'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.