Commits

Gregory Petukhov  committed 585428d

Fix cookie parsing error

  • Participants
  • Parent commits 3d94f02

Comments (0)

Files changed (6)

File grab/base.py

     def process_config(self):
         raise NotImplementedError
 
-    def extract_cookies(self):
+    def _extract_cookies(self):
         raise NotImplementedError
 
     def prepare_response(self):

File grab/response.py

 
         self.headers = email.message_from_string('\n'.join(valid_lines))
         #self.cookiejar = CookieJar()
-        #self.cookiejar.extract_cookies(self, Request(self.url))
+        #self.cookiejar._extract_cookies(self, Request(self.url))
         #for cookie in self.cookiejar:
             #self.cookies[cookie.name] = cookie.value
 

File grab/spider/base.py

                     g.response.time = 0
                     g.response.url = cache_item['url']
                     g.response.parse()
-                    g.response.cookies = g.extract_cookies()
+                    g.response.cookies = g._extract_cookies()
 
                 grab.process_request_result(custom_prepare_response)
 

File grab/transport/requests.py

         #if self.config['charset']:
             #self.charset = self.config['charset']
 
-    #def extract_cookies(self):
+    #def _extract_cookies(self):
         #"""
         #Extract cookies.
         #"""
         #self.response.head = ''.join(self.response_head_chunks)
         #self.response.body = ''.join(self.response_body_chunks)
         #self.response.parse()
-        #self.response.cookies = self.extract_cookies()
+        #self.response.cookies = self._extract_cookies()
         #self.response.code = self.curl.getinfo(pycurl.HTTP_CODE)
         #self.response.time = self.curl.getinfo(pycurl.TOTAL_TIME)
         #self.response.url = self.curl.getinfo(pycurl.EFFECTIVE_URL)

File grab/transport/selenium.py

         #if self.config['charset']:
             #self.charset = self.config['charset']
 
-    def extract_cookies(self):
+    def _extract_cookies(self):
         """
         Extract cookies.
         """
         #import pdb; pdb.set_trace()
         self.response.url = self.browser.current_url
         self.response.code = 200# TODO: fix, self.browser.status_code
-        self.response.cookies = self.extract_cookies()
+        self.response.cookies = self._extract_cookies()
         #self.response.code = self.curl.getinfo(pycurl.HTTP_CODE)
         #self.response.time = self.curl.getinfo(pycurl.TOTAL_TIME)
         #self.response.url = self.curl.getinfo(pycurl.EFFECTIVE_URL)

File grab/transport/urllib.py

         logger.debug('[%02d] %s %s%s' % (self.request_counter, method, self.config['url'], proxy_info))
         self.req = req
 
-    def extract_cookies(self):
+    def _extract_cookies(self):
         """
         Extract cookies.
         """
         #self.response.head = ''.join(self.response_head_chunks)
         #self.response.body = ''.join(self.response_body_chunks)
         #self.response.parse()
-        #self.response.cookies = self.extract_cookies()
+        #self.response.cookies = self._extract_cookies()
         #self.response.time = self.curl.getinfo(pycurl.TOTAL_TIME)
         self.response.code = self._resp.code
         self.response.url = self._resp.geturl()