Skip to content
This repository was archived by the owner on Dec 10, 2018. It is now read-only.

Commit

Permalink
Support Python 2.6 by using keywords for string.format.
Browse files Browse the repository at this point in the history
  • Loading branch information
keitheis committed Jun 30, 2016
1 parent 0edd37a commit 9609a82
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions thriftpy/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
from thriftpy.transport.buffered import TBufferedTransport


HTTP_URI = '{scheme}://{host}:{port}{path}'


class TFileObjectTransport(TTransportBase):
"""Wraps a file-like object to make it work as a Thrift transport."""

Expand Down Expand Up @@ -256,7 +259,7 @@ def make_client(service, host, port, path='', scheme='http',
proto_factory=TBinaryProtocolFactory(),
trans_factory=TBufferedTransportFactory(),
timeout=4000):
uri = '{}://{}:{}{}'.format(scheme, host, port, path)
uri = HTTP_URI.format(scheme=scheme, host=host, port=port, path=path)
http_socket = THttpClient(uri, timeout)
transport = trans_factory.get_transport(http_socket)
iprot = proto_factory.get_protocol(transport)
Expand All @@ -269,7 +272,7 @@ def client_context(service, host, port, path='', scheme='http',
proto_factory=TBinaryProtocolFactory(),
trans_factory=TBufferedTransportFactory(),
timeout=4000):
uri = '{}://{}:{}{}'.format(scheme, host, port, path)
uri = HTTP_URI.format(scheme=scheme, host=host, port=port, path=path)
http_socket = THttpClient(uri, timeout)
transport = trans_factory.get_transport(http_socket)
try:
Expand Down

0 comments on commit 9609a82

Please sign in to comment.