Example #1
0
    def makeService(self, options):
        if not options['noisy-logging']:
            protocol.Factory.noisy = False
            
        endpoint = twitterEndpoint(options['endpoint'])
        tickeryService = service.MultiService()
        cache = TickeryCache(
            options['cache-dir'], options['restore-add-queue'],
            int(options['queue-width']), endpoint)
        cache.setServiceParent(tickeryService)
        
        root = File('www/output')
        root.putChild('tickery', RegularService(cache, endpoint))
        root.putChild(defaults.TICKERY_CALLBACK_CHILD, callback.Callback(cache))
        
        adminRoot = File('admin/output')
        adminRoot.putChild('tickery', AdminService(cache))
        root.putChild('admin', adminRoot)

        root.putChild('api', API(cache))
        
        factory = server.Site(root)
        if options['promiscuous']:
            kw = {}
        else:
            kw = { 'interface' : 'localhost' }
        tickeryServer = internet.TCPServer(int(options['port']), factory, **kw)
        tickeryServer.setServiceParent(tickeryService)
        
        return tickeryService
Example #2
0
    def makeService(self, options):
        if not options["noisy-logging"]:
            protocol.Factory.noisy = False

        endpoint = twitterEndpoint(options["endpoint"])
        tickeryService = service.MultiService()
        cache = TickeryCache(options["cache-dir"], options["restore-add-queue"], int(options["queue-width"]), endpoint)
        cache.setServiceParent(tickeryService)

        root = File("tickery/www/output")
        root.putChild("tickery", RegularService(cache, endpoint))
        root.putChild(defaults.TICKERY_CALLBACK_CHILD, callback.Callback(cache))

        adminRoot = File("tickery/admin/output")
        adminRoot.putChild("tickery", AdminService(cache))
        root.putChild("admin", adminRoot)

        factory = server.Site(root)
        if options["promiscuous"]:
            kw = {}
        else:
            kw = {"interface": "localhost"}
        tickeryServer = internet.TCPServer(int(options["port"]), factory, **kw)
        tickeryServer.setServiceParent(tickeryService)

        return tickeryService
Example #3
0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.  See the License for the specific language governing
# permissions and limitations under the License.

from tickery.cache import TickeryCache

def printHeader(what):
    print '\n%s[ %s ]%s' %  ('-' * 5, what, '-' * (70 - len(what)))


if __name__ == '__main__':
    cache = TickeryCache('.', True, 0, None)
    cache.loadAllCaches()

    printHeader('ADDER')
    print str(cache.adderCache)

    printHeader('OID/UID/NAME')
    print str(cache.oidUidScreennameCache)

    printHeader('USERS')
    print str(cache.userCache)

    printHeader('FRIENDS')
    print str(cache.friendsIdCache)

    printHeader('QUERIES')