proxy.py 434 B

12345678910111213141516171819202122
  1. from attr import attrs, attr
  2. @attrs
  3. class Proxy(object):
  4. """
  5. proxy schema
  6. """
  7. host = attr(type=str, default=None)
  8. port = attr(type=int, default=None)
  9. def __str__(self):
  10. return f'{self.host}:{self.port}'
  11. def string(self):
  12. return self.__str__()
  13. if __name__ == '__main__':
  14. proxy = Proxy(host='8.8.8.8', port=8888)
  15. print('proxy', proxy)
  16. print('proxy', proxy.string())