コード例 #1
0
ファイル: track.py プロジェクト: Konubinix/BitTornado
            dirkeys = set()
            # each entry should have a corresponding info_hash
            for y in cinfo.itervalues():
                if not y[1]:
                    continue
                if y[1] not in x['allowed']:
                    raise ValueError
                # and each should have a unique info_hash
                if y[1] in dirkeys:
                    raise ValueError
                dirkeys.add(y[1])

alas = 'your file may exist elsewhere in the universe\nbut alas, not here\n'

local_IPs = AddrList()
local_IPs.set_intranet_addresses()


def isotime(secs=None):
    if secs is None:
        secs = time.time()
    return time.strftime('%Y-%m-%d %H:%M UTC', time.gmtime(secs))

http_via_filter = re.compile(' for ([0-9.]+)\Z')


def _get_forwarded_ip(headers):
    header = headers.get('x-forwarded-for')
    if header:
        try:
            x, y = header.split(',')