Ok so I have been searching for several days on how to write a simple python script that will HTTP post to my server. I am jsut looking for some tips on how to write this properly cause as of right now im having to upload my add and update files manually and it would make things easyer to be able to run a python script to do it for me. So any help would be greatly appriciated at this time.
So you wish to write a script that upload files via HTTP.
The key to this would probably be in 2 steps.
Authenticating yourself with the server.
You would probably need some way to authenticate yourself, Maybe a session id or other cookies will be returned to you. You can either login on your browser and then pass them as arguments to your script. Or let the script handle that.
In order to transfer files you'll need to make a multi-part HTTP request. you can use python's httplib or urllib to do this. I think we have a lot of helper libraries that you can find on the internet. (Just use your favourite search engine to look this up.)
This would be fine if you wish to upload files directly, however updating would be a completely different issue. And this is very specific to how your server handles update.
Before you consider doing the above, We would not require to do this if your server allows FTP. But if you're trying this out as an experiment. Feel free to add in more queries.
Sky what im wanting to to is looking like the file transfer. THe files im wanting to add to two seperate list are called add and update. I jsut need to know how to get python to login to my server then upload these two files to their designated list.
As I have mentioned earlier. If your server allows FTP, An FTP client would easily add and update files for you at your server.
If you wish to upload your files through your login panel, then the following is worth looking into.
How is your server authenticating you. (Eg: username and password, that assigns you a particular sessionid cookie?)
Once you are authenticated, you will then need to find out at which location can you add your files. ( Example file_upload.php ) And then determine what are the parameters that you need to pass for this to happen.
Then send a HTTP request.
If you have already implemented a page on your server and simply need to call that with your 2 files.
Then you can skip all of the above and look into multi-part HTTP requests.