Wednesday 15 June 2011

using mechanize of Python -


I am trying to use mechanic to submit a photo URL of a website's image search engine. This is my code bit, the image selected by me is randomly selected from the internet. F: print f br.select_form (nr =) for br.forms (f):

  r = br.open ('http://stu.baidu.com/') br.forms (f) 1) br.form ['objurl'] = 'http: //images2.fanpop.com/image/photos/13900000/Pretty-Dogs-in-Garden-dogs-13905929-1920-1200Jpg' br.submit () Print br.submit   

However, I get this from the terminal response. I do not know where I am ....

  face2.py:13: User warring: Gizip transfer encoding is experimental! Br.set_handle_gzip (True) & lt; Form2 POST http://stu.baidu.com/i?rt=0&rn=10&stt=0&ct=0&tn=baiduimage multipart / form-data & lt; FileControl (image = & lt; no file found & gt;) & gt; & Gt; & Lt; Form1 GET http://stu.baidu.com/i multipart / form-data & lt; TextControl (objurl =) & gt; & Lt; Submit control (& lt; none; gt; = è¯ ?? a ?? ¾ä¸ ?? ä¸ ??) (read only) & gt; & Lt; Hidden control (file name =) (read only) & gt; & Lt; Hidden Controls (RT = 0) (Read Only) & gt; & Lt; Hidden Controls (RN = 10) (Read Only) & gt; & Lt; Hidden controls (ftn = indexstu) (read only) & gt; & Lt; Hidden controller (CT = 1) (read only) & gt; & Lt; Hidden Controls (stt = 0) (Read Only) & gt; & Lt; HID CONTROL (TN = Cittoresult) (Read Only) & gt; & Gt; Tracebacks (most recent call final): File "face2.py", line 42, & lt; Module & gt; Br.submit () file "/ Library / Python 2/2 / site-package / mechanization section -2.2. -2.28. Egm / McKenize_memanacaz", line 541, return self. Open (auto-click (* ALGS, ** KWDS) file "/ Library / Python 2/7 / Site-Package / Mechanism.0.2.5-P2.2.7 / IJEKK / _Mackness", line 530, click Please request = in self. Form.click (* args, ** kwds) file "/ Library / Python 2/2 / site-package / mechanize -2.2.5-PP 2.7.egg / mechanize / _form.py", line 2999, click itself . _request_class) file "/ library / python 2/7 / site-package / mechanization -2.2 / -package / mechanization -2.20-pp-2.7.EGD / macenase / _form", line 3201, _click return control. Click (Self, Coordination, Return_type, Request_class) File "/ Library / Python 2/7 / Picture - Package / Make-up -0.2.5-PP-2.7. Egm / Mechanize / _Form", Line 2350, _click R = Form K_svich_klik (Ritrn_prkar, Anurod_cls) "/ Library file / Python 2.7 / Site package / Meknaij -0k2k5-PP 2k7kijeedi / Mackenaij / _formkpy", line 3269, req_data in _switch_click = self._request_data () File "/ library / python / 2.7 / site-package / mechanization-0.2.5-py2.7.egg / mechanization /_form.py", line 3235, "in _request_data unknown GET form encoding type '% s'"% self.enctype) value error: unknown GET form encoding type Bhupt / form-data'    

Some examples:

No comments:

Post a Comment