- Timestamp:
- 09/26/05 10:47:48 (19 years ago)
- Location:
- pykota/trunk/pykota/accounters
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/accounters/pjl.py
r2438 r2506 185 185 return self.printerInternalPageCounter 186 186 187 def main(hostname) : 188 """Tries PJL accounting for a printer host.""" 189 class fakeFilter : 190 def __init__(self) : 191 self.PrinterName = "FakePrintQueue" 192 self.JobSizeBytes = 1 193 194 def printInfo(self, msg, level="info") : 195 sys.stderr.write("%s : %s\n" % (level.upper(), msg)) 196 sys.stderr.flush() 197 198 def logdebug(self, msg) : 199 self.printInfo(msg, "debug") 200 201 class fakeAccounter : 202 def __init__(self) : 203 self.arguments = "pjl:9100" 204 self.filter = fakeFilter() 205 self.protocolHandler = Handler(self, sys.argv[1]) 206 207 acc = fakeAccounter() 208 return acc.protocolHandler.retrieveInternalPageCounter() 209 187 210 if __name__ == "__main__" : 188 211 if len(sys.argv) != 2 : … … 192 215 return msg 193 216 194 class fakeFilter : 195 def __init__(self) : 196 self.PrinterName = "FakePrintQueue" 197 self.JobSizeBytes = 1 198 199 def printInfo(self, msg, level="info") : 200 sys.stderr.write("%s : %s\n" % (level.upper(), msg)) 201 sys.stderr.flush() 202 203 def logdebug(self, msg) : 204 self.printInfo(msg, "debug") 205 206 class fakeAccounter : 207 def __init__(self) : 208 self.arguments = "pjl:9100" 209 self.filter = fakeFilter() 210 self.protocolHandler = Handler(self, sys.argv[1]) 211 212 acc = fakeAccounter() 213 print "Internal page counter's value is : %s" % acc.protocolHandler.retrieveInternalPageCounter() 217 pagecounter = main(sys.argv[1]) 218 print "Internal page counter's value is : %s" % pagecounter 219 -
pykota/trunk/pykota/accounters/snmp.py
r2438 r2506 187 187 return self.printerInternalPageCounter 188 188 189 def main(hostname) : 190 """Tries SNMP accounting for a printer host.""" 191 class fakeFilter : 192 def __init__(self) : 193 self.PrinterName = "FakePrintQueue" 194 self.JobSizeBytes = 1 195 196 def printInfo(self, msg, level="info") : 197 sys.stderr.write("%s : %s\n" % (level.upper(), msg)) 198 sys.stderr.flush() 199 200 def logdebug(self, msg) : 201 self.printInfo(msg, "debug") 202 203 class fakeAccounter : 204 def __init__(self) : 205 self.arguments = "snmp:public" 206 self.filter = fakeFilter() 207 self.protocolHandler = Handler(self, hostname) 208 209 acc = fakeAccounter() 210 return acc.protocolHandler.retrieveInternalPageCounter() 211 189 212 if __name__ == "__main__" : 190 213 if len(sys.argv) != 2 : … … 194 217 return msg 195 218 196 class fakeFilter : 197 def __init__(self) : 198 self.PrinterName = "FakePrintQueue" 199 self.JobSizeBytes = 1 200 201 def printInfo(self, msg, level="info") : 202 sys.stderr.write("%s : %s\n" % (level.upper(), msg)) 203 sys.stderr.flush() 204 205 def logdebug(self, msg) : 206 self.printInfo(msg, "debug") 207 208 class fakeAccounter : 209 def __init__(self) : 210 self.arguments = "snmp:public" 211 self.filter = fakeFilter() 212 self.protocolHandler = Handler(self, sys.argv[1]) 213 214 acc = fakeAccounter() 215 print "Internal page counter's value is : %s" % acc.protocolHandler.retrieveInternalPageCounter() 219 pagecounter = main(sys.argv[1]) 220 print "Internal page counter's value is : %s" % pagecounter