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
def setUp(self): proxy_file_path = './Docs/Proxyfile_examples/example.csv' self._reader = CSVReader(proxy_file_path)
def test_bad_row_error(self): bad_row_path = './Docs/Proxyfile_examples/bad_row_example.csv' with self.assertRaises(ValueError): CSVReader(bad_row_path)
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)
def setUp(self): proxy_file_path = './Docs/Proxyfile_examples/local_proxy.csv' reader = CSVReader(proxy_file_path) self._extractor = ProxyExtractor(reader)