Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(45)  |  Call(26)  |  Derive(0)  |  Import(19)

        def bencode(x):
    r = []
    encode_func[type(x)](x, r)
    return ''.join(r)
        


src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/track.py   kamaelia(Download)
from BitTorrent.parsedir import parsedir
from BitTorrent.NatCheck import NatCheck
from BitTorrent.bencode import bencode, bdecode, Bencached
from BitTorrent.zurllib import quote, unquote
from BitTorrent import version
            if self.config['scrape_allowed'] not in ['specific', 'full']:
                return (400, 'Not Authorized', {'Content-Type': 'text/plain', 'Pragma': 'no-cache'},
                    bencode({'failure reason':
                    _("specific scrape function is not available with this tracker.")}))
            for infohash in paramslist['info_hash']:
            if self.config['scrape_allowed'] != 'full':
                return (400, 'Not Authorized', {'Content-Type': 'text/plain', 'Pragma': 'no-cache'},
                    bencode({'failure reason':
                    _("full scrape function is not available with this tracker.")}))
            if self.allowed is not None:
                fs[infohash] = self.scrapedata(infohash)
 
        return (200, 'OK', {'Content-Type': 'text/plain'}, bencode({'files': fs}))
 
    def get_file(self, infohash):
    def check_allowed(self, infohash, paramslist):
        if self.allowed is not None:
            if not self.allowed.has_key(infohash):
                return (200, 'Not Authorized', {'Content-Type': 'text/plain', 'Pragma': 'no-cache'},
                    bencode({'failure reason':

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/changetracker-console.py   kamaelia(Download)
from os.path import basename
from sys import argv, exit
from BitTorrent.bencode import bencode, bdecode
 
if len(argv) < 3:
        metainfo['announce'] = argv[1]
        h = open(f, 'wb')
        h.write(bencode(metainfo))
        h.close()
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/khashmir/krpc.py   kamaelia(Download)
 
from BitTorrent.defer import Deferred
from BitTorrent.bencode import bencode, bdecode
import socket
from BitTorrent.RawServer_magic import Handler
    def sendErr(self, addr, tid, code, msg):
        ## send error
        out = bencode({TID:tid, TYP:ERR, ERR :(code, msg)})
        olen = len(out)
        self.rltransport.sendto(out, 0, addr)
                        if ret:
                            #	make response
                            out = bencode({TID : msg[TID], TYP : RSP, RSP : ret})
                        else:
                            out = bencode({TID : msg[TID], TYP : RSP, RSP : {}})
        msg = {TID : chr(self.mtid), TYP : REQ,  REQ : method, ARG : args}
        self.mtid = (self.mtid + 1) % 256
        s = bencode(msg)
        d = Deferred()
        self.tids[msg[TID]] = d

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/makemetafile.py   kamaelia(Download)
from threading import Event
 
from BitTorrent.bencode import bencode, bdecode
from BitTorrent.btformats import check_info
from BitTorrent.parseargs import parseargs, printHelp
    if comment:
        data['comment'] = comment
    h.write(bencode(data))
    h.close()
 
    if comment:
        data['comment'] = comment
    h.write(bencode(data))
    h.close()
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/khashmir/khashmir.py   kamaelia(Download)
import traceback
 
from BitTorrent.bencode import bencode, bdecode
 
from BitTorrent.defer import Deferred
        try:
            f = open(os.path.join(self.ddir, "routing_table"), 'wb')
            f.write(bencode(d))
            f.close()
        except Exception, e:

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/Rerequester.py   kamaelia(Download)
from BitTorrent.zurllib import urlopen, quote, Request
from BitTorrent.btformats import check_peers
from BitTorrent.bencode import bencode, bdecode
from BitTorrent import BTFailure, INFO, WARNING, ERROR, CRITICAL
 
    def _got_peers(self, peers):
        if not self.howmany:
            return
        if not peers:
            self._postrequest(bencode({'peers':''}), peerid=self.wanted_peerid)
        else:
            self._postrequest(bencode({'peers':peers[0]}), peerid=None)            

src/b/e/benflix-HEAD/videoportal/BitTorrent/btreannounce.py   benflix(Download)
 
from sys import argv
from BitTorrent.bencode import bencode, bdecode
 
if len(argv) < 3:
        metainfo['announce'] = argv[1]
        h = open(f, 'wb')
        h.write(bencode(metainfo))
        h.close()
 

src/b/e/benflix-HEAD/videoportal/BitTorrent/btmakemetafile.py   benflix(Download)
from copy import copy
from string import strip
from BitTorrent.bencode import bencode
from BitTorrent.btformats import check_info
from BitTorrent.parseargs import parseargs, formatDefinitions
    if comment:
        data['comment'] = comment
    h.write(bencode(data))
    h.close()
 

src/k/a/kamaelia-HEAD/Sketches/RJL/Packages/Kamaelia/Community/RJL/Kamaelia/Protocol/Torrent/TorrentClient.py   kamaelia(Download)
        """
 
        from BitTorrent.bencode import bdecode, bencode
        metainfo = None
        try:

src/k/a/kamaelia-HEAD/Sketches/RJL/Kamaelia/Community/RJL/Kamaelia/Protocol/Torrent/TorrentClient.py   kamaelia(Download)
        """
 
        from BitTorrent.bencode import bdecode, bencode
        metainfo = None
        try:

  1 | 2  Next