How can I get the public IP using python2.7?

后端 未结 7 1469
梦毁少年i
梦毁少年i 2020-11-30 22:43

How can I get the public IP using python2.7? Not private IP.

7条回答
  •  感情败类
    2020-11-30 22:56

    in python 2.7 it's just a code of 2 lines.

    import requests

    print requests.get("http://ipconfig.in/ip").text

提交回复
热议问题