PageRenderTime 131ms CodeModel.GetById 114ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/jsonrpc/public/services/jsonrpc/http.py

http://pyjamas.googlecode.com/
Python | 34 lines | 12 code | 3 blank | 19 comment | 0 complexity | 258fea72316378cb400f25908cfcca4a MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. """
  2. Copyright (c) 2006 Jan-Klaas Kollhof
  3. This file is part of jsonrpc.
  4. jsonrpc is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This software is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this software; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. """
  16. from jsonrpc import SimpleServiceHandler
  17. import urllib2
  18. class HTTPClientConnectionHandler(SimpleServiceHandler):
  19. def __init__(self, url, service,messageDelimiter=""):
  20. self.url = url
  21. SimpleServiceHandler.__init__(self, service,messageDelimiter=messageDelimiter)
  22. def send(self, data):
  23. req = urllib2.Request(self.url, data)
  24. resp = urllib2.urlopen(req)
  25. self.handlePartialData(resp.read())