Ejemplo n.º 1
0
def read_proxy_file(file_path):
    """
        Method used by the create_proxy method. Reads the file at the given file path and uses the CSVReader and
        ProxyExtractor classes from the Parsing module to convert the contents of the file to usable Proxy objects.

        :param file_path: Path to the proxy file
        :return: List with extracted Proxies. List will be empty if no proxies where found.
    """
    reader = CSVReader(file_path)
    extractor = ProxyExtractor(reader)
    proxy_list = extractor.get_all_proxies()
    return proxy_list
Ejemplo n.º 2
0
 def setUp(self):
     proxy_file_path = './Docs/Proxyfile_examples/example.csv'
     self._reader = CSVReader(proxy_file_path)
Ejemplo n.º 3
0
    def test_bad_row_error(self):
        bad_row_path = './Docs/Proxyfile_examples/bad_row_example.csv'

        with self.assertRaises(ValueError):
            CSVReader(bad_row_path)
Ejemplo n.º 4
0
    def test_bad_column_error(self):
        bad_column_path = './Docs/Proxyfile_examples/bad_column_example.csv'

        with self.assertRaises(ValueError):
            reader = CSVReader(bad_column_path)
            reader.get_value('Address', 0)
Ejemplo n.º 5
0
 def setUp(self):
     proxy_file_path = './Docs/Proxyfile_examples/local_proxy.csv'
     reader = CSVReader(proxy_file_path)
     self._extractor = ProxyExtractor(reader)