@@ -46,7 +46,7 @@ def parse_m_get(response):
4646 res = []
4747 for item in response :
4848 res .append ({ nativestr (item [0 ]) : [list_to_dict (item [1 ]),
49- item [2 ], float (item [3 ])]})
49+ item [2 ][ 0 ] , float (item [2 ][ 1 ])]})
5050 return res
5151
5252def parseToList (response ):
@@ -105,12 +105,16 @@ def __init__(self, *args, **kwargs):
105105 for k in MODULE_CALLBACKS :
106106 self .set_response_callback (k , MODULE_CALLBACKS [k ])
107107
108-
109108 @staticmethod
110109 def appendUncompressed (params , uncompressed ):
111110 if uncompressed :
112111 params .extend (['UNCOMPRESSED' ])
113112
113+ @staticmethod
114+ def appendWithLabels (params , with_labels ):
115+ if with_labels :
116+ params .extend (['WITHLABELS' ])
117+
114118 @staticmethod
115119 def appendRetention (params , retention ):
116120 if retention is not None :
@@ -264,8 +268,7 @@ def mrange(self, from_time, to_time, filters, count=None,
264268 self .appendCount (params , count )
265269 if aggregation_type is not None :
266270 self .appendAggregation (params , aggregation_type , bucket_size_msec )
267- if with_labels :
268- params .extend (['WITHLABELS' ])
271+ self .appendWithLabels (params , with_labels )
269272 params .extend (['FILTER' ])
270273 params += filters
271274 return self .execute_command (self .MRANGE_CMD , * params )
@@ -274,9 +277,11 @@ def get(self, key):
274277 """Gets the last sample of ``key``"""
275278 return self .execute_command (self .GET_CMD , key )
276279
277- def mget (self , filters ):
280+ def mget (self , filters , with_labels = False ):
278281 """Get the last samples matching the specific ``filter``."""
279- params = ['FILTER' ]
282+ params = []
283+ self .appendWithLabels (params , with_labels )
284+ params .extend (['FILTER' ])
280285 params += filters
281286 return self .execute_command (self .MGET_CMD , * params )
282287
0 commit comments