Ñò ššðOc@saddkZddkZddkZddklZlZddklZddd„ƒYZdS(iÿÿÿÿN(turlparseturljoin(tsleept DeliciousWScBs°eZeZdZdZdZdZdZgZ d„Z d„Z d„Z d„Z d„Zd„Zd „Zd „Zd „Zd „Zd „Zd„Zd„Zd„ZRS(shttps://www.delicious.com/v1/sdel.icio.us APItcCs||_||_g|_dS(N(tusernametpasswordt parsedLinks(tselfRR((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyt__init__$s  cCs+|idƒp|d}n||_dS(Nt/(tendswitht api_endpoint(Rturl((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pytsetAPIEndpoint)scCs|iS(N(R (R((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pytgetAPIEndpoint.scCs ||_dS(N(t api_realm(Rtrealm((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyt setAPIRealm1scCs|iS(N(R(R((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyt getAPIRealm4scCs ||_dS(N(t_DeliciousWS__debug(Rtd((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pytsetDebug7scCs'|iod|iddƒGHndS(NsDBG: %stasciitreplace(Rtencode(Rts((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyt__dbg:s cCs·||_tiƒ}t|iƒ}|i|i|i|i|i ƒti |ƒ}dg|_ ti |ƒt |id|ƒ}|id|ƒti|ƒ}|i|iƒƒS(Ns User-agents7delicious2mtblog v0.2 http://redefine.dyndns.org/~andyrsposts/recent?tag=%ssFetching links from URL: %s(s User-agents7delicious2mtblog v0.2 http://redefine.dyndns.org/~andyr(ttagturllib2tHTTPBasicAuthHandlerRR t add_passwordRthostnameRRt build_openert addheaderstinstall_openerRt_DeliciousWS__dbgturlopentparseDeliciousXMLtread(RRt auth_handlert parsed_urltopenerR tf((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pytfetchLinksForTagJs  "  cCsdtiiiƒ}|i|_|i|_|i|_ |i dƒ|i |ƒ|i dƒ|i S(Ns/============== BEGIN XML PARSE ================s-============== END XML PARSE ================( txmltparserstexpatt ParserCreatet start_elementtStartElementHandlert end_elementtEndElementHandlert char_datatCharacterDataHandlerR$tParseR(Rtxmlresptp((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyR&hs      cCsˆ|id||fƒ|djo`|idƒ|id|dƒ|id|dƒ|id|d ƒ|ii|ƒndS( Ns"Start element; name: %s; attrs: %stposts** In a post element **s** hash: %s **thashs** href: %s **threfs** description: %s **t description(R$Rtappend(Rtnametattrs((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyR1vs  cCs|id|ƒdS(NsEnd element: %s(R$(RR?((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyR3~scCs|idt|ƒƒdS(NsCharacter data: %s(R$trepr(Rtdata((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyR5€scCsƒd}xv|D]n}t|ƒdjo|ti|ƒ}q d}x+|idƒD]}|dt|ƒ}qSW||}q W|S(NRi€tutf8s%%%02X(tordturllibtquoteR(Rtstrtnstrtcttmptrawbyte((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyt quoteUriUTF16‹scCs«x¤|D]œ}|id|dƒdti|dƒ}d|i|dƒ}d|i|dƒ}dti|d ƒ}|d id ƒ} d } x;| D]3} | |jo| d |7} qž| | d 7} qžWd|d|d|d|d|i| ƒ} |id| ƒt|id| ƒ}|iidƒdjo|idƒtdƒn|id|ƒt i |ƒ} |i| i ƒƒ|idƒqWdS(Ns** Changing tag on '%s'R<surl=%ssdescription=%sR=s extended=%stextendedstime=%sttimeRt Rs%s t?t&s &replace=yes&s&tags=s** del.icio.us params -> %s **s posts/add%stpinboardis0Pinboard requires 3 seconds in between API callsis#Modifying tags on links via URL: %ss==============================( R$RERFRLtsplitRR tfindRRR%R'(RtnewLinkstoldtagtnewtagtlinkR R=RMRNttagstnewtagsRtparamstrepost((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pytmodifyTagForLinks§s0 3 (t__name__t __module__tFalseRR RRRRRR RRRRRR$R,R&R1R3R5RLR](((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyRs*            (( RERtxml.parsers.expatR-RRRNRR(((s5/home/andyr/public_html/code/delish2mt/DeliciousWS.pyt s