New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

python-socketio

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-socketio - pypi Package Compare versions

Comparing version
5.15.0
to
5.15.1
+1
-1
PKG-INFO
Metadata-Version: 2.4
Name: python-socketio
Version: 5.15.0
Version: 5.15.1
Summary: Socket.IO server and client for Python

@@ -5,0 +5,0 @@ Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>

[project]
name = "python-socketio"
version = "5.15.0"
version = "5.15.1"
license = {text = "MIT"}

@@ -5,0 +5,0 @@ authors = [

Metadata-Version: 2.4
Name: python-socketio
Version: 5.15.0
Version: 5.15.1
Summary: Socket.IO server and client for Python

@@ -5,0 +5,0 @@ Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>

@@ -69,2 +69,6 @@ import asyncio

callback = None
if isinstance(data, tuple):
data = list(data)
else:
data = [data]
binary = Packet.data_is_binary(data)

@@ -159,2 +163,7 @@ if binary:

data = Packet.reconstruct_binary(data[0], attachments)
if isinstance(data, list):
if len(data) == 1:
data = data[0]
else:
data = tuple(data)
await super().emit(message['event'], data,

@@ -161,0 +170,0 @@ namespace=message.get('namespace'),

@@ -66,2 +66,6 @@ import base64

callback = None
if isinstance(data, tuple):
data = list(data)
else:
data = [data]
binary = Packet.data_is_binary(data)

@@ -155,2 +159,7 @@ if binary:

data = Packet.reconstruct_binary(data[0], attachments)
if isinstance(data, list):
if len(data) == 1:
data = data[0]
else:
data = tuple(data)
super().emit(message['event'], data,

@@ -157,0 +166,0 @@ namespace=message.get('namespace'),

@@ -61,3 +61,3 @@ import asyncio

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -78,3 +78,3 @@ 'room': None,

'binary': True,
'data': [{'_placeholder': True, 'num': 0}, 'YmFy'],
'data': [[{'_placeholder': True, 'num': 0}], 'YmFy'],
'namespace': '/',

@@ -93,3 +93,3 @@ 'room': None,

'binary': True,
'data': [{'foo': {'_placeholder': True, 'num': 0}}, 'YmFy'],
'data': [[{'foo': {'_placeholder': True, 'num': 0}}], 'YmFy'],
'namespace': '/',

@@ -110,3 +110,3 @@ 'room': None,

'binary': True,
'data': [{'_placeholder': True, 'num': 0}, 'YmFy'],
'data': [[{'_placeholder': True, 'num': 0}], 'YmFy'],
'namespace': '/',

@@ -125,3 +125,3 @@ 'room': None,

'binary': True,
'data': [{'foo': {'_placeholder': True, 'num': 0}}, 'YmFy'],
'data': [[{'foo': {'_placeholder': True, 'num': 0}}], 'YmFy'],
'namespace': '/',

@@ -135,2 +135,82 @@ 'room': None,

async def test_emit_list(self):
await self.pm.emit('foo', [1, 'two'])
self.pm._publish.assert_awaited_once_with(
{
'method': 'emit',
'event': 'foo',
'binary': False,
'data': [[1, 'two']],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
await self.pm.emit('foo', [1, b'two', 'three'])
self.pm._publish.assert_awaited_with(
{
'method': 'emit',
'event': 'foo',
'binary': True,
'data': [
[[1, {'_placeholder': True, 'num': 0}, 'three']], 'dHdv',
],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
async def test_emit_no_arguments(self):
await self.pm.emit('foo', ())
self.pm._publish.assert_awaited_once_with(
{
'method': 'emit',
'event': 'foo',
'binary': False,
'data': [],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
async def test_emit_multiple_arguments(self):
await self.pm.emit('foo', (1, 'two'))
self.pm._publish.assert_awaited_once_with(
{
'method': 'emit',
'event': 'foo',
'binary': False,
'data': [1, 'two'],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
await self.pm.emit('foo', (1, b'two', 'three'))
self.pm._publish.assert_awaited_with(
{
'method': 'emit',
'event': 'foo',
'binary': True,
'data': [
[1, {'_placeholder': True, 'num': 0}, 'three'], 'dHdv',
],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
async def test_emit_with_to(self):

@@ -144,3 +224,3 @@ sid = 'room-mate'

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -161,3 +241,3 @@ 'room': sid,

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/baz',

@@ -178,3 +258,3 @@ 'room': None,

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -195,3 +275,3 @@ 'room': 'baz',

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -215,3 +295,3 @@ 'room': None,

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -311,2 +391,16 @@ 'room': 'baz',

) as super_emit:
await self.pm._handle_emit({'event': 'foo', 'data': ['bar']})
super_emit.assert_awaited_once_with(
'foo',
'bar',
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
async def test_handle_legacy_emit(self):
with mock.patch.object(
async_manager.AsyncManager, 'emit'
) as super_emit:
await self.pm._handle_emit({'event': 'foo', 'data': 'bar'})

@@ -329,2 +423,33 @@ super_emit.assert_awaited_once_with(

'binary': True,
'data': [[{'_placeholder': True, 'num': 0}], 'YmFy'],
})
super_emit.assert_awaited_once_with(
'foo',
b'bar',
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
await self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [[{'foo': {'_placeholder': True, 'num': 0}}], 'YmFy'],
})
super_emit.assert_awaited_with(
'foo',
{'foo': b'bar'},
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
async def test_handle_legacy_emit_binary(self):
with mock.patch.object(
async_manager.AsyncManager, 'emit'
) as super_emit:
await self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [{'_placeholder': True, 'num': 0}, 'YmFy'],

@@ -354,2 +479,74 @@ })

async def test_handle_emit_list(self):
with mock.patch.object(
async_manager.AsyncManager, 'emit'
) as super_emit:
await self.pm._handle_emit({'event': 'foo', 'data': [[1, 'two']]})
super_emit.assert_awaited_once_with(
'foo',
[1, 'two'],
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
await self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [
[[1, {'_placeholder': True, 'num': 0}, 'three']], 'dHdv'
]
})
super_emit.assert_awaited_with(
'foo',
[1, b'two', 'three'],
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
async def test_handle_emit_no_arguments(self):
with mock.patch.object(
async_manager.AsyncManager, 'emit'
) as super_emit:
await self.pm._handle_emit({'event': 'foo', 'data': []})
super_emit.assert_awaited_once_with(
'foo',
(),
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
async def test_handle_emit_multiple_arguments(self):
with mock.patch.object(
async_manager.AsyncManager, 'emit'
) as super_emit:
await self.pm._handle_emit({'event': 'foo', 'data': [1, 'two']})
super_emit.assert_awaited_once_with(
'foo',
(1, 'two'),
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
await self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [
[1, {'_placeholder': True, 'num': 0}, 'three'], 'dHdv'
]
})
super_emit.assert_awaited_with(
'foo',
(1, b'two', 'three'),
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
async def test_handle_emit_with_namespace(self):

@@ -356,0 +553,0 @@ with mock.patch.object(

@@ -73,3 +73,3 @@ import functools

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -90,3 +90,3 @@ 'room': None,

'binary': True,
'data': [{'_placeholder': True, 'num': 0}, 'YmFy'],
'data': [[{'_placeholder': True, 'num': 0}], 'YmFy'],
'namespace': '/',

@@ -105,3 +105,3 @@ 'room': None,

'binary': True,
'data': [{'foo': {'_placeholder': True, 'num': 0}}, 'YmFy'],
'data': [[{'foo': {'_placeholder': True, 'num': 0}}], 'YmFy'],
'namespace': '/',

@@ -122,3 +122,3 @@ 'room': None,

'binary': True,
'data': [{'_placeholder': True, 'num': 0}, 'YmFy'],
'data': [[{'_placeholder': True, 'num': 0}], 'YmFy'],
'namespace': '/',

@@ -137,3 +137,3 @@ 'room': None,

'binary': True,
'data': [{'foo': {'_placeholder': True, 'num': 0}}, 'YmFy'],
'data': [[{'foo': {'_placeholder': True, 'num': 0}}], 'YmFy'],
'namespace': '/',

@@ -147,2 +147,82 @@ 'room': None,

def test_emit_list(self):
self.pm.emit('foo', [1, 'two'])
self.pm._publish.assert_called_once_with(
{
'method': 'emit',
'event': 'foo',
'binary': False,
'data': [[1, 'two']],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
self.pm.emit('foo', [1, b'two', 'three'])
self.pm._publish.assert_called_with(
{
'method': 'emit',
'event': 'foo',
'binary': True,
'data': [
[[1, {'_placeholder': True, 'num': 0}, 'three']], 'dHdv',
],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
def test_emit_no_arguments(self):
self.pm.emit('foo', ())
self.pm._publish.assert_called_once_with(
{
'method': 'emit',
'event': 'foo',
'binary': False,
'data': [],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
def test_emit_multiple_arguments(self):
self.pm.emit('foo', (1, 'two'))
self.pm._publish.assert_called_once_with(
{
'method': 'emit',
'event': 'foo',
'binary': False,
'data': [1, 'two'],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
self.pm.emit('foo', (1, b'two', 'three'))
self.pm._publish.assert_called_with(
{
'method': 'emit',
'event': 'foo',
'binary': True,
'data': [
[1, {'_placeholder': True, 'num': 0}, 'three'], 'dHdv',
],
'namespace': '/',
'room': None,
'skip_sid': None,
'callback': None,
'host_id': '123456',
}
)
def test_emit_with_to(self):

@@ -156,3 +236,3 @@ sid = "ferris"

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -173,3 +253,3 @@ 'room': sid,

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/baz',

@@ -190,3 +270,3 @@ 'room': None,

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -207,3 +287,3 @@ 'room': 'baz',

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -227,3 +307,3 @@ 'room': None,

'binary': False,
'data': 'bar',
'data': ['bar'],
'namespace': '/',

@@ -320,2 +400,14 @@ 'room': 'baz',

with mock.patch.object(manager.Manager, 'emit') as super_emit:
self.pm._handle_emit({'event': 'foo', 'data': ['bar']})
super_emit.assert_called_once_with(
'foo',
'bar',
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
def test_handle_legacy_emit(self):
with mock.patch.object(manager.Manager, 'emit') as super_emit:
self.pm._handle_emit({'event': 'foo', 'data': 'bar'})

@@ -336,2 +428,31 @@ super_emit.assert_called_once_with(

'binary': True,
'data': [[{'_placeholder': True, 'num': 0}], 'YmFy'],
})
super_emit.assert_called_once_with(
'foo',
b'bar',
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [[{'foo': {'_placeholder': True, 'num': 0}}], 'YmFy'],
})
super_emit.assert_called_with(
'foo',
{'foo': b'bar'},
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
def test_handle_legacy_emit_binary(self):
with mock.patch.object(manager.Manager, 'emit') as super_emit:
self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [{'_placeholder': True, 'num': 0}, 'YmFy'],

@@ -361,2 +482,68 @@ })

def test_handle_emit_list(self):
with mock.patch.object(manager.Manager, 'emit') as super_emit:
self.pm._handle_emit({'event': 'foo', 'data': [[1, 'two']]})
super_emit.assert_called_once_with(
'foo',
[1, 'two'],
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [
[[1, {'_placeholder': True, 'num': 0}, 'three']], 'dHdv'
],
})
super_emit.assert_called_with(
'foo',
[1, b'two', 'three'],
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
def test_handle_emit_no_arguments(self):
with mock.patch.object(manager.Manager, 'emit') as super_emit:
self.pm._handle_emit({'event': 'foo', 'data': []})
super_emit.assert_called_once_with(
'foo',
(),
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
def test_handle_emit_multiple_arguments(self):
with mock.patch.object(manager.Manager, 'emit') as super_emit:
self.pm._handle_emit({'event': 'foo', 'data': [1, 'two']})
super_emit.assert_called_once_with(
'foo',
(1, 'two'),
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
self.pm._handle_emit({
'event': 'foo',
'binary': True,
'data': [
[1, {'_placeholder': True, 'num': 0}, 'three'], 'dHdv'
],
})
super_emit.assert_called_with(
'foo',
(1, b'two', 'three'),
namespace=None,
room=None,
skip_sid=None,
callback=None,
)
def test_handle_emit_with_namespace(self):

@@ -363,0 +550,0 @@ with mock.patch.object(manager.Manager, 'emit') as super_emit: