check whether the proxy ip and port are valid :param ip: proxy ip value :param port: proxy port value :return: True or False
(self, ip, port)
| 145 | return protocols |
| 146 | |
| 147 | def proxy_check(self, ip, port): |
| 148 | """ |
| 149 | check whether the proxy ip and port are valid |
| 150 | :param ip: proxy ip value |
| 151 | :param port: proxy port value |
| 152 | :return: True or False |
| 153 | """ |
| 154 | try: |
| 155 | ipaddress.ip_address(ip) |
| 156 | p = int(port) |
| 157 | if p > 65535 or p <= 0: |
| 158 | return False |
| 159 | except ValueError: |
| 160 | return False |
| 161 | return True |
| 162 | |
| 163 | def construct_proxy_url(self, scheme, ip, port): |
| 164 | """construct proxy urls so spiders can directly use them""" |
no outgoing calls
no test coverage detected