;ς :{ŒAc@sNdklZlZdklZdklZdkZdkZdk Z dk Z e Z dfd„ƒYZ d„Zd„Zd„Ze d d „Ze e e e d d „Ze e e e e d d d „ZeZydkZeZWndkZnXdeifd„ƒYZdeifd„ƒYZep edjoeiƒndS((surlopens urlencode(sCustomizedParser(s ParseErrorNsURLcBsVtZdZeed„Zd„Zd„Zd„Zd„Zd„Z ed„Z RS(s¬Provides an URL with GET and POST data. This class is an easy way to deal with url and its associate GET and POST data, it methods to get the url (address + get, as you may use in browsers) with the getURL() method. The string representation is done with the POST data as a GET variable '__POST'. It also provides a open() method so it's easier to send both data and get a file descriptor to the stream. Example: >>> u = URL( 'test.php', { 'getdata': '%(getdata)s' }, { 'postdata': '%(postdata)s' } ) >>> print u test.php?getdata=%25%28getdata%29s&__POST=postdata%3D%2525%2528postdata%2529s >>> u2 = u % { 'getdata': 'test1', 'postdata': 'test2' } >>> print u2 test.php?getdata=test1&__POST=postdata%3Dtest2 >>> print u2.getURL() test.php?getdata=test1 >>> u2 cCs-||_|ph|_|ph|_dS(N(surlsselfsgetspost(sselfsurlsgetspost((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pys__init__Ds cCsy|iƒ}|io[|i|iƒ}|ihd|<ƒ}|i o|d7}n |d7}||7}n|SdS(Ns__POSTs?s&(sselfsgetURLsssposts __urlencode__sget(sselfspostss((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pys__str__Ks    cCsB|i}|i|iƒ}|i|iƒ}d|||fSdS(Ns%(sselfsurls __urlencode__sgetspost(sselfsurlspostsget((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pys__repr__Ys cCs›|i|}h}|io-x*|iD]}|i||||       ic Csrt|||||ƒ}t}y+|i |ƒ|i ƒ}|i ƒ|SWn"t j o}ti|ƒnXdS(sν parse the html and return its associated Tag structure. You may choose what tags to parse providing a list of tag names in 'parse_tags' and a list of attributes, providing a list of attribute names in 'parse_attrs'. N(sCustomizedParsers parse_tagss parse_attrssmust_close_tagsskeep_empty_tagssverbosesparsersNones structuresfeedscontentss get_structurescloses Exceptionsesmessages exception( scontentss parse_tagss parse_attrssmust_close_tagsskeep_empty_tagssverboseses structuresparser((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pysget_htmlstructureόs     c Cs©|} xw| djoit|||ƒ}t|||dt dt d|ƒ} | o#| d8} t ot |ƒq{q | Sq Wttdƒ|ƒ} || _| ‚dS(sθ returns the Tag structure of the document at URL. You can specify a 'filter' function (see get_urlcontents()) and a list of tags ('parse_tags') and attributes ('parse_attrs') to parse (see get_htmlstructure()). ismust_close_tagsskeep_empty_tagssverboseis!%s could not be correctly parsed.N(sretriessrsget_urlcontentssurlsfilterscsget_htmlstructures parse_tagss parse_attrssNonesverbosesstructs cache_dirscache_clearurls ParseErrors_spescontents( surlsfilters parse_tagss parse_attrssmust_close_tagsskeep_empty_tagssretriessverbosescsstructsrspe((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pys get_urlparseds      surlutils_UnitTestcBstZd„ZRS(NcCs!d}|djp t|‚dS(Ni(svsAssertionError(sselfsv((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pystest01:s(s__name__s __module__stest01(((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pysurlutils_UnitTest9ssURL_TestcBs,tZd„Zd„Zd„Zd„ZRS(Nc Cs||ittdƒƒdƒ|ittdhdd<ƒƒdƒ|ittdhddsais*sbis-(sselfs assertEqualsreprsURL(sself((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pys test__repr__?s !-c Cs§|ittdƒƒdƒ|ittdhdd<ƒƒdƒ|ittdhdds s__main__(surllibsurlopens urlencodescustomizedparsersCustomizedParsersgrabexceptionss ParseErrorsmessagesi18nsossmd5sNones cache_dirsURLs cache_hashs cache_geturlscache_clearurlsget_urlcontentssget_htmlstructures get_urlparsedsFalsesusing_unittest2s unittest2sunittestsTruesTestCasesurlutils_UnitTestsURL_Tests__name__smain(s urlencodesURL_Testsunittests cache_geturlsmessagesurlutils_UnitTestsget_urlcontentssURLscache_clearurlsurlopens ParseErrors cache_dirsi18nsmd5susing_unittest2s get_urlparsedsget_htmlstructuresossCustomizedParsers cache_hash((sM/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/urlutils.pys?s0      ^ / /   1