Merge "Remove dependency fallback for Python 2"
This commit is contained in:
commit
6735dc4a6a
@ -15,10 +15,7 @@ import functools
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import uuidutils
|
||||
import swiftclient
|
||||
try: # Python3
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError: # Python2
|
||||
from urllib import quote_plus
|
||||
from urllib.parse import quote_plus
|
||||
|
||||
from zaqar import storage
|
||||
from zaqar.storage import errors
|
||||
|
@ -13,16 +13,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import asyncio
|
||||
import socket
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import netutils
|
||||
|
||||
try:
|
||||
import asyncio
|
||||
except ImportError:
|
||||
import trollius as asyncio
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.conf import drivers_transport_websocket
|
||||
from zaqar.i18n import _
|
||||
|
@ -13,7 +13,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import asyncio
|
||||
import datetime
|
||||
import email
|
||||
import io
|
||||
import sys
|
||||
|
||||
@ -25,18 +27,6 @@ from oslo_utils import timeutils
|
||||
import pytz
|
||||
import txaio
|
||||
|
||||
try:
|
||||
import asyncio
|
||||
except ImportError:
|
||||
import trollius as asyncio
|
||||
|
||||
try:
|
||||
import mimetools
|
||||
Message = mimetools.Message
|
||||
except ImportError:
|
||||
import email
|
||||
Message = email.message_from_binary_file
|
||||
|
||||
from zaqar.common import consts
|
||||
|
||||
|
||||
@ -253,7 +243,8 @@ class NotificationProtocol(asyncio.Protocol):
|
||||
|
||||
if self._state == 'HEADERS' and b'\r\n\r\n' in self._data:
|
||||
headers, self._data = self._data.split(b'\r\n\r\n', 1)
|
||||
headers = Message(io.BytesIO(headers))
|
||||
headers = email.message_from_binary_file(io.BytesIO(headers))
|
||||
|
||||
# try both cases of content-length for backwards compatibility
|
||||
length = headers.get(b'content-length',
|
||||
headers.get('Content-Length'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user