File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 7
7
from langchain_core .documents import Document
8
8
from .base_node import BaseNode
9
9
from ..utils .remover import remover
10
- from ..utils .proxy_rotation import proxy_rotation
10
+ from ..utils .proxy_generator import proxy_generator
11
11
12
12
13
13
class FetchNode (BaseNode ):
@@ -84,7 +84,7 @@ def execute(self, state):
84
84
else :
85
85
if self .num_prox > 1 :
86
86
loader = AsyncHtmlLoader (
87
- source , proxies = proxy_rotation (self .num_prox ))
87
+ source , proxies = proxy_generator (self .num_prox ))
88
88
else :
89
89
loader = AsyncHtmlLoader (source )
90
90
document = loader .load ()
Original file line number Diff line number Diff line change 5
5
from .convert_to_csv import convert_to_csv
6
6
from .convert_to_json import convert_to_json
7
7
from .prettify_exec_info import prettify_exec_info
8
- from .proxy_rotation import proxy_rotation
8
+ from .proxy_generator import proxy_generator
Original file line number Diff line number Diff line change 4
4
from fp .fp import FreeProxy
5
5
6
6
7
- def proxy_rotation (num_ips : int ):
7
+ def proxy_generator (num_ips : int ):
8
8
"""
9
9
Rotates through a specified number of proxy IPs using the FreeProxy library.
10
10
@@ -15,7 +15,7 @@ def proxy_rotation(num_ips: int):
15
15
dict: A dictionary containing the rotated proxy IPs, indexed by their position in rotation.
16
16
17
17
Example:
18
- >>> proxy_rotation (5)
18
+ >>> proxy_generator (5)
19
19
{
20
20
0: '192.168.1.1:8080',
21
21
1: '103.10.63.135:8080',
@@ -24,9 +24,8 @@ def proxy_rotation(num_ips: int):
24
24
4: '113.20.31.250:8080'
25
25
}
26
26
"""
27
- res = {}
27
+ res = []
28
28
29
29
for i in range (0 , num_ips ):
30
- res [i ] = FreeProxy ().get ()
31
-
30
+ res .append (FreeProxy ().get ())
32
31
return res
You can’t perform that action at this time.
0 commit comments