File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -534,6 +534,16 @@ def transport(self, sid):
534534        """ 
535535        return  self .eio .transport (sid )
536536
537+     def  get_environ (self , sid , namespace = None ):
538+         """Return the WSGI environ dictionary for a client. 
539+ 
540+         :param sid: The session of the client. 
541+         :param namespace: The Socket.IO namespace. If this argument is omitted 
542+                           the default namespace is used. 
543+         """ 
544+         eio_sid  =  self .manager .eio_sid_from_sid (sid , namespace  or  '/' )
545+         return  self .environ .get (eio_sid )
546+ 
537547    def  handle_request (self , environ , start_response ):
538548        """Handle an HTTP request from the client. 
539549
Original file line number Diff line number Diff line change @@ -746,6 +746,14 @@ def is_asyncio_based(self):
746746        with  pytest .raises (ValueError ):
747747            s .register_namespace (AsyncNS ())
748748
749+     def  test_get_environ (self , eio ):
750+         s  =  server .Server ()
751+         s ._handle_eio_connect ('123' , 'environ' )
752+         s ._handle_eio_message ('123' , '0' )
753+         sid  =  s .manager .sid_from_eio_sid ('123' , '/' )
754+         assert  s .get_environ (sid ) ==  'environ' 
755+         assert  s .get_environ ('foo' ) is  None 
756+ 
749757    def  test_logger (self , eio ):
750758        s  =  server .Server (logger = False )
751759        assert  s .logger .getEffectiveLevel () ==  logging .ERROR 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments