Simple HTTP Server in Python

Поделиться
HTML-код
  • Опубликовано: 22 июл 2024
  • In this video, we learn how to build a simple Python HTTP server.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine.com/books/
    💻 The Algorithm Bible Book: www.neuralnine.com/books/
    👕 Programming Merch: www.neuralnine.com/shop
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine.com/
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/NeuralNine
    🎙 Discord: / discord
    🎵 Outro Music From: www.bensound.com/
    Timestamps:
    (0:00) Intro
    (0:28) Command Line
    (6:18) Custom Python HTTP Server
    (17:23) Outro
  • НаукаНаука

Комментарии • 99

  • @azkaarkhatib
    @azkaarkhatib Год назад +86

    Great info. I love how you actually googled after you got stuck and didn't cut that part out. Google search is an important skill for any programmer.

    • @Logan_Wolf_Online
      @Logan_Wolf_Online 6 месяцев назад

      A lot of new programmers feel insecure about googling things after a while, because all these folks who show different tutorials tend to not show just how common it is to need to reference documentation or their source code they are using for the tutorial. It happens a lot however, so there is no shame in needing to check reference information.

    • @RileyMeta
      @RileyMeta 2 месяца назад

      It doesn't matter if you know how to do everything from memory. It only matters if you know how to get the answers and implement them properly.

  • @SoftEngiNir
    @SoftEngiNir 4 месяца назад +2

    Thank you so much! Very simply put, great job!

  • @leiloz
    @leiloz 2 года назад +12

    Very useful video, thanks!

  • @markosth09
    @markosth09 2 года назад +30

    Btw {{ is the proper way to escape { in f-strings

  • @jackReme
    @jackReme 2 года назад +4

    Thanks alot I love your videos! They are always very helpful! Thanks

  • @CR33D404
    @CR33D404 11 месяцев назад

    Does the basehttpServer doesn’t provide a way for the handler to get the query parameters?

  • @Indodapro
    @Indodapro 2 месяца назад +1

    That intro deserves a sub

  • @RhoChalmers
    @RhoChalmers 3 месяца назад

    This was fun. Thanks!

  • @DaivaDarpana
    @DaivaDarpana Год назад

    I'd like to create a test www using html+python but... not on my local computer only directly on the server in order to be visible for any1 via internet.
    Have you got any tutorial how to do that?

  • @albertoricardomorales6328
    @albertoricardomorales6328 2 года назад +1

    This is great, no more usb 😂
    Very useful!

  • @AlexBerkk
    @AlexBerkk Год назад

    how do you retrive data from request? like URL path, POST data, get params?

  • @jonurwin1
    @jonurwin1 2 года назад

    Great video, thanks!

  • @dorb1337
    @dorb1337 Год назад

    basic but gold. thank you!

  • @LoneWolf-lw1sl
    @LoneWolf-lw1sl Год назад

    Do you know how give timeout for that http server using python?

  • @biswarupbhattacharyya4322
    @biswarupbhattacharyya4322 Год назад

    Can upload and download at the same time? Is there a way to do both?

  • @teclote
    @teclote Год назад

    Outstanding.

  • @marlymutos1000
    @marlymutos1000 2 года назад

    Thanks for the knowledge...

  • @terryscript64
    @terryscript64 2 года назад +4

    Can you do a video on how to make a customisable theme for http directory listing, the default one looks really old.

    • @CR33D404
      @CR33D404 11 месяцев назад

      That’s what I’m looking for, I’m too lazy to make a flask app for that

  • @biruktilhun7930
    @biruktilhun7930 2 года назад

    thanks! very good one

  • @cuzconice
    @cuzconice 2 года назад

    Gracias por la informacion!
    Thank you!!!

  • @shocker9434
    @shocker9434 2 года назад +2

    bro your videos are always helpful to me

  • @spectate_009
    @spectate_009 Год назад

    does anyone know how to add styling to the uhh directory listing ?

  • @cwansu
    @cwansu 2 года назад +3

    Please provide full video of your Beginning example

  • @TozzaYT
    @TozzaYT Год назад

    thank you so much 🎉

  • @oitudobom7418
    @oitudobom7418 2 года назад

    how Do I made other ppl to connect to my ip adress

  • @legends_talk1
    @legends_talk1 9 месяцев назад

    OMG 😮😮❤ thats cool

  • @joetimbersock7639
    @joetimbersock7639 Год назад +1

    Is this server secure? I was going to use this as a server but, the internet said it’s not secure. Is it secure? Need to know.

  • @vishwasluhana
    @vishwasluhana 2 года назад +16

    Hi, I think the problem at 14:04 is “,” before “utf-8” which you accidentally removed while typing.
    I am still not sure that if it would work with comma or not but it might be the problem.

    • @prboric
      @prboric 2 года назад +5

      You are correct, he deleted the comma by mistake in 13:46. He still needed the backslashes \{ and \} for it to work in addition to the missing coma.

    • @LZulb
      @LZulb Год назад +1

      The other problem is that
      f'\{"time": "{date}"\}'
      Should look like this
      f'\{"time": f"{date}"\}'

    • @CR33D404
      @CR33D404 11 месяцев назад +2

      @@LZulbwhat the heck is this

    • @LZulb
      @LZulb 11 месяцев назад

      @@CR33D404 probably some code

    • @CreepyMemes
      @CreepyMemes 6 месяцев назад +1

      @@LZulbwtf

  • @kklol07
    @kklol07 2 года назад +1

    HEY I JUST DISCOVERED YOUR CHANNEL TODAY, THANKS!

  • @alternativeenergyresearch4857
    @alternativeenergyresearch4857 Год назад

    I am getting data in python in excel sheet I want to push data to other programs / software through DDE please can you make video

  • @fastturtle888
    @fastturtle888 Год назад

    How do I stop the server?

  • @x9rtu3os1t8
    @x9rtu3os1t8 2 года назад

    Name of song please

  • @alternativeenergyresearch4857
    @alternativeenergyresearch4857 Год назад

    Hello can you provide code to make excel as dde server

  • @erezperez4907
    @erezperez4907 Год назад

    best techer

  • @Anto-mi5pn
    @Anto-mi5pn 2 года назад +2

    What is the native python way to host a web server with REST APIs? How do you do it without frameworks? Is there no way to do it without frameworks that implement WSGI?

    • @ItsCOMMANDer_
      @ItsCOMMANDer_ 7 месяцев назад

      import python websocket library, reimplement all of http tls ssl and https yourslef i guess

  • @giorgikhachidze64
    @giorgikhachidze64 Год назад +3

    What is "-m" for ?

    • @shiyan99s
      @shiyan99s Год назад

      -m flag is when you want to use a Python module as a script.

  • @Sarah_42
    @Sarah_42 Год назад

    nice

  • @tamakunay9158
    @tamakunay9158 2 года назад +1

    thanks for the video

  • @indeliblyronnie
    @indeliblyronnie 5 месяцев назад

    Why not just rsync or scp?

  • @programmingnothing
    @programmingnothing 2 года назад +1

    amazing...

  • @TheLeOn4you
    @TheLeOn4you Год назад

    are you from Romania? sorry, im just curious !

  • @Mitchief
    @Mitchief 2 года назад

    i cant even get through the first step..in terminal when i write python -m http.server it shows invalid syntax!!!

    • @JThompson_VI
      @JThompson_VI 2 года назад

      Try python3 -m http.server I think the syntax was different in python 2

    • @yessir919
      @yessir919 Год назад

      did u get through the 1st step ? i also need some help, would appreciate it

  • @ojasdillikar4738
    @ojasdillikar4738 2 года назад

    Trust me , one day I'm gonna speedrun all your python videos 😤

    • @vasto_boy
      @vasto_boy Год назад

      Did you accomplish your mission sir?

  • @mohdqayyoomkhan2446
    @mohdqayyoomkhan2446 7 месяцев назад

  • @geochicken9156
    @geochicken9156 Год назад

    How do you make computers on different networks connect 😭

    • @ItsCOMMANDer_
      @ItsCOMMANDer_ 7 месяцев назад

      so, you need to forward the port on wich the server is running, and then access it by public ip

  • @ananrishan4333
    @ananrishan4333 2 года назад

    can u access the http server using a ipad or a phone or any other device instead of a computer?

    • @TheKing-hf8is
      @TheKing-hf8is 2 года назад

      Yep but u must be connected to the same connection

  • @kacpersuchecki3707
    @kacpersuchecki3707 Год назад

    WinError 10049- The requested address is not valid in its context

  • @codewithsmoil4098
    @codewithsmoil4098 2 года назад +2

    It means that I can start localhost at any port ?

    • @colton3507
      @colton3507 2 года назад +1

      Any open port

    • @codewithsmoil4098
      @codewithsmoil4098 2 года назад

      @@colton3507
      Ohh
      and what about closed ports ?

    • @colton3507
      @colton3507 2 года назад

      @@codewithsmoil4098 it just won't work on those ports. Idk the exact error it will give. But try it out!

    • @codewithsmoil4098
      @codewithsmoil4098 2 года назад

      @@colton3507
      Okay thanks for info.

  • @christianjekhiphop8246
    @christianjekhiphop8246 10 месяцев назад

    what is the fucking comand for switch to deskop
    -

  • @rtr195807
    @rtr195807 2 года назад

    One more important information!

  • @sanspentester8506
    @sanspentester8506 2 года назад

    Bro How can I have your Desktop wallpaper?

  • @ameymore7528
    @ameymore7528 2 года назад +2

    But how did you stop the server at 1:28 please tell me 😟😟 ??

  • @CR33D404
    @CR33D404 11 месяцев назад

    The ide should have warned u that u forgot to add a comma there

  • @arrayindexoutofboundsexcep1088
    @arrayindexoutofboundsexcep1088 2 года назад

    I learned something

  • @user-sr1ij3hw4r
    @user-sr1ij3hw4r Год назад

    thhhhhx

  • @rojeetmndr3749
    @rojeetmndr3749 2 года назад

    Here first

  • @badonker
    @badonker 2 года назад

    Second

  • @dafenshi2478
    @dafenshi2478 2 года назад

    3

  • @technically677
    @technically677 Год назад

    This dont work

  • @fehgabriel67
    @fehgabriel67 2 года назад +1

    how to host as Public IP?

    • @theonplore7373
      @theonplore7373 2 года назад

      Did you figure this out already?

    • @fehgabriel67
      @fehgabriel67 2 года назад

      @@theonplore7373 no, can you tell me?

    • @theonplore7373
      @theonplore7373 2 года назад

      @@fehgabriel67 no I haven't yet either, I have been testing things with aws EC2 instance, and trying to configure my web server's get and post reponses on there but I am running into problems, idk what your usecase is for but try looking into "IIS Web Server" maybe that'll help

    • @MrChoclateChip
      @MrChoclateChip 2 года назад

      ngrok

    • @DominicNweze
      @DominicNweze 2 года назад

      @@MrChoclateChip isn't this for hacking people cameras.
      What do you want with that 🤔

  • @SilverMiraii
    @SilverMiraii Год назад

    your intro destroyed my ears

  • @netanelkomm5636
    @netanelkomm5636 2 года назад +1

    You showed your IP lol…

    • @SuperMan-nl6hi
      @SuperMan-nl6hi 2 года назад +1

      hope guys who are watching this are just incapable of doing anything with that. lol

    • @DominicNweze
      @DominicNweze 2 года назад

      @@SuperMan-nl6hi apart from tracking where he is.
      Nothing special..

    • @ItsCOMMANDer_
      @ItsCOMMANDer_ 7 месяцев назад

      it starts with 192.168. wich mean that its an local ip you bafoon, wich cannot be used to track his location nor anything else you bafoon@@DominicNweze

  • @LeProffeseurFOU
    @LeProffeseurFOU Год назад

    Error code explanation: 501 - Server does not support this operation. Please Helpe @NeuralNine