F F F F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                 [ 1 0 0 % ] 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   F A I L U R E S   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 _ _ _ _ _ _ _ _ _ _ _   T e s t C o o k b o o k I n t e g r a t i o n . t e s t _ f i n a n c i a l _ d a t a _ i n t e g r a t i o n   _ _ _ _ _ _ _ _ _ _ _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
 >                       y i e l d 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 0 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 5 0 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p   =   s e l f . _ p o o l . h a n d l e _ r e q u e s t ( r e q ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 5 6 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c   f r o m   N o n e 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 3 6 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p o n s e   =   c o n n e c t i o n . h a n d l e _ r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 0 1 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 7 8 :   i n   h a n d l e _ r e q u e s t 
 
         s t r e a m   =   s e l f . _ c o n n e c t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 2 4 :   i n   _ c o n n e c t 
 
         s t r e a m   =   s e l f . _ n e t w o r k _ b a c k e n d . c o n n e c t _ t c p ( * * k w a r g s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ b a c k e n d s \ s y n c . p y : 2 0 7 :   i n   c o n n e c t _ t c p 
 
         w i t h   m a p _ e x c e p t i o n s ( e x c _ m a p ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 m a p   =   { < c l a s s   ' T i m e o u t E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t T i m e o u t ' > ,   < c l a s s   ' O S E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t E r r o r ' > } 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ e x c e p t i o n s ( m a p :   E x c e p t i o n M a p p i n g )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c :     #   n o q a :   P I E 7 8 6 
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   m a p . i t e m s ( ) : 
 
                                 i f   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
 >                                       r a i s e   t o _ e x c ( e x c )   f r o m   e x c 
 
 E                                       h t t p c o r e . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ e x c e p t i o n s . p y : 1 4 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 3 0 7 6 5 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 1 4 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 4 8 :   i n   _ s e n d _ r e q u e s t _ h t t p 
 
         r e s p o n s e   =   h t t p x . p o s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 3 0 4 :   i n   p o s t 
 
         r e t u r n   r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 1 0 9 :   i n   r e q u e s t 
 
         r e t u r n   c l i e n t . r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 8 2 5 :   i n   r e q u e s t 
 
         r e t u r n   s e l f . s e n d ( r e q u e s t ,   a u t h = a u t h ,   f o l l o w _ r e d i r e c t s = f o l l o w _ r e d i r e c t s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 1 4 :   i n   s e n d 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ a u t h ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 4 2 :   i n   _ s e n d _ h a n d l i n g _ a u t h 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ r e d i r e c t s ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 7 9 :   i n   _ s e n d _ h a n d l i n g _ r e d i r e c t s 
 
         r e s p o n s e   =   s e l f . _ s e n d _ s i n g l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 1 0 1 4 :   i n   _ s e n d _ s i n g l e _ r e q u e s t 
 
         r e s p o n s e   =   t r a n s p o r t . h a n d l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 4 9 :   i n   h a n d l e _ r e q u e s t 
 
         w i t h   m a p _ h t t p c o r e _ e x c e p t i o n s ( ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c : 
 
                         m a p p e d _ e x c   =   N o n e 
 
         
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   H T T P C O R E _ E X C _ M A P . i t e m s ( ) : 
 
                                 i f   n o t   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
                                         c o n t i n u e 
 
                                 #   W e   w a n t   t o   m a p   t o   t h e   m o s t   s p e c i f i c   e x c e p t i o n   w e   c a n   f i n d . 
 
                                 #   E g   i f   ` e x c `   i s   a n   ` h t t p c o r e . R e a d T i m e o u t ` ,   w e   w a n t   t o   m a p   t o 
 
                                 #   ` h t t p x . R e a d T i m e o u t ` ,   n o t   j u s t   ` h t t p x . T i m e o u t E x c e p t i o n ` . 
 
                                 i f   m a p p e d _ e x c   i s   N o n e   o r   i s s u b c l a s s ( t o _ e x c ,   m a p p e d _ e x c ) : 
 
                                         m a p p e d _ e x c   =   t o _ e x c 
 
         
 
                         i f   m a p p e d _ e x c   i s   N o n e :     #   p r a g m a :   n o   c o v e r 
 
                                 r a i s e 
 
         
 
                         m e s s a g e   =   s t r ( e x c ) 
 
 >                       r a i s e   m a p p e d _ e x c ( m e s s a g e )   f r o m   e x c 
 
 E                       h t t p x . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 1 8 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 3 0 7 6 5 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 2 8 :   i n   _ c o n n e c t _ h t t p 
 
         r e t u r n   s e l f . _ i n i t i a l i z e ( ) 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 5 9 :   i n   _ i n i t i a l i z e 
 
         r e s p o n s e   =   s e l f . _ s e n d _ r e q u e s t ( r e q u e s t ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 3 0 7 6 5 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s s e ( r e q u e s t ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 2 1 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 0 0 1 8 9 0 > 
 
 s e r v e r _ n a m e   =   ' f i n a n c i a l _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' 
 
 h e a d e r s   =   { ' A u t h o r i z a t i o n ' :   ' B e a r e r   t o k e n ' } ,   c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 3 0 7 6 5 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
 >                       i f   c l i e n t . c o n n e c t ( ) : 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 6 8 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 3 0 7 6 5 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ s s e ( ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 8 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < t e s t s . i n g e s t . t e s t _ c o o k b o o k _ i n t e g r a t i o n . T e s t C o o k b o o k I n t e g r a t i o n   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 7 5 D 4 E A 9 0 > 
 
 m o c k _ m c p _ s e r v e r   =   < M a g i c M o c k   n a m e = ' p o s t '   i d = ' 2 1 7 8 0 5 9 8 7 5 8 5 6 ' > 
 
 
 
         d e f   t e s t _ f i n a n c i a l _ d a t a _ i n t e g r a t i o n ( s e l f ,   m o c k _ m c p _ s e r v e r ) : 
 
                 " " " 
 
                 V a l i d a t e s   t h e   l o g i c   f r o m   c o o k b o o k / u s e _ c a s e s / f i n a n c e / 0 1 _ F i n a n c i a l _ D a t a _ I n t e g r a t i o n . i p y n b 
 
                 " " " 
 
                 #   1 .   I n i t i a l i z e   M C P   i n g e s t o r 
 
                 m c p _ i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
         
 
                 #   2 .   C o n n e c t   t o   f i n a n c i a l   d a t a   M C P   s e r v e r 
 
                 f i n a n c i a l _ m c p _ u r l   =   " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " 
 
         
 
                 #   P a t c h i n g   p r o g r e s s   t r a c k e r   t o   a v o i d   c o n s o l e   o u t p u t   i s s u e s   d u r i n g   t e s t i n g   i f   n e e d e d 
 
                 #   B u t   M C P I n g e s t o r   n o w   h a n d l e s   i t   g r a c e f u l l y   o r   w e   c a n   l e t   i t   r u n . 
 
                 #   W e   n e e d   t o   m o c k   g e t _ p r o g r e s s _ t r a c k e r   t o   a v o i d   ' N o n e T y p e '   e r r o r s   i f   n o t   i n i t i a l i z e d   p r o p e r l y   i n   s o m e   e n v s 
 
                 #   a l t h o u g h   m y   p r e v i o u s   f i x e s   s h o u l d   h a n d l e   i t .   L e t ' s   p a t c h   i t   t o   b e   s a f e   a n d   c l e a n . 
 
                 w i t h   p a t c h ( " s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . g e t _ p r o g r e s s _ t r a c k e r " )   a s   m o c k _ t r a c k e r : 
 
                         t r a c k e r _ i n s t a n c e   =   M a g i c M o c k ( ) 
 
                         m o c k _ t r a c k e r . r e t u r n _ v a l u e   =   t r a c k e r _ i n s t a n c e 
 
         
 
 >                       m c p _ i n g e s t o r . c o n n e c t ( 
 
                                 " f i n a n c i a l _ s e r v e r " , 
 
                                 u r l = f i n a n c i a l _ m c p _ u r l , 
 
                                 h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } 
 
                         ) 
 
 
 
 t e s t s \ i n g e s t \ t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : 1 0 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 0 0 1 8 9 0 > 
 
 s e r v e r _ n a m e   =   ' f i n a n c i a l _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' 
 
 h e a d e r s   =   { ' A u t h o r i z a t i o n ' :   ' B e a r e r   t o k e n ' } ,   c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 F 3 0 7 6 5 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
                         i f   c l i e n t . c o n n e c t ( ) : 
 
                                 s e l f . _ c l i e n t s [ s e r v e r _ n a m e ]   =   c l i e n t 
 
                                 s e l f . l o g g e r . i n f o ( f " C o n n e c t e d   t o   M C P   s e r v e r :   { s e r v e r _ n a m e }   a t   { u r l } " ) 
 
                                 r e t u r n   T r u e 
 
                         e l s e : 
 
                                 r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { s e r v e r _ n a m e } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( 
 
                                 f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " 
 
                         )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   f i n a n c i a l _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 7 6 :   P r o c e s s i n g E r r o r 
 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   C a p t u r e d   l o g   c a l l   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 7 5   F a i l e d   t o   s e n d   H T T P   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 2 0   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 7 2   F a i l e d   t o   i n i t i a l i z e   M C P   p r o t o c o l :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 3 0   F a i l e d   t o   c o n n e c t   v i a   H T T P :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 1 9 7   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ i n g e s t o r : m c p _ i n g e s t o r . p y : 1 7 5   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   f i n a n c i a l _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 _ _ _ _ _ _ _ _ _   T e s t C o o k b o o k I n t e g r a t i o n . t e s t _ s u p p l y _ c h a i n _ d a t a _ i n t e g r a t i o n   _ _ _ _ _ _ _ _ _ _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
 >                       y i e l d 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 0 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 5 0 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p   =   s e l f . _ p o o l . h a n d l e _ r e q u e s t ( r e q ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 5 6 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c   f r o m   N o n e 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 3 6 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p o n s e   =   c o n n e c t i o n . h a n d l e _ r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 0 1 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 7 8 :   i n   h a n d l e _ r e q u e s t 
 
         s t r e a m   =   s e l f . _ c o n n e c t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 2 4 :   i n   _ c o n n e c t 
 
         s t r e a m   =   s e l f . _ n e t w o r k _ b a c k e n d . c o n n e c t _ t c p ( * * k w a r g s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ b a c k e n d s \ s y n c . p y : 2 0 7 :   i n   c o n n e c t _ t c p 
 
         w i t h   m a p _ e x c e p t i o n s ( e x c _ m a p ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 m a p   =   { < c l a s s   ' T i m e o u t E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t T i m e o u t ' > ,   < c l a s s   ' O S E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t E r r o r ' > } 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ e x c e p t i o n s ( m a p :   E x c e p t i o n M a p p i n g )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c :     #   n o q a :   P I E 7 8 6 
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   m a p . i t e m s ( ) : 
 
                                 i f   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
 >                                       r a i s e   t o _ e x c ( e x c )   f r o m   e x c 
 
 E                                       h t t p c o r e . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ e x c e p t i o n s . p y : 1 4 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 A 1 9 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 1 4 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 4 8 :   i n   _ s e n d _ r e q u e s t _ h t t p 
 
         r e s p o n s e   =   h t t p x . p o s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 3 0 4 :   i n   p o s t 
 
         r e t u r n   r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 1 0 9 :   i n   r e q u e s t 
 
         r e t u r n   c l i e n t . r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 8 2 5 :   i n   r e q u e s t 
 
         r e t u r n   s e l f . s e n d ( r e q u e s t ,   a u t h = a u t h ,   f o l l o w _ r e d i r e c t s = f o l l o w _ r e d i r e c t s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 1 4 :   i n   s e n d 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ a u t h ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 4 2 :   i n   _ s e n d _ h a n d l i n g _ a u t h 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ r e d i r e c t s ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 7 9 :   i n   _ s e n d _ h a n d l i n g _ r e d i r e c t s 
 
         r e s p o n s e   =   s e l f . _ s e n d _ s i n g l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 1 0 1 4 :   i n   _ s e n d _ s i n g l e _ r e q u e s t 
 
         r e s p o n s e   =   t r a n s p o r t . h a n d l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 4 9 :   i n   h a n d l e _ r e q u e s t 
 
         w i t h   m a p _ h t t p c o r e _ e x c e p t i o n s ( ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c : 
 
                         m a p p e d _ e x c   =   N o n e 
 
         
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   H T T P C O R E _ E X C _ M A P . i t e m s ( ) : 
 
                                 i f   n o t   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
                                         c o n t i n u e 
 
                                 #   W e   w a n t   t o   m a p   t o   t h e   m o s t   s p e c i f i c   e x c e p t i o n   w e   c a n   f i n d . 
 
                                 #   E g   i f   ` e x c `   i s   a n   ` h t t p c o r e . R e a d T i m e o u t ` ,   w e   w a n t   t o   m a p   t o 
 
                                 #   ` h t t p x . R e a d T i m e o u t ` ,   n o t   j u s t   ` h t t p x . T i m e o u t E x c e p t i o n ` . 
 
                                 i f   m a p p e d _ e x c   i s   N o n e   o r   i s s u b c l a s s ( t o _ e x c ,   m a p p e d _ e x c ) : 
 
                                         m a p p e d _ e x c   =   t o _ e x c 
 
         
 
                         i f   m a p p e d _ e x c   i s   N o n e :     #   p r a g m a :   n o   c o v e r 
 
                                 r a i s e 
 
         
 
                         m e s s a g e   =   s t r ( e x c ) 
 
 >                       r a i s e   m a p p e d _ e x c ( m e s s a g e )   f r o m   e x c 
 
 E                       h t t p x . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 1 8 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 A 1 9 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 2 8 :   i n   _ c o n n e c t _ h t t p 
 
         r e t u r n   s e l f . _ i n i t i a l i z e ( ) 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 5 9 :   i n   _ i n i t i a l i z e 
 
         r e s p o n s e   =   s e l f . _ s e n d _ r e q u e s t ( r e q u e s t ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 A 1 9 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s s e ( r e q u e s t ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 2 1 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 8 8 D 0 > 
 
 s e r v e r _ n a m e   =   ' s u p p l y _ c h a i n _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' 
 
 h e a d e r s   =   { ' A u t h o r i z a t i o n ' :   ' B e a r e r   t o k e n ' } ,   c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 A 1 9 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
 >                       i f   c l i e n t . c o n n e c t ( ) : 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 6 8 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 A 1 9 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ s s e ( ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 8 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < t e s t s . i n g e s t . t e s t _ c o o k b o o k _ i n t e g r a t i o n . T e s t C o o k b o o k I n t e g r a t i o n   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 C 6 1 E 2 D 0 > 
 
 m o c k _ m c p _ s e r v e r   =   < M a g i c M o c k   n a m e = ' p o s t '   i d = ' 2 1 7 8 1 0 5 2 6 0 0 4 8 ' > 
 
 
 
         d e f   t e s t _ s u p p l y _ c h a i n _ d a t a _ i n t e g r a t i o n ( s e l f ,   m o c k _ m c p _ s e r v e r ) : 
 
                 " " " 
 
                 V a l i d a t e s   t h e   l o g i c   f r o m   c o o k b o o k / u s e _ c a s e s / s u p p l y _ c h a i n / 0 1 _ S u p p l y _ C h a i n _ D a t a _ I n t e g r a t i o n . i p y n b 
 
                 " " " 
 
                 m c p _ i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                 s u p p l y _ c h a i n _ m c p _ u r l   =   " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " 
 
         
 
                 w i t h   p a t c h ( " s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . g e t _ p r o g r e s s _ t r a c k e r " )   a s   m o c k _ t r a c k e r : 
 
                         t r a c k e r _ i n s t a n c e   =   M a g i c M o c k ( ) 
 
                         m o c k _ t r a c k e r . r e t u r n _ v a l u e   =   t r a c k e r _ i n s t a n c e 
 
         
 
 >                       m c p _ i n g e s t o r . c o n n e c t ( 
 
                                 " s u p p l y _ c h a i n _ s e r v e r " , 
 
                                 u r l = s u p p l y _ c h a i n _ m c p _ u r l , 
 
                                 h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } 
 
                         ) 
 
 
 
 t e s t s \ i n g e s t \ t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : 1 3 7 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 8 8 D 0 > 
 
 s e r v e r _ n a m e   =   ' s u p p l y _ c h a i n _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' 
 
 h e a d e r s   =   { ' A u t h o r i z a t i o n ' :   ' B e a r e r   t o k e n ' } ,   c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 0 A 1 9 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
                         i f   c l i e n t . c o n n e c t ( ) : 
 
                                 s e l f . _ c l i e n t s [ s e r v e r _ n a m e ]   =   c l i e n t 
 
                                 s e l f . l o g g e r . i n f o ( f " C o n n e c t e d   t o   M C P   s e r v e r :   { s e r v e r _ n a m e }   a t   { u r l } " ) 
 
                                 r e t u r n   T r u e 
 
                         e l s e : 
 
                                 r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { s e r v e r _ n a m e } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( 
 
                                 f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " 
 
                         )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   s u p p l y _ c h a i n _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 7 6 :   P r o c e s s i n g E r r o r 
 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   C a p t u r e d   l o g   c a l l   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 7 5   F a i l e d   t o   s e n d   H T T P   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 2 0   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 7 2   F a i l e d   t o   i n i t i a l i z e   M C P   p r o t o c o l :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 3 0   F a i l e d   t o   c o n n e c t   v i a   H T T P :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 1 9 7   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ i n g e s t o r : m c p _ i n g e s t o r . p y : 1 7 5   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   s u p p l y _ c h a i n _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 _ _ _ _ _ _ _ _ _ _   T e s t C o o k b o o k I n t e g r a t i o n . t e s t _ m e d i c a l _ d a t a b a s e _ i n t e g r a t i o n   _ _ _ _ _ _ _ _ _ _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
 >                       y i e l d 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 0 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 5 0 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p   =   s e l f . _ p o o l . h a n d l e _ r e q u e s t ( r e q ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 5 6 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c   f r o m   N o n e 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 3 6 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p o n s e   =   c o n n e c t i o n . h a n d l e _ r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 0 1 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 7 8 :   i n   h a n d l e _ r e q u e s t 
 
         s t r e a m   =   s e l f . _ c o n n e c t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 2 4 :   i n   _ c o n n e c t 
 
         s t r e a m   =   s e l f . _ n e t w o r k _ b a c k e n d . c o n n e c t _ t c p ( * * k w a r g s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ b a c k e n d s \ s y n c . p y : 2 0 7 :   i n   c o n n e c t _ t c p 
 
         w i t h   m a p _ e x c e p t i o n s ( e x c _ m a p ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 m a p   =   { < c l a s s   ' T i m e o u t E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t T i m e o u t ' > ,   < c l a s s   ' O S E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t E r r o r ' > } 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ e x c e p t i o n s ( m a p :   E x c e p t i o n M a p p i n g )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c :     #   n o q a :   P I E 7 8 6 
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   m a p . i t e m s ( ) : 
 
                                 i f   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
 >                                       r a i s e   t o _ e x c ( e x c )   f r o m   e x c 
 
 E                                       h t t p c o r e . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ e x c e p t i o n s . p y : 1 4 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 8 E D 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 1 4 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 4 8 :   i n   _ s e n d _ r e q u e s t _ h t t p 
 
         r e s p o n s e   =   h t t p x . p o s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 3 0 4 :   i n   p o s t 
 
         r e t u r n   r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 1 0 9 :   i n   r e q u e s t 
 
         r e t u r n   c l i e n t . r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 8 2 5 :   i n   r e q u e s t 
 
         r e t u r n   s e l f . s e n d ( r e q u e s t ,   a u t h = a u t h ,   f o l l o w _ r e d i r e c t s = f o l l o w _ r e d i r e c t s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 1 4 :   i n   s e n d 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ a u t h ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 4 2 :   i n   _ s e n d _ h a n d l i n g _ a u t h 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ r e d i r e c t s ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 7 9 :   i n   _ s e n d _ h a n d l i n g _ r e d i r e c t s 
 
         r e s p o n s e   =   s e l f . _ s e n d _ s i n g l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 1 0 1 4 :   i n   _ s e n d _ s i n g l e _ r e q u e s t 
 
         r e s p o n s e   =   t r a n s p o r t . h a n d l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 4 9 :   i n   h a n d l e _ r e q u e s t 
 
         w i t h   m a p _ h t t p c o r e _ e x c e p t i o n s ( ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c : 
 
                         m a p p e d _ e x c   =   N o n e 
 
         
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   H T T P C O R E _ E X C _ M A P . i t e m s ( ) : 
 
                                 i f   n o t   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
                                         c o n t i n u e 
 
                                 #   W e   w a n t   t o   m a p   t o   t h e   m o s t   s p e c i f i c   e x c e p t i o n   w e   c a n   f i n d . 
 
                                 #   E g   i f   ` e x c `   i s   a n   ` h t t p c o r e . R e a d T i m e o u t ` ,   w e   w a n t   t o   m a p   t o 
 
                                 #   ` h t t p x . R e a d T i m e o u t ` ,   n o t   j u s t   ` h t t p x . T i m e o u t E x c e p t i o n ` . 
 
                                 i f   m a p p e d _ e x c   i s   N o n e   o r   i s s u b c l a s s ( t o _ e x c ,   m a p p e d _ e x c ) : 
 
                                         m a p p e d _ e x c   =   t o _ e x c 
 
         
 
                         i f   m a p p e d _ e x c   i s   N o n e :     #   p r a g m a :   n o   c o v e r 
 
                                 r a i s e 
 
         
 
                         m e s s a g e   =   s t r ( e x c ) 
 
 >                       r a i s e   m a p p e d _ e x c ( m e s s a g e )   f r o m   e x c 
 
 E                       h t t p x . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 1 8 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 8 E D 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 2 8 :   i n   _ c o n n e c t _ h t t p 
 
         r e t u r n   s e l f . _ i n i t i a l i z e ( ) 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 5 9 :   i n   _ i n i t i a l i z e 
 
         r e s p o n s e   =   s e l f . _ s e n d _ r e q u e s t ( r e q u e s t ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 8 E D 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s s e ( r e q u e s t ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 2 1 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 A 9 1 0 > 
 
 s e r v e r _ n a m e   =   ' m e d i c a l _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' 
 
 h e a d e r s   =   N o n e ,   c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 8 E D 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
 >                       i f   c l i e n t . c o n n e c t ( ) : 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 6 8 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 8 E D 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ s s e ( ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 8 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < t e s t s . i n g e s t . t e s t _ c o o k b o o k _ i n t e g r a t i o n . T e s t C o o k b o o k I n t e g r a t i o n   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 C A 5 D A 5 0 > 
 
 m o c k _ m c p _ s e r v e r   =   < M a g i c M o c k   n a m e = ' p o s t '   i d = ' 2 1 7 8 1 0 5 3 2 1 1 6 8 ' > 
 
 
 
         d e f   t e s t _ m e d i c a l _ d a t a b a s e _ i n t e g r a t i o n ( s e l f ,   m o c k _ m c p _ s e r v e r ) : 
 
                 " " " 
 
                 V a l i d a t e s   t h e   l o g i c   f r o m   c o o k b o o k / u s e _ c a s e s / h e a l t h c a r e / 0 5 _ M e d i c a l _ D a t a b a s e _ I n t e g r a t i o n . i p y n b 
 
                 " " " 
 
                 m c p _ i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                 m e d i c a l _ m c p _ u r l   =   " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " 
 
         
 
                 w i t h   p a t c h ( " s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . g e t _ p r o g r e s s _ t r a c k e r " )   a s   m o c k _ t r a c k e r : 
 
                         t r a c k e r _ i n s t a n c e   =   M a g i c M o c k ( ) 
 
                         m o c k _ t r a c k e r . r e t u r n _ v a l u e   =   t r a c k e r _ i n s t a n c e 
 
         
 
 >                       m c p _ i n g e s t o r . c o n n e c t ( 
 
                                 " m e d i c a l _ s e r v e r " , 
 
                                 u r l = m e d i c a l _ m c p _ u r l 
 
                         ) 
 
 
 
 t e s t s \ i n g e s t \ t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : 1 7 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 A 9 1 0 > 
 
 s e r v e r _ n a m e   =   ' m e d i c a l _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' 
 
 h e a d e r s   =   N o n e ,   c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 1 8 E D 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
                         i f   c l i e n t . c o n n e c t ( ) : 
 
                                 s e l f . _ c l i e n t s [ s e r v e r _ n a m e ]   =   c l i e n t 
 
                                 s e l f . l o g g e r . i n f o ( f " C o n n e c t e d   t o   M C P   s e r v e r :   { s e r v e r _ n a m e }   a t   { u r l } " ) 
 
                                 r e t u r n   T r u e 
 
                         e l s e : 
 
                                 r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { s e r v e r _ n a m e } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( 
 
                                 f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " 
 
                         )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   m e d i c a l _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 7 6 :   P r o c e s s i n g E r r o r 
 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   C a p t u r e d   l o g   c a l l   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 7 5   F a i l e d   t o   s e n d   H T T P   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 2 0   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 7 2   F a i l e d   t o   i n i t i a l i z e   M C P   p r o t o c o l :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 3 0   F a i l e d   t o   c o n n e c t   v i a   H T T P :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 1 9 7   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ i n g e s t o r : m c p _ i n g e s t o r . p y : 1 7 5   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   m e d i c a l _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 _ _ _ _ _ _ _ _   T e s t C o o k b o o k I n t e g r a t i o n . t e s t _ t h r e a t _ i n t e l l i g e n c e _ i n t e g r a t i o n   _ _ _ _ _ _ _ _ _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
 >                       y i e l d 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 0 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 5 0 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p   =   s e l f . _ p o o l . h a n d l e _ r e q u e s t ( r e q ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 5 6 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c   f r o m   N o n e 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n _ p o o l . p y : 2 3 6 :   i n   h a n d l e _ r e q u e s t 
 
         r e s p o n s e   =   c o n n e c t i o n . h a n d l e _ r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 0 1 :   i n   h a n d l e _ r e q u e s t 
 
         r a i s e   e x c 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 7 8 :   i n   h a n d l e _ r e q u e s t 
 
         s t r e a m   =   s e l f . _ c o n n e c t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ s y n c \ c o n n e c t i o n . p y : 1 2 4 :   i n   _ c o n n e c t 
 
         s t r e a m   =   s e l f . _ n e t w o r k _ b a c k e n d . c o n n e c t _ t c p ( * * k w a r g s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ b a c k e n d s \ s y n c . p y : 2 0 7 :   i n   c o n n e c t _ t c p 
 
         w i t h   m a p _ e x c e p t i o n s ( e x c _ m a p ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 m a p   =   { < c l a s s   ' T i m e o u t E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t T i m e o u t ' > ,   < c l a s s   ' O S E r r o r ' > :   < c l a s s   ' h t t p c o r e . C o n n e c t E r r o r ' > } 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ e x c e p t i o n s ( m a p :   E x c e p t i o n M a p p i n g )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c :     #   n o q a :   P I E 7 8 6 
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   m a p . i t e m s ( ) : 
 
                                 i f   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
 >                                       r a i s e   t o _ e x c ( e x c )   f r o m   e x c 
 
 E                                       h t t p c o r e . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p c o r e \ _ e x c e p t i o n s . p y : 1 4 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 8 A 1 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 1 4 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 4 8 :   i n   _ s e n d _ r e q u e s t _ h t t p 
 
         r e s p o n s e   =   h t t p x . p o s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 3 0 4 :   i n   p o s t 
 
         r e t u r n   r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ a p i . p y : 1 0 9 :   i n   r e q u e s t 
 
         r e t u r n   c l i e n t . r e q u e s t ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 8 2 5 :   i n   r e q u e s t 
 
         r e t u r n   s e l f . s e n d ( r e q u e s t ,   a u t h = a u t h ,   f o l l o w _ r e d i r e c t s = f o l l o w _ r e d i r e c t s ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 1 4 :   i n   s e n d 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ a u t h ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 4 2 :   i n   _ s e n d _ h a n d l i n g _ a u t h 
 
         r e s p o n s e   =   s e l f . _ s e n d _ h a n d l i n g _ r e d i r e c t s ( 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 9 7 9 :   i n   _ s e n d _ h a n d l i n g _ r e d i r e c t s 
 
         r e s p o n s e   =   s e l f . _ s e n d _ s i n g l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ c l i e n t . p y : 1 0 1 4 :   i n   _ s e n d _ s i n g l e _ r e q u e s t 
 
         r e s p o n s e   =   t r a n s p o r t . h a n d l e _ r e q u e s t ( r e q u e s t ) 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 2 4 9 :   i n   h a n d l e _ r e q u e s t 
 
         w i t h   m a p _ h t t p c o r e _ e x c e p t i o n s ( ) : 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ c o n t e x t l i b . p y : 1 5 8 :   i n   _ _ e x i t _ _ 
 
         s e l f . g e n . t h r o w ( t y p ,   v a l u e ,   t r a c e b a c k ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
         @ c o n t e x t l i b . c o n t e x t m a n a g e r 
 
         d e f   m a p _ h t t p c o r e _ e x c e p t i o n s ( )   - >   t y p i n g . I t e r a t o r [ N o n e ] : 
 
                 g l o b a l   H T T P C O R E _ E X C _ M A P 
 
                 i f   l e n ( H T T P C O R E _ E X C _ M A P )   = =   0 : 
 
                         H T T P C O R E _ E X C _ M A P   =   _ l o a d _ h t t p c o r e _ e x c e p t i o n s ( ) 
 
                 t r y : 
 
                         y i e l d 
 
                 e x c e p t   E x c e p t i o n   a s   e x c : 
 
                         m a p p e d _ e x c   =   N o n e 
 
         
 
                         f o r   f r o m _ e x c ,   t o _ e x c   i n   H T T P C O R E _ E X C _ M A P . i t e m s ( ) : 
 
                                 i f   n o t   i s i n s t a n c e ( e x c ,   f r o m _ e x c ) : 
 
                                         c o n t i n u e 
 
                                 #   W e   w a n t   t o   m a p   t o   t h e   m o s t   s p e c i f i c   e x c e p t i o n   w e   c a n   f i n d . 
 
                                 #   E g   i f   ` e x c `   i s   a n   ` h t t p c o r e . R e a d T i m e o u t ` ,   w e   w a n t   t o   m a p   t o 
 
                                 #   ` h t t p x . R e a d T i m e o u t ` ,   n o t   j u s t   ` h t t p x . T i m e o u t E x c e p t i o n ` . 
 
                                 i f   m a p p e d _ e x c   i s   N o n e   o r   i s s u b c l a s s ( t o _ e x c ,   m a p p e d _ e x c ) : 
 
                                         m a p p e d _ e x c   =   t o _ e x c 
 
         
 
                         i f   m a p p e d _ e x c   i s   N o n e :     #   p r a g m a :   n o   c o v e r 
 
                                 r a i s e 
 
         
 
                         m e s s a g e   =   s t r ( e x c ) 
 
 >                       r a i s e   m a p p e d _ e x c ( m e s s a g e )   f r o m   e x c 
 
 E                       h t t p x . C o n n e c t E r r o r :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 . . \ A p p D a t a \ L o c a l \ P r o g r a m s \ P y t h o n \ P y t h o n 3 1 1 \ L i b \ s i t e - p a c k a g e s \ h t t p x \ _ t r a n s p o r t s \ d e f a u l t . p y : 1 1 8 :   C o n n e c t E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 8 A 1 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
 >                               r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 1 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 2 8 :   i n   _ c o n n e c t _ h t t p 
 
         r e t u r n   s e l f . _ i n i t i a l i z e ( ) 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 2 5 9 :   i n   _ i n i t i a l i z e 
 
         r e s p o n s e   =   s e l f . _ s e n d _ r e q u e s t ( r e q u e s t ) 
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 8 A 1 0 > 
 
 r e q u e s t   =   { ' i d ' :   1 ,   ' j s o n r p c ' :   ' 2 . 0 ' ,   ' m e t h o d ' :   ' i n i t i a l i z e ' ,   ' p a r a m s ' :   { ' c a p a b i l i t i e s ' :   { ' r o o t s ' :   { ' l i s t C h a n g e d ' :   T r u e } } ,   ' c l i e n t I n f o ' :   { ' n a m e ' :   ' s e m a n t i c a ' ,   ' v e r s i o n ' :   ' 1 . 0 . 0 ' } ,   ' p r o t o c o l V e r s i o n ' :   ' 2 0 2 4 - 1 1 - 0 5 ' } } 
 
 
 
         d e f   _ s e n d _ r e q u e s t ( s e l f ,   r e q u e s t :   D i c t [ s t r ,   A n y ] )   - >   O p t i o n a l [ D i c t [ s t r ,   A n y ] ] : 
 
                 " " " 
 
                 S e n d   J S O N - R P C   r e q u e s t   t o   M C P   s e r v e r . 
 
         
 
                 A r g s : 
 
                         r e q u e s t :   J S O N - R P C   r e q u e s t   d i c t i o n a r y 
 
         
 
                 R e t u r n s : 
 
                         R e s p o n s e   d i c t i o n a r y   o r   N o n e 
 
                 " " " 
 
                 i f   n o t   s e l f . _ c o n n e c t e d : 
 
                         r a i s e   P r o c e s s i n g E r r o r ( " N o t   c o n n e c t e d   t o   M C P   s e r v e r " ) 
 
         
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " s t d i o " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s t d i o ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ h t t p ( r e q u e s t ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ s e n d _ r e q u e s t _ s s e ( r e q u e s t ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   s e n d   r e q u e s t :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 3 2 1 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 A 4 1 0 > 
 
 s e r v e r _ n a m e   =   ' t h r e a t _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' ,   h e a d e r s   =   N o n e 
 
 c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 8 A 1 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
 >                       i f   c l i e n t . c o n n e c t ( ) : 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 6 8 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 8 A 1 0 > 
 
 
 
         d e f   c o n n e c t ( s e l f )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                 " " " 
 
                 t r y : 
 
                         i f   s e l f . t r a n s p o r t   = =   " h t t p " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ h t t p ( ) 
 
                         e l i f   s e l f . t r a n s p o r t   = =   " s s e " : 
 
                                 r e t u r n   s e l f . _ c o n n e c t _ s s e ( ) 
 
                         e l s e : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( f " U n s u p p o r t e d   t r a n s p o r t :   { s e l f . t r a n s p o r t } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { e } " )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ c l i e n t . p y : 1 9 8 :   P r o c e s s i n g E r r o r 
 
 
 
 T h e   a b o v e   e x c e p t i o n   w a s   t h e   d i r e c t   c a u s e   o f   t h e   f o l l o w i n g   e x c e p t i o n : 
 
 
 
 s e l f   =   < t e s t s . i n g e s t . t e s t _ c o o k b o o k _ i n t e g r a t i o n . T e s t C o o k b o o k I n t e g r a t i o n   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 1 C A 5 E 1 5 0 > 
 
 m o c k _ m c p _ s e r v e r   =   < M a g i c M o c k   n a m e = ' p o s t '   i d = ' 2 1 7 8 1 0 5 4 5 1 1 5 2 ' > 
 
 
 
         d e f   t e s t _ t h r e a t _ i n t e l l i g e n c e _ i n t e g r a t i o n ( s e l f ,   m o c k _ m c p _ s e r v e r ) : 
 
                 " " " 
 
                 V a l i d a t e s   t h e   l o g i c   f r o m   c o o k b o o k / u s e _ c a s e s / c y b e r s e c u r i t y / 0 5 _ T h r e a t _ I n t e l l i g e n c e _ I n t e g r a t i o n . i p y n b 
 
                 " " " 
 
                 m c p _ i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                 t h r e a t _ m c p _ u r l   =   " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " 
 
         
 
                 w i t h   p a t c h ( " s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . g e t _ p r o g r e s s _ t r a c k e r " )   a s   m o c k _ t r a c k e r : 
 
                         t r a c k e r _ i n s t a n c e   =   M a g i c M o c k ( ) 
 
                         m o c k _ t r a c k e r . r e t u r n _ v a l u e   =   t r a c k e r _ i n s t a n c e 
 
         
 
 >                       m c p _ i n g e s t o r . c o n n e c t ( 
 
                                 " t h r e a t _ s e r v e r " , 
 
                                 u r l = t h r e a t _ m c p _ u r l 
 
                         ) 
 
 
 
 t e s t s \ i n g e s t \ t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : 1 9 0 :   
 
 _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
 
 
 
 s e l f   =   < s e m a n t i c a . i n g e s t . m c p _ i n g e s t o r . M C P I n g e s t o r   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 A 4 1 0 > 
 
 s e r v e r _ n a m e   =   ' t h r e a t _ s e r v e r ' ,   u r l   =   ' h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p ' ,   h e a d e r s   =   N o n e 
 
 c o n f i g   =   { } 
 
 c l i e n t   =   < s e m a n t i c a . i n g e s t . m c p _ c l i e n t . M C P C l i e n t   o b j e c t   a t   0 x 0 0 0 0 0 1 F B 2 1 3 3 8 A 1 0 > 
 
 
 
         d e f   c o n n e c t ( 
 
                 s e l f , 
 
                 s e r v e r _ n a m e :   s t r , 
 
                 u r l :   O p t i o n a l [ s t r ]   =   N o n e , 
 
                 h e a d e r s :   O p t i o n a l [ D i c t [ s t r ,   s t r ] ]   =   N o n e , 
 
                 * * c o n f i g , 
 
         )   - >   b o o l : 
 
                 " " " 
 
                 C o n n e c t   t o   a n   M C P   s e r v e r   v i a   U R L . 
 
         
 
                 * * I M P O R T A N T * * :   S u p p o r t s   o n l y   P y t h o n   M C P   s e r v e r s   a n d   F a s t M C P   s e r v e r s . 
 
                 U s e r s   c a n   b r i n g   t h e i r   o w n   P y t h o n / F a s t M C P   M C P   s e r v e r s   v i a   U R L . 
 
         
 
                 A r g s : 
 
                         s e r v e r _ n a m e :   U n i q u e   n a m e   f o r   t h i s   M C P   s e r v e r   c o n n e c t i o n 
 
                         u r l :   M C P   s e r v e r   U R L   ( p r i m a r y   p a r a m e t e r ) 
 
                                 -   h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p 
 
                                 -   h t t p s : / / a p i . e x a m p l e . c o m / m c p 
 
                                 -   m c p : / / s e r v e r - n a m e 
 
                         h e a d e r s :   C u s t o m   h e a d e r s   f o r   a u t h e n t i c a t i o n   ( e . g . ,   { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                         * * c o n f i g :   A d d i t i o n a l   c o n f i g u r a t i o n   o p t i o n s   ( t i m e o u t ,   e t c . ) 
 
         
 
                 R e t u r n s : 
 
                         b o o l :   T r u e   i f   c o n n e c t i o n   s u c c e s s f u l 
 
         
 
                 R a i s e s : 
 
                         P r o c e s s i n g E r r o r :   I f   c o n n e c t i o n   f a i l s 
 
                         V a l i d a t i o n E r r o r :   I f   U R L   i s   n o t   p r o v i d e d   o r   i n v a l i d 
 
         
 
                 E x a m p l e : 
 
                         > > >   i n g e s t o r   =   M C P I n g e s t o r ( ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " d b _ s e r v e r " ,   u r l = " h t t p : / / l o c a l h o s t : 8 0 0 0 / m c p " ) 
 
                         > > >   i n g e s t o r . c o n n e c t ( " a p i _ s e r v e r " ,   u r l = " h t t p s : / / a p i . e x a m p l e . c o m / m c p " ,   h e a d e r s = { " A u t h o r i z a t i o n " :   " B e a r e r   t o k e n " } ) 
 
                 " " " 
 
                 t r y : 
 
                         #   C h e c k   i f   a l r e a d y   c o n n e c t e d 
 
                         i f   s e r v e r _ n a m e   i n   s e l f . _ c l i e n t s : 
 
                                 s e l f . l o g g e r . w a r n i n g ( 
 
                                         f " S e r v e r   { s e r v e r _ n a m e }   a l r e a d y   c o n n e c t e d ,   r e c o n n e c t i n g . . . " 
 
                                 ) 
 
                                 s e l f . d i s c o n n e c t ( s e r v e r _ n a m e ) 
 
         
 
                         #   V a l i d a t e   U R L 
 
                         i f   n o t   u r l : 
 
                                 r a i s e   V a l i d a t i o n E r r o r ( 
 
                                         f " U R L   i s   r e q u i r e d   f o r   M C P   s e r v e r   c o n n e c t i o n .   " 
 
                                         f " P r o v i d e   M C P   s e r v e r   U R L :   h t t p : / / ,   h t t p s : / / ,   o r   m c p : / / " 
 
                                 ) 
 
         
 
                         #   C r e a t e   a n d   c o n n e c t   c l i e n t   ( t r a n s p o r t   a u t o - d e t e c t e d   f r o m   U R L ) 
 
                         c l i e n t   =   M C P C l i e n t ( u r l = u r l ,   h e a d e r s = h e a d e r s ,   * * c o n f i g ) 
 
         
 
                         i f   c l i e n t . c o n n e c t ( ) : 
 
                                 s e l f . _ c l i e n t s [ s e r v e r _ n a m e ]   =   c l i e n t 
 
                                 s e l f . l o g g e r . i n f o ( f " C o n n e c t e d   t o   M C P   s e r v e r :   { s e r v e r _ n a m e }   a t   { u r l } " ) 
 
                                 r e t u r n   T r u e 
 
                         e l s e : 
 
                                 r a i s e   P r o c e s s i n g E r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   { s e r v e r _ n a m e } " ) 
 
                 e x c e p t   E x c e p t i o n   a s   e : 
 
                         s e l f . l o g g e r . e r r o r ( f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " ) 
 
 >                       r a i s e   P r o c e s s i n g E r r o r ( 
 
                                 f " F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   { s e r v e r _ n a m e } :   { e } " 
 
                         )   f r o m   e 
 
 E                       s e m a n t i c a . u t i l s . e x c e p t i o n s . P r o c e s s i n g E r r o r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   t h r e a t _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 
 
 s e m a n t i c a \ i n g e s t \ m c p _ i n g e s t o r . p y : 1 7 6 :   P r o c e s s i n g E r r o r 
 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   C a p t u r e d   l o g   c a l l   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 7 5   F a i l e d   t o   s e n d   H T T P   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 3 2 0   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 7 2   F a i l e d   t o   i n i t i a l i z e   M C P   p r o t o c o l :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 2 3 0   F a i l e d   t o   c o n n e c t   v i a   H T T P :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ c l i e n t : m c p _ c l i e n t . p y : 1 9 7   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 E R R O R         s e m a n t i c a . m c p _ i n g e s t o r : m c p _ i n g e s t o r . p y : 1 7 5   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r   t h r e a t _ s e r v e r :   F a i l e d   t o   c o n n e c t   t o   M C P   s e r v e r :   F a i l e d   t o   s e n d   r e q u e s t :   [ W i n E r r o r   1 0 0 6 1 ]   N o   c o n n e c t i o n   c o u l d   b e   m a d e   b e c a u s e   t h e   t a r g e t   m a c h i n e   a c t i v e l y   r e f u s e d   i t 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = =   s h o r t   t e s t   s u m m a r y   i n f o   = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 F A I L E D   t e s t s / i n g e s t / t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : : T e s t C o o k b o o k I n t e g r a t i o n : : t e s t _ f i n a n c i a l _ d a t a _ i n t e g r a t i o n 
 
 F A I L E D   t e s t s / i n g e s t / t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : : T e s t C o o k b o o k I n t e g r a t i o n : : t e s t _ s u p p l y _ c h a i n _ d a t a _ i n t e g r a t i o n 
 
 F A I L E D   t e s t s / i n g e s t / t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : : T e s t C o o k b o o k I n t e g r a t i o n : : t e s t _ m e d i c a l _ d a t a b a s e _ i n t e g r a t i o n 
 
 F A I L E D   t e s t s / i n g e s t / t e s t _ c o o k b o o k _ i n t e g r a t i o n . p y : : T e s t C o o k b o o k I n t e g r a t i o n : : t e s t _ t h r e a t _ i n t e l l i g e n c e _ i n t e g r a t i o n 
 
 4   f a i l e d ,   3 7   p a s s e d   i n   2 5 . 7 3 s 
 
 