#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    71
    Rep Power
    11

    creating Http agent wrapped as windows service


    Hi.
    I want to write app for win32 , and I don't know which tools to use.
    Basically the requirments are:
    1. Platform - win2000
    2. the app is loaded automatically when the OS starts,
    2. The app contains simple Http agent, that is able to retieve info from
    web site, and to check whether a certain information is contained in
    the response.
    3. The app should have an icon in the task bar.
    4. The icon on the task bar is capable of opening windows when clicked
    4. An install program for the app.

    Now, I don't know much about tools in python, and for some it very hard to get documentation.
    I thought of the following architecture:
    1. Using win services in order to start the app automatically.
    2. Using socket.py . ( Is there any way to use WinSock?)
    3. I do not know which tool to use to create install program and
    opening windows functinality.
    I'll appreciate any direction / lead,
    thank a lot
    Roy
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    Originally Posted by roypython
    ...
    Now, I don't know much about tools in python, and for some it very hard to get documentation.
    I thought of the following architecture:
    1. Using win services in order to start the app automatically.
    Yep. If you have Win32All or Activestate Python installed then you have full control over creating a Windows service. An alternative is to create a normal Python app and install a shortcut to it in the 'Startup' menu. This gives less control that an NT service, but will also work on Windows 95 & 98.

    Originally Posted by roypython
    2. Using socket.py . ( Is there any way to use WinSock?)
    The socket module calls WinSock directly, but is far too low level for what you want. Take a look at urllib and urllib2 in the standard library - they provide a high level API for downloading files over HTTP.

    Originally Posted by roypython
    3. I do not know which tool to use to create install program and
    opening windows functinality.
    I'll appreciate any direction / lead,
    thank a lot
    Roy
    For creating the windows and the icon in the task bar you could use the win32api and win32gui modules in Win32All, but that is hard going. Alternatively you could install and use wxPython, which provides a higher level interface. It is still a steep learning curve if you have never done any Windows programming before. Or you could possibly use TkInter which is a lot simpler, but I don't know if it has the ability to create the taskbar icon.

    For the installation, you will need to compile you program into a stand-alone executable using py2exe, then you can use any of the myriad installers that are available.

    Dave - The Developers' Coach
  4. #3
  5. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    I recommend the following. (There is a lot of learning to do here):

    You don't need to go so low level as socket.py - use httplib.

    Gui - wxPython (using wxTaskBarIcon) but if you know MFC then Pythonwin might be a place to look.

    To create a standalone executable application - use py2exe.

    I distribute apps as a self extracting archive using PowerArchiver but there are many similar programs e.g. Winzip. I've not used it but, for a full Windows installer you could try Inno.

    If you must make it a service then use Win32 extensions - specifically win32serviceutil.ServiceFramework Class. But why, what service does this application provide?

    Have fun
    Grim
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    71
    Rep Power
    11

    Results..


    Thanks.
    That was excellent advices.
    Creating simple HTTP agent is very simple with urllib.
    Creating GUI ( even multi-platfrom!!) and task bar icons with wxPython is great.
    As to your question Grim,
    this http agent checks periodically (wxTimer) the web server for data for that specific client ( the http agent sends unique id that identifies him as a client), and if there is a new
    msgs for that user, it opens a window(that contains wx.lib.iewin to show the msgs for that client)
    Again, thanks a lot for your great help.
    Roy

IMN logo majestic logo threadwatch logo seochat tools logo