
from terroroftinytown.services.base import BaseService
from terroroftinytown.services.status import URLStatus
import re

class GooglService(BaseService):
	def process_response(self, response):
		status_code = response.status_code

		if status_code in self.params['redirect_codes']:
			if self.ratelimited(response):
				return self.process_banned(response)
			return self.process_redirect(response)
		elif status_code in self.params['no_redirect_codes']:
			return self.process_no_redirect(response)
		elif status_code in self.params['unavailable_codes']:
			return self.process_unavailable(response)
		elif status_code in self.params['banned_codes']:
			return self.process_banned(response)
		else:
			return self.process_unknown_code(response)

	def ratelimited(self, response):
		if 'Location' not in response.headers:
			return False
		result_url = response.headers['Location']
		response.content  # read the response to allow connection reuse
		return not not re.search('^https?://(?:www\.)?google\.com/sorry', result_url)

from terroroftinytown.services.base import BaseService
from terroroftinytown.services.status import URLStatus
import re

class GooglService(BaseService):
    def process_response(self, response):
        status_code = response.status_code

        if status_code in self.params['redirect_codes']:
            if self.ratelimited(response):
                return self.process_banned(response)
            return self.process_redirect(response)
        elif status_code in self.params['no_redirect_codes']:
            return self.process_no_redirect(response)
        elif status_code in self.params['unavailable_codes']:
            return self.process_unavailable(response)
        elif status_code in self.params['banned_codes']:
            return self.process_banned(response)
        else:
            return self.process_unknown_code(response)

    def ratelimited(self, response):
        if 'Location' not in response.headers:
            return False
        result_url = response.headers['Location']
        response.content  # read the response to allow connection reuse
        return not not re.search('^https?://(?:www\.)?google\.com/sorry', result_url)

Use spaces instead of tabs
Use spaces instead of tabs

- 
  from terroroftinytown.services.base import BaseService
  from terroroftinytown.services.status import URLStatus
  import re
  
  class GooglService(BaseService):
- 	def process_response(self, response):
+     def process_response(self, response):
- 		status_code = response.status_code
+         status_code = response.status_code
  
- 		if status_code in self.params['redirect_codes']:
+         if status_code in self.params['redirect_codes']:
- 			if self.ratelimited(response):
+             if self.ratelimited(response):
- 				return self.process_banned(response)
+                 return self.process_banned(response)
- 			return self.process_redirect(response)
+             return self.process_redirect(response)
- 		elif status_code in self.params['no_redirect_codes']:
+         elif status_code in self.params['no_redirect_codes']:
- 			return self.process_no_redirect(response)
+             return self.process_no_redirect(response)
- 		elif status_code in self.params['unavailable_codes']:
+         elif status_code in self.params['unavailable_codes']:
- 			return self.process_unavailable(response)
+             return self.process_unavailable(response)
- 		elif status_code in self.params['banned_codes']:
+         elif status_code in self.params['banned_codes']:
- 			return self.process_banned(response)
+             return self.process_banned(response)
- 		else:
+         else:
- 			return self.process_unknown_code(response)
+             return self.process_unknown_code(response)
  
- 	def ratelimited(self, response):
+     def ratelimited(self, response):
- 		if 'Location' not in response.headers:
+         if 'Location' not in response.headers:
- 			return False
+             return False
- 		result_url = response.headers['Location']
+         result_url = response.headers['Location']
- 		response.content  # read the response to allow connection reuse
+         response.content  # read the response to allow connection reuse
- 		return not not re.search('^https?://(?:www\.)?google\.com/sorry', result_url)
+         return not not re.search('^https?://(?:www\.)?google\.com/sorry', result_url)
  
Use spaces instead of tabs
## Code Before:

from terroroftinytown.services.base import BaseService
from terroroftinytown.services.status import URLStatus
import re

class GooglService(BaseService):
	def process_response(self, response):
		status_code = response.status_code

		if status_code in self.params['redirect_codes']:
			if self.ratelimited(response):
				return self.process_banned(response)
			return self.process_redirect(response)
		elif status_code in self.params['no_redirect_codes']:
			return self.process_no_redirect(response)
		elif status_code in self.params['unavailable_codes']:
			return self.process_unavailable(response)
		elif status_code in self.params['banned_codes']:
			return self.process_banned(response)
		else:
			return self.process_unknown_code(response)

	def ratelimited(self, response):
		if 'Location' not in response.headers:
			return False
		result_url = response.headers['Location']
		response.content  # read the response to allow connection reuse
		return not not re.search('^https?://(?:www\.)?google\.com/sorry', result_url)

## Instruction:
Use spaces instead of tabs
## Code After:
from terroroftinytown.services.base import BaseService
from terroroftinytown.services.status import URLStatus
import re

class GooglService(BaseService):
    def process_response(self, response):
        status_code = response.status_code

        if status_code in self.params['redirect_codes']:
            if self.ratelimited(response):
                return self.process_banned(response)
            return self.process_redirect(response)
        elif status_code in self.params['no_redirect_codes']:
            return self.process_no_redirect(response)
        elif status_code in self.params['unavailable_codes']:
            return self.process_unavailable(response)
        elif status_code in self.params['banned_codes']:
            return self.process_banned(response)
        else:
            return self.process_unknown_code(response)

    def ratelimited(self, response):
        if 'Location' not in response.headers:
            return False
        result_url = response.headers['Location']
        response.content  # read the response to allow connection reuse
        return not not re.search('^https?://(?:www\.)?google\.com/sorry', result_url)
