How To Get Your IP Address In Vanilla Python TUTORIAL

Sdílet
Vložit
  • čas přidán 2. 07. 2024
  • In this tutorial I will be showing you how you can get your IP address in vanilla Python. It's super easy!
    ▶ Become job-ready with Python:
    www.indently.io
    ▶ Follow me on Instagram:
    / indentlyreels

Komentáře • 17

  • @canberkok1512
    @canberkok1512 Před rokem

    Bet your soft is absolutely amazing! Never give up

  • @hacked.hacked
    @hacked.hacked Před rokem +1

    ❤️

  • @BezwadaSreeCharanBASMSPUP

    how u can change ur orginal ip address in the vpn with the help of the python ?

    • @neutron-au
      @neutron-au Před rokem

      Of course, as you can do almost everything in python. But there is no universal way of doing this. The best thing you could do is proxy requests ("requests" module) using the "proxies=" keyword argument when calling each type of request.

  • @-kekmacska-48
    @-kekmacska-48 Před 7 měsíci

    How did you type that arrow at 0:43?

    • @Pawlo370
      @Pawlo370 Před měsícem

      that means you are returning a string, so type(get_ip(some_variable)) will be a string however, python is dynamically typed, so it’s only to see for other programmers what we can get from this function

    • @CorrectMyGrammarPls
      @CorrectMyGrammarPls Před 23 dny +1

      Its just a minus and a greater than, the font automatically joins them together to seem like a single character

  • @mrgermanyhd
    @mrgermanyhd Před rokem

    I have this problem with tkinter. Can u help me?
    File "c:\Users\jp\Desktop\Python_3.10\tk.py", line 1, in
    import tkinter
    File "c:\Users\jp\Desktop\Python_3.10\tkinter.py", line 8, in
    window = tk()
    ^^^^
    TypeError: 'module' object is not callable

    • @EpicNoobx
      @EpicNoobx Před rokem

      What exactly is tk? Did you import tkinter as tk? If so, you need to do tk.Tk() instead.

    • @_lun4r_
      @_lun4r_ Před rokem +1

      if you imported tkinter with "import tkinter as tk", do "window = tk.Tk()", otherwise you'll get errors

    • @EpicNoobx
      @EpicNoobx Před rokem

      @@_lun4r_ Also, if you did not import Tkinter with a special name just do "window = tkinter.Tk()".

  • @Zaeemtechnical
    @Zaeemtechnical Před rokem

    Even we can access our local ip address from sockets too: @Indently
    import socket
    get_ip = lambda : socket.gethostbyname(socket.gethostname())
    print(get_ip())

    • @Indently
      @Indently  Před rokem

      Yeah local is straightforward, getting the public, not so much.

  • @bogdannedelcu3209
    @bogdannedelcu3209 Před rokem

    import socket
    hostname = socket.gethostname()
    IPadd = socket.gethostbyname(hostname)
    print(IPadd)
    Here we go, make your code simple

    • @Indently
      @Indently  Před rokem +3

      1) It's not vanilla Python
      2) It only returns your private IP Address

    • @royler8848
      @royler8848 Před rokem

      @@Indently wtf
      what do you mean by vanilla python
      I'd argue that 'socket' is more vanilla than urlib because urlib uses sockets
      but yes it is impossible to get the public IP of the NAT gateway of your LAN with only local socket operations.

    • @Indently
      @Indently  Před rokem +1

      @@royler8848 You're absolutely right, my first point was a very poor choice of words. You got me there.