Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parsing this will be a bit of a pain. May need to parse it on the way in and emit records without xml declarations.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Log slosh output. | ||
Copyright (c) 2008 Dustin Sallings <dustin@spy.net> | ||
""" | ||
|
||
import sys | ||
|
||
from twisted.internet import reactor, task | ||
from twisted.web import client | ||
|
||
cookies = {} | ||
|
||
def cb(factory): | ||
def f(data): | ||
global cookies | ||
cookies = factory.cookies | ||
print data | ||
return f | ||
|
||
def getPage(url): | ||
factory = client.HTTPClientFactory(url, cookies=cookies) | ||
scheme, host, port, path = client._parse(url) | ||
reactor.connectTCP(host, port, factory) | ||
factory.deferred.addCallback(cb(factory)) | ||
return factory.deferred | ||
|
||
lc = task.LoopingCall(getPage, sys.argv[1]) | ||
lc.start(0) | ||
|
||
reactor.run() |