How to get Public IP and set symmetrical port mapping on Pod via Python SDK

I have created a pod with python in the following way

runpod.api_key = os.getenv("RUNPOD_API_KEY")
bot_name = 'Testing Pod Public IP 1'

pod = runpod.create_pod(
    name=bot_name,
    image_name="runpod/pytorch:2.2.0-py3.10-cuda12.1.1-devel-ubuntu22.04",
    gpu_count=1,
    gpu_type_id='NVIDIA A40',
    network_volume_id="8y",
    volume_mount_path="/workspace",
    ports= "8888/http,22/tcp,70001/tcp",
    env={
        "PUBLIC_KEY": "ssh-ed25519 ",
        "JUPYTER_PASSWORD": "h7xw7gxh407nxshza6f3",
        "RUNPOD_PUBLIC_IP": "10.2.25.69",
        "RUNPOD_TCP_PORT_70001": 5000
    },
    support_public_ip=True,
    docker_args="/workspace/start_finetune.sh",
    container_disk_in_gb=20                    
)

print(pod)


I also tried to use the console for clarity, but even when I put 70001 in TCP it wont map 5000:5000 but instead it assigns a port itself.

Even when it does, how do I know which port it is via python?
image.png
image.png
Was this page helpful?