
    !h                        S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJrJr  SS	KJr  \(       a  SS
KJrJr  SSKJr   " S S\	5      rg)z:
Scrapy Shell

See documentation in docs/topics/shell.rst
    )annotations)Thread)TYPE_CHECKINGAny)ScrapyCommand)Request)Shell)DefaultSpiderspidercls_for_request)guess_scheme)ArgumentParser	Namespace)Spiderc                  x   ^  \ rS rSrSrSSSS.rSS jrSS jrSS	 jrSU 4S
 jjr	SS jr
SS jrSS jrSrU =r$ )Command   Fz!scrapy.dupefilters.BaseDupeFilterTr   )DUPEFILTER_CLASS
KEEP_ALIVELOGSTATS_INTERVALc                    g)Nz
[url|file] selfs    \/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/scrapy/commands/shell.pysyntaxCommand.syntax    s        c                    g)NzInteractive scraping consoler   r   s    r   
short_descCommand.short_desc#   s    -r   c                     g)NzkInteractive console for scraping the given url or file. Use ./file.html syntax or full path for local file.r   r   s    r   	long_descCommand.long_desc&   s    B	
r   c                   > [         TU ]  U5        UR                  SSSS9  UR                  SSSS9  UR                  SS	S
SSS9  g )Nz-ccodez9evaluate the code in the shell, print the result and exit)desthelpz--spiderspiderzuse this spiderz--no-redirectno_redirect
store_trueFz<do not handle HTTP 3xx status codes and print response as-is)r&   actiondefaultr'   )superadd_optionsadd_argument)r   parser	__class__s     r   r.   Command.add_options,   sf    F#L 	 	

 	JX<MNO 	 	
r   c                    g)z[You can use this function to update the Scrapy objects that will be
available in the shell
Nr   )r   varss     r   update_varsCommand.update_vars<   s    r   c                ~   U(       a  US   OS nU(       a  [        U5      nU R                  (       d   eU R                  R                  n[        nUR                  (       a  UR                  UR                  5      nOU(       a  [        U[        U5      USS9nU R                  R                  U5      nUR                  5         UR                  5       Ul        UR                  R                  SS9  U R                  5         [        X`R                  UR                   S9nUR                  X2R"                  (       + S9  g )Nr   T)log_multipleF)_start_request_processing)r5   r%   )urlredirect)r   crawler_processspider_loaderr
   r(   loadr   r   _create_crawler_apply_settings_create_engineenginestart_start_crawler_threadr	   r5   r%   r)   )r   argsoptsr:   r=   	spiderclscrawlershells           r   runCommand.runA   s    d1g4s#C####,,::"/	;;%**4;;7I-ws|YTI &&66yA! //1u=""$g+;+;$))L*:*:&:;r   c                    U R                   (       d   e[        U R                   R                  SSS.S9nSUl        UR                  5         g )NF)stop_after_crawlinstall_signal_handlers)targetkwargsT)r<   r   rC   daemon)r   ts     r   rD   Command._start_crawler_thread_   sD    ####''--(-%P
 		r   r   )returnstr)r0   r   rT   None)r4   zdict[str, Any]rT   rV   )rE   z	list[str]rF   r   rT   rV   )rT   rV   )__name__
__module____qualname____firstlineno__requires_projectdefault_settingsr   r   r"   r.   r5   rJ   rD   __static_attributes____classcell__)r1   s   @r   r   r      sB    ?.

 
<< r   r   N)__doc__
__future__r   	threadingr   typingr   r   scrapy.commandsr   scrapy.httpr   scrapy.shellr	   scrapy.utils.spiderr
   r   scrapy.utils.urlr   argparser   r   scrapyr   r   r   r   r   <module>rj      s;    #  % )   D )2Nm Nr   