Hey guys. why do i get the same url for
Hey guys. why do i get the same url for different sessions? what am in doing wrong?
import json
import random
import asyncio
from urllib.parse import urlencode, urlparse, parse_qs, unquote
from bs4 import BeautifulSoup
from apify import Actor
import httpx
import uuid
def generate_session_id():
return uuid.uuid4().hex
async def test_proxy_url_generation():
proxy_configuration = await Actor.create_proxy_configuration()
for _ in range(5):
session_id = generate_session_id()
proxy_url = await proxy_configuration.new_url(session_id=session_id)
print(f"Generated proxy URL: {proxy_url} with session ID: {session_id}")
async def main():
async with Actor:
await test_proxy_url_generation()
if __name__ == "__main__":
asyncio.run(main())
1 Reply
dependent-tan•9mo ago
2024-08-06T02:25:45.346Z ACTOR: Pulling Docker image of build SEdDoPnwQH4a7XXMT from repository.
2024-08-06T02:25:46.160Z ACTOR: Creating Docker container.
2024-08-06T02:25:46.946Z ACTOR: Starting Docker container.
2024-08-06T02:25:51.307Z INFO Initializing actor...
2024-08-06T02:25:51.309Z INFO System info ({"apify_sdk_version": "1.7.2", "apify_client_version": "1.6.4", "python_version": "3.11.9", "os": "linux"})
2024-08-06T02:25:51.755Z Generated proxy URL: http://session-8658c68df3a442c9a5a2cc6fae217999:*********@10.0.43.147:8011 with session ID: 8658c68df3a442c9a5a2cc6fae217999
2024-08-06T02:25:51.760Z Generated proxy URL: http://session-de1271a6f51a43489d77d074bacf68b1:*********@10.0.43.147:8011 with session ID: de1271a6f51a43489d77d074bacf68b1
2024-08-06T02:25:51.763Z Generated proxy URL: http://session-58e9bce37f4b4cfd81706a706ad0b0b8:*********@10.0.43.147:8011 with session ID: 58e9bce37f4b4cfd81706a706ad0b0b8
2024-08-06T02:25:51.768Z Generated proxy URL: http://session-837dca49a39f4729ae8ab7697f557eb8:*********@10.0.43.147:8011 with session ID: 837dca49a39f4729ae8ab7697f557eb8
2024-08-06T02:25:51.773Z Generated proxy URL: http://session-005bad07ac9d4e46918ae29c396d919f:*********@10.0.43.147:8011 with session ID: 005bad07ac9d4e46918ae29c396d919f
2024-08-06T02:25:51.775Z INFO Exiting actor ({"exit_code": 0})
i figured that the proxy url i was seeing is actually the proxy gateway. In fact the underlying ips are being rotated. Why the heck isnt there documentation regarding this?