Skip to content

Commit

Permalink
remove prints
Browse files Browse the repository at this point in the history
  • Loading branch information
glyh committed Sep 28, 2024
1 parent dd0d83b commit e2a43c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion javsp/crawlers/proxyfree.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ async def get_proxy_free_url(site_name: CrawlerID, prefer_url: str | None = None
if site_name in proxy_free_fns:
try:
urls = await proxy_free_fns[site_name]()
print(f"I got {urls}")
return await choose_one_connectable(urls)
except:
return None
Expand Down
10 changes: 4 additions & 6 deletions javsp/network/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ async def url_download(url: Url, target_path: str, desc: str | None = None) -> D
async def test_connect(url_str: str, timeout: Duration) -> bool:
"""测试与指定url的连接,不使用映射,但使用代理"""
try:
print(f"Attemping to connect {url_str}")
client = get_client(Url(url_str))
response = \
await client.get(
Expand All @@ -71,7 +70,6 @@ async def test_connect(url_str: str, timeout: Duration) -> bool:
return False

async def choose_one_connectable(urls: list[str]) -> str | None:
print(urls)
co_connectables: list[Coroutine[Any, Any, bool]] = []
for url in urls:
co_connectables.append(test_connect(url, Duration(seconds=5)))
Expand All @@ -95,10 +93,10 @@ async def resolve_site_fallback(cr_id: CrawlerID, default: str) -> Url:


if __name__ == '__main__':
# async def aentry():
# print(await choose_one_connectable(['http://iandown.what', 'http://www.baidu.com']))

async def aentry():
print(await test_connect("https://www.y78k.com/", timeout=3))
print(await choose_one_connectable(['http://iandown.what', 'http://www.baidu.com']))

# async def aentry():
# print(await test_connect("https://www.y78k.com/", Duration(seconds=3)))

asyncio.run(aentry())

0 comments on commit e2a43c7

Please sign in to comment.