Skip to content

Commit

Permalink
removed httplient from net and added the httpurl stand-alone module i…
Browse files Browse the repository at this point in the history
…n utils
  • Loading branch information
lsbardel committed May 12, 2012
1 parent b7a7c3e commit 79b7567
Show file tree
Hide file tree
Showing 23 changed files with 710 additions and 752 deletions.
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
*.pyc
*.pyd
*.so
build/*
docs/build/*
dist/*
htmlcov/*
__pycache__
build
docs/build
dist
htmlcov
htmlprof
.coverage
.project
.pydevproject
cfg.py
MANIFEST
.settings/*
.settings
lib/src/parser.c
pulsar/http/cparser/parser.*
3 changes: 1 addition & 2 deletions pulsar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class CLEAR_ERRORS(object):
from .utils.exceptions import *
from .utils.sock import *
from .utils import system
from .utils.py2py3 import ispy3k, to_string, is_string, native_str,\
to_bytestring
from .utils.httpurl import ispy3k, to_string, native_str, to_bytes
platform = system.platform

from .utils.config import *
Expand Down
5 changes: 2 additions & 3 deletions pulsar/apps/rpc/handlers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sys
import inspect

from pulsar import make_async, net, NOT_DONE, LogginMixin, to_bytestring,\
Failure
from pulsar import make_async, net, NOT_DONE, LogginMixin, to_bytes, Failure
from pulsar.utils.tools import checkarity
from pulsar.apps.wsgi import WsgiResponse

Expand Down Expand Up @@ -145,7 +144,7 @@ def default_content(self):

self.status_code = status_code
self.content_type = request.content_type
yield to_bytestring(result)
yield to_bytes(result)


class MetaRpcHandler(type):
Expand Down
3 changes: 1 addition & 2 deletions pulsar/apps/rpc/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

import pulsar
from pulsar.utils.tools import gen_unique_id
from pulsar.net import HttpClient
from pulsar.utils.http import to_string
from pulsar.utils.httpurl import to_string, HttpClient
from pulsar.utils.py2py3 import range
from pulsar.utils.jsontools import DefaultJSONEncoder, DefaultJSONHook

Expand Down
4 changes: 2 additions & 2 deletions pulsar/apps/ws/handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from uuid import uuid4

from pulsar.utils.py2py3 import to_bytestring
from pulsar import to_bytes

from .frame import *

Expand Down Expand Up @@ -105,7 +105,7 @@ def on_close(self):
def write_message(self, message, binary=False):
"""Sends the given message to the client of this Web Socket."""
msg = frame(version = self.version,
message = to_bytestring(message),
message = to_bytes(message),
binary = binary)
self.stream.write(msg)

Expand Down
6 changes: 3 additions & 3 deletions pulsar/apps/ws/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from functools import partial

import pulsar
from pulsar.utils.py2py3 import ispy3k, to_bytestring, native_str, BytesIO,\
itervalues
from pulsar.utils.httpurl import ispy3k, to_bytes, native_str, itervalues
from pulsar.utils.py2py3 import BytesIO
from pulsar.apps.wsgi import WsgiResponse

if ispy3k:
Expand Down Expand Up @@ -147,7 +147,7 @@ def handle_handshake(self, environ, start_response):
return client.start(environ, ws_protocols, ws_extensions)

def challenge_response(self, key):
sha1 = hashlib.sha1(to_bytestring(key+self.WS_KEY))
sha1 = hashlib.sha1(to_bytes(key+self.WS_KEY))
return native_str(base64.b64encode(sha1.digest()))

def get_parser(self):
Expand Down
5 changes: 2 additions & 3 deletions pulsar/apps/wsgi/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

import pulsar
from pulsar import make_async, Deferred, raise_failure, NOT_DONE
from pulsar.utils.http import parse_authorization_header, Headers,\
SimpleCookie, set_cookie
from pulsar.net import responses
from pulsar.utils.httpurl import parse_authorization_header, Headers,\
SimpleCookie, set_cookie, responses

from .middleware import is_streamed

Expand Down
2 changes: 1 addition & 1 deletion pulsar/async/eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pulsar.utils.system import IObase, IOpoll, close_on_exec, platform, Waker
from pulsar.utils.tools import gen_unique_id
from pulsar.utils.log import Synchronized
from pulsar.utils.collections import WeakList
from pulsar.utils.structures import WeakList

from .defer import Deferred

Expand Down
3 changes: 1 addition & 2 deletions pulsar/async/iostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class IOStream(object):
:meth:`on_init` callback.
'''
def __init__(self, socket, max_buffer_size=None,
read_chunk_size = None, actor = None,
**kwargs):
read_chunk_size=None, actor=None, **kwargs):
self.socket = socket
self.socket.setblocking(self.blocking())
self.MAX_BODY = 1024 * 128
Expand Down
2 changes: 1 addition & 1 deletion pulsar/lib/fallback/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import sys
import zlib

from pulsar.utils.http import *
from pulsar.utils.httpurl import *


__all__ = ['HttpParser',
Expand Down
4 changes: 1 addition & 3 deletions pulsar/net/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
'''\
The ``net`` module provides you with asynchronous networked primitive
'''The ``net`` module provides asynchronous networked primitive
called ``stream``. It can be assessed by::
from pulsar import net
'''
from .base import *
from .tcp import *
from .http import *
from .client import *



Expand Down
83 changes: 0 additions & 83 deletions pulsar/net/client/__init__.py

This file was deleted.

62 changes: 0 additions & 62 deletions pulsar/net/client/_httplib2.py

This file was deleted.

Loading

0 comments on commit 79b7567

Please sign in to comment.