[cups.development] Remote IP

Jerome Alet alet at librelogiciel.com
Thu Oct 11 21:38:57 PDT 2007


On Thu, Oct 11, 2007 at 11:32:01AM -0700, Matthias Jansen wrote:
> > Matthias Jansen wrote:
> > > ...
> > > So, parsing the cxxxx file will be the only way to retrieve the IP at the moment?
> >
> > The format may change at any time; the only supported method is
> > to issue an IPP request to the local server to get it.
> OK, I have no idea how to do that. Would it be possible to give me 
> an example? Preferable perl, but could be in any language. 

In python with the help of pkipplib, a pure Python implementation
of IPP :

--- CUT ---
# Download pkipplib from http://www.pykota.com
from pkipplib import pkipplib

cups = pkipplib.CUPS() # by default http://localhost:631
                       # Doesn't work yet with unix domain sockets
# Retrieve all attributes of job #1563                       
answer = cups.getJobAttributes(1563) 

# Display the one we are interested in 
print answer.job["job-originating-host-name"][0][1]
--- CUT ---

Could this be made simpler than that ?


Jerome Alet

More information about the cups-devel mailing list