Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

feat: Add Free Proxies option into Google Scholar Toolkit (#1440)

Harry Ye15d95355fec6
diff --git a/camel/toolkits/google_scholar_toolkit.py b/camel/toolkits/google_scholar_toolkit.py
index f2158e01f..a770454b3 100644
--- a/camel/toolkits/google_scholar_toolkit.py
+++ b/camel/toolkits/google_scholar_toolkit.py
@@ -36,6 +36,7 @@ class GoogleScholarToolkit(BaseToolkit):
self,
author_identifier: str,
is_author_name: bool = False,
+ use_free_proxies: bool = False,
proxy_http: Optional[str] = None,
proxy_https: Optional[str] = None,
) -> None:
@@ -46,6 +47,8 @@ class GoogleScholarToolkit(BaseToolkit):
of the author to search for.
is_author_name (bool): Flag to indicate if the identifier is a
name. (default: :obj:`False`)
+ use_free_proxies (bool): Whether to use Free Proxies.
+ (default: :obj:`False`)
proxy_http ( Optional[str]): Proxy http address pass to pg.
SingleProxy. (default: :obj:`None`)
proxy_https ( Optional[str]): Proxy https address pass to pg.
@@ -53,6 +56,12 @@ class GoogleScholarToolkit(BaseToolkit):
"""
from scholarly import ProxyGenerator, scholarly
+ # Set Free Proxies is needed
+ if use_free_proxies:
+ pg = ProxyGenerator()
+ pg.FreeProxies()
+ scholarly.use_proxy(pg)
+
# Set Proxy is HTTP or HTTPS provided
if proxy_http or proxy_https:
pg = ProxyGenerator()