Author Topic: [Python] Get string from http server  (Read 2571 times)

0 Members and 1 Guest are viewing this topic.

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
[Python] Get string from http server
« on: June 02, 2012, 10:51:04 pm »
I was having a discussion with my brother about a program I was writing and I had to leave in the middle of it. I was trying to get my program to auto-update. He said for it to check on my webserver and get the version number and if it was less, auto-downloads it. He moved out before I could ask him about it and now I'm stuck. He said something about heroku too. Either way I have no clue to check the version number. Thank you for reading.
Blog: rexmckinnon.tumblr.com

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Python] Get string from http server
« Reply #1 on: June 02, 2012, 11:10:35 pm »
Well checking for version is very simple. I had done this before.
Basically I have a PHP script that accepts an argument of the current version. My program sends a request and the script echoes TRUE if there is an update or FALSE if not.

Never heard of heroku though.

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
Re: [Python] Get string from http server
« Reply #2 on: June 02, 2012, 11:16:53 pm »
I thought about doing that, but I also wanted it so I could issue special commands such as to delete the program, or prompt the user to delete it.


and heroku:


http://www.heroku.com/
Blog: rexmckinnon.tumblr.com

Offline centizen

  • Peasant
  • *
  • Posts: 70
  • Cookies: 8
  • Certified Evil Genius
    • View Profile
Re: [Python] Get string from http server
« Reply #3 on: June 02, 2012, 11:49:49 pm »
what I've done in the past, is made a text file in the root www/ directory called version.txt, and the only thing in there is the latest version of my program. The client app would download it, parse it and check it, and if it was lower than the latest version, download the latest version of my program from my server.


As well, heroku looks cool, but without a little more context I'm not sure why he would be recommending it to you.

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
Re: [Python] Get string from http server
« Reply #4 on: June 03, 2012, 12:04:42 am »
I think I will be doing that, thanks for the suggestion. Not what I was originally hoping for, but it will work. And as for heroku, he had just found it and he thought heroku was the best way to do everything.
Blog: rexmckinnon.tumblr.com

Offline centizen

  • Peasant
  • *
  • Posts: 70
  • Cookies: 8
  • Certified Evil Genius
    • View Profile
Re: [Python] Get string from http server
« Reply #5 on: June 03, 2012, 12:17:11 am »
well another option that I've just thought of is to simply make the title of the text document the version number. That way all the program has to do is read the directory, and assuming you've only got one text file in there take the title of the file as the number

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
Re: [Python] Get string from http server
« Reply #6 on: June 03, 2012, 12:31:07 am »
I am going to it in a text file so I can have multiple commands/numbers. Like ProgramA could read line 1, ProgramB can read lines 2&3, etc. Really good idea, I'm feeling my ideas blossom. :D
Blog: rexmckinnon.tumblr.com

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Python] Get string from http server
« Reply #7 on: June 03, 2012, 08:20:30 am »
that would be an overkill and not professional at all. Just make a PHP script that accepts 2 arguments, a version and a program name. Scripts checks the input and returns true or false. Seems much simpler this way ya know and you won't let the file open for everyone to see. Think about permissions bro.

Offline centizen

  • Peasant
  • *
  • Posts: 70
  • Cookies: 8
  • Certified Evil Genius
    • View Profile
Re: [Python] Get string from http server
« Reply #8 on: June 03, 2012, 04:47:12 pm »
To be honest I don't see how having a file with only read permissions is going to be a security risk. I can see why the script is cleaner but theres not much that can be done with just a read only text file in a directory.

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
Re: [Python] Get string from http server
« Reply #9 on: June 03, 2012, 07:30:28 pm »
that would be an overkill and not professional at all. Just make a PHP script that accepts 2 arguments, a version and a program name. Scripts checks the input and returns true or false. Seems much simpler this way ya know and you won't let the file open for everyone to see. Think about permissions bro.

Only problem is I don't  know PHP. And how would that work?
Blog: rexmckinnon.tumblr.com

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Python] Get string from http server
« Reply #10 on: June 03, 2012, 09:50:53 pm »
Neither do I but with the help of google I managed to wind a script for myself. Maybe someone will be kind enough to write those 20 lines for ya :P