mò
ð(Gc           @   s   d  k  Z  d  k Z d  k Z d  k Z d  k Z d  k Z d g Z d  d  d  d „ Z d „  Z	 d „  Z
 e d j o e
 ƒ  n d  S(   Nt   quotec         C   sj   t  i d ƒ } t  i d | Œ } t i | | |  ƒ } |  d j o t
 | ƒ } n t i | | | ƒ d  S(   Nt   commonR    (   t   impt   find_modulet   module_locationt   load_modulet   moduleR   t   NormalizeMessaget   msgt   irct   keywordt   GetQuotet   resultt   DeliverMessaget   channel(   R
   R   R	   R   R   R   R   (    (    t?   /home/avleen/devel/python/googlebot2/modules/googlebot_quote.pyt   Gather   s    c         C   s¨   t  i d ƒ i |  ƒ o y t i |  ƒ } Wn  t j
 o d |  g } q¤ Xt	 i	 i
 | i ƒ } d | |  | i f d | i | i | i f g } n d |  } | S(   so   Get quotes from finance.yahoo.com
  
  Args:
    msg: string

  Returns:
    str: Success or failure message
  s   ([\^A-Z]+$)s    Quote data not available for: %ss"   At %s, the value of %s was USD%.2fsM   Today's high: %.2f, today's low: %.2f.Change since last market opening: %.2f.s   No symbols matching: %sN(   t   ret   compilet   searcht   symbolt   Quotet   LookupR    t
   ValueErrorR   t   datetimet   fromtimestampt   timet	   quotedatet   valuet   hight   lowt   change(   R   R   R   R    (    (    R   R      s     6
c          C   sŠ   y t  i d }  Wn  t j
 o t  i d ƒ n Xy t  i d } Wn  t j
 o t  i d ƒ n X|  t j o t |  | ƒ n d  S(   Ni   i   (   t   syst   argvR
   t
   IndexErrort   exitt   argumentt   module_triggersR   (   R
   R$   (    (    R   t   main1   s    t   __main__(   R   R   R   R   R    R   R%   t   NoneR   R   R&   t   __name__(
   R   R   R   R   R   R    R   R   R&   R%   (    (    R   t   ?   s   										
