old_contents: import os
  import random
  from scrapy.conf import settings
  
  
  class RandomUserAgentMiddleware(object):
      def process_request(self, request, spider):
          ua  = random.choice(settings.get('USER_AGENT_LIST'))
          if ua:
              request.headers.setdefault('User-Agent', ua)
  
  
  class ProxyMiddleware(object):
      def process_request(self, request, spider):
          request.meta['proxy'] = settings.get('HTTP_PROXY')
  
new_contents: import os
  import random
  from scrapy.conf import settings
  
  
  class RandomUserAgentMiddleware(object):
      def process_request(self, request, spider):
          ua = random.choice(settings.get('USER_AGENT_LIST'))
          if ua:
              request.headers.setdefault('User-Agent', ua)
  
  
  class ProxyMiddleware(object):
      def process_request(self, request, spider):
          request.meta['proxy'] = settings.get('HTTP_PROXY')
  
subject: Update middlewares.py