*j/SrSSKrSSKrSSKrSSKrSSKrS/r\R"SS5r "SS5r "SS5r "S S 5r S r S rS rSrSrg)zrobotparser.py Copyright (C) 2000 Bastian Kleineidam You can choose between two licenses when using this package: 1) GNU GPLv2 2) PSF license for Python 2.2 The robots.txt Exclusion Protocol is implemented as specified in RFC 9309 NRobotFileParser RequestRatezrequests secondscj\rSrSrSrSSjrSrSrSrSr Sr S r S r S r S rS rSrSrSrg)rzjThis class provides a set of methods to read, parse and answer questions about a single robots.txt file. c/Ul0Ul/UlSUlSUlSUlUR U5 SUlg)NFr)entriesgroupssitemaps default_entry disallow_all allow_allset_url last_checkedselfurls 9/opt/alt/python313/lib64/python3.13/urllib/robotparser.py__init__RobotFileParser.__init__sB   !! ScUR$)zReturns the time the robots.txt file was last fetched. This is useful for long-running web spiders that need to check for new robots.txt files periodically. )rrs rmtimeRobotFileParser.mtime(s   rc6SSKnUR5Ulg)zISets the time the robots.txt file was last fetched to the current time. rN)timer)rrs rmodifiedRobotFileParser.modified1s  IIKrcnXl[RRU5SSuUlUlg)z,Sets the URL referring to a robots.txt file.N)rurllibparseurlsplithostpathrs rrRobotFileParser.set_url9s+%||44S9!A> 49rc[RRUR5nUR 5nUR UR SS5R55 g![RRaYnURS;aSUl O'URS:aURS:aSUl UR5 SnAgSnAff=f)z4Reads the robots.txt URL and feeds it to the parser.zutf-8surrogateescape)iiTiiN)r"requesturlopenrreadr#decode splitlineserror HTTPErrorcoder r close)rfrawerrs rr,RobotFileParser.read>s L&&txx0A&&(C JJszz'+<=HHJ K||%% xx:%$(!SSXX^!% IIKK  s)A++C" ACC"c URRU5 URHXnUR5nX R;aXRU'M2[ URUU5URU'MZ gN)rappend useragentslowerr merge_entries)rentryagents r _add_entryRobotFileParser._add_entryLsc E"%%EKKMEKK'%* E"%24;;u3Eu%M E" &rc/nSn[5nUR5 UGHnURS5nUS:aUSUnUR5nU(dM9UR SS5n[ U5S:XdM\USR5R 5US'USR5US'USS:XaEUS:XaURU5 [5nUSnURRU5 SnMUSS:Xa7US:wa.SnURR[USS 55 GM!GM$USS :Xa7US:wa.SnURR[USS 55 GMaGMdUSS :XaGUS:wa>USR5R5(a[US5UlSnGMGMUSS :XaUS:waUSR S5n[ U5S:XauUSR5R5(aOUSR5R5(a)[![US5[US55UlSnGM`GMcUSS:XdGMoUR$RUS5 GM US:waURU5 gg![a GMf=f![a GMf=f)z|Parse the input lines from a robots.txt file. We allow that a user-agent: line is not preceded by one or more blank lines. r#N:r z user-agentdisallowFallowTz crawl-delayz request-rate/sitemap)Entryrfindstripsplitlenr;r?r:r9 rulelinesRuleLine ValueErrorisdigitintdelayrreq_rater ) rlinesrstater=linei product_tokennumberss rr#RobotFileParser.parseUs   D #AAvBQx::>   \\**3/ ll%%r2&? 12&?@C C -   + =s##rcpUR5(dgURU5nUcgUR$r8)rrcrSras r crawl_delayRobotFileParser.crawl_delays2zz||  + ={{rcpUR5(dgURU5nUcgUR$r8)rrcrTras r request_rateRobotFileParser.request_rates2zz||  + =~~rc>UR(dgUR$r8)r rs r site_mapsRobotFileParser.site_mapss}}}}rc URnURbXR/-nSR[S[ [ U555$)Nz )rr joinfiltermapstr)rrs r__str__RobotFileParser.__str__sE,,    )!3!3 44G{{6$C(9:;;r) r r r rr r%rr&r rN)rf)__name__ __module__ __qualname____firstlineno____doc__rrrrr,r?r#rcrkrnrqrtr{__static_attributes__rrrrsL !(? LNG#R$$6 A--) &&tyy11tyy>A--rc|UR(aSOSS-UR-UR(aS-$S-$)NAllowDisallowz: rrf)rir&rrs rr{RuleLine.__str__s; NN dBTYYN..32 3.02 3r)rirrr&N) r}r~rrrrr`r{rrrrrOrOs1#* 3rrOc0\rSrSrSrSrSrSrSrSr g) rIi z?An entry has one or more user-agents and zero or more rulelinesc</Ul/UlSUlSUlgr8)r:rNrSrTrs rrEntry.__init__ s  rcUR(dg/nURHnURSU35 M URbURSUR35 URb7URnURSURSUR 35 UR (a*UR[[UR 55 OURS5 SRU5$)Nrfz User-agent: z Crawl-delay: zRequest-rate: rGzAllow: ) r:r9rSrTrequestssecondsrNextendryrzrw)rretr>rates rr{ Entry.__str__s__E JJeW- .% :: ! JJtzzl3 4 == $==D JJ a ~F G >> JJs3/ 0 JJx yy~rcUcSUR;$URS5SR5nURH"nUS:wdM UR5nX!;dM" g g)z2check if this entry applies to the specified agentr]rGrTF)r:rLr;)rrbr>s rr`Entry.applies_to#sa  $//) )OOC(+113 __E| % % rcSnSnURHNnURU5nU(dMXR:aUnURnM2XR:XdM9U(aMBURnMP U$)zKPreconditions: - our agent applies to this entry - filename is URL encoded T)rNr`ri)rr best_matchrirWrs rriEntry.allowance0s\   NND)Aq>!"J $I_YY $I#r)rSrTrNr:N) r}r~rrrrr{r`rirrrrrIrI sI " rrIcz[RRUSS9n[RRUSS9$)Nr))errors)r"r#unquotequote)r&unquoteds r normalizerBs7||##D1B#CH <<  h/@  AArcURS5upn[U5nU(a![R"SSU5nUSU-- nU$)N?z[^=&]+c[US5$Nrrrs rnormalize_uri..Js IadOr) partitionrrrr&sepquerys rrhrhFsG~~c*Du T?D y";UC e  KrcURS5upn[R"SSU5nU(a![R"SSU5nUSU-- nU$)Nrz[^*$]+c[US5$rrrs rr#normalize_pattern..Ps y1rz[^=&*$]+c[US5$rrrs rrrRs i!or)rrrrs rrrNsQ~~c*Du 66)6 =D {$=uE e  Krc[[[RUR S555n[ S[ U5S- 5H nSXS3X'M SUS3US'SRU5$)Nr]r z(?>.*?)z.*rrf)listryrescaperLrangerMrw)r&partsrXs rrrVsl RYY 30 1E 1c%jl #EH:Q'$U2YK E"I 775>rc[5n[[[UR5R UR55UlUR UR -UlURc URO URUlURcURUlU$URUlU$r8) rIrrxsetr: __contains__rNrSrT)e1e2r=s rr<r<]s GEF3r}}#5#B#BBMMRSEllR\\1EO hh."((BHHEK$&KK$7R[[EN L>@[[EN Lr)r collectionsr urllib.errorr" urllib.parseurllib.request__all__ namedtuplerrrOrIrrhrrr<rrrrss    $$]4FG C<C