turtl /

Filename Size Date modified Message
1.0 KB
102 B
1.3 KB
61 B
4.2 KB
Turtl is an HTTP proxy whose purpose is to throttle connections to
specific hostnames to avoid breaking terms of usage of those API
providers (like, technorati and so on).

The proxy can be used either as a library embedded in another
application or it can be started stand-alone using the provided twistd

Here's an example to use turtl from inside another python application:

from twisted.internet import reactor
from turtl import proxy, config

s = """\
# defaults is pulled out of the end results
# and used to fill hostnames with missing
# parameters
defaults: &defaults
    # calls that can be made inside the interval of time
    calls: 1

    # interval is specified in seconds
    interval: 1

    # the number of concurrent calls that we are allowed to
    # have running at any given time.
    concurrency: 10
    <<: [*defaults]
    calls: 5
    interval: 1

filter-rest: True
port: 8080

urlmap, rest, port = config.loadConfigFromString(s)
f = proxy.TurtlHTTPFactory(urlmap, rest)
reactor.listenTCP(port, f)

And here's an example of a command line to start it stand alone:

twistd --logfile=/var/log/turtl.log --pidfile=/var/run/ turtl -c /some/path/config.yaml -p turtlOne

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.