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

All Samples(12)  |  Call(6)  |  Derive(0)  |  Import(6)

        def get_response(file, url, errorfunc):
    try:
        if file:
            h = open(file, 'rb')
            try:
                # quick test to see if responsefile contains a dict
                line = h.read(10)
                front = line.split(':', 1)[0]
                assert front[0] == 'd'
                int(front[1:])
            except:
                errorfunc(file + ' is not a valid responsefile')
                return None
            try:
                h.seek(0)
            except:
                try:
                    h.close()
                except:
                    pass
                h = open(file, 'rb')
        else:
            try:
                h = urlopen(url)
            except:
                errorfunc(url + ' bad url')
                return None
        response = h.read()

    except IOError as e:
        errorfunc('problem getting response info - ' + str(e))
        return None
    try:
        h.close()
    except:
        pass
    try:
        try:
            response = bdecode(response)
        except:
            errorfunc("warning: bad data in responsefile")
            response = bdecode(response, sloppy=1)
        check_type(response, dict)
        check_info(response.get('info'))
        check_type(response.get('announce'), str)
    except ValueError as e:
        errorfunc("got bad file info - " + str(e))
        return None

    return response
        


src/s/w/swarm-HEAD/swarm/client.py   swarm(Download)
from BitTornado.download_bt1 import BT1Download, defaults, get_response
from BitTornado.RawServer import RawServer
from BitTornado.bencode import bencode
from BitTornado import createPeerID
from swarm.concurrent import spawn_later, Event
            # Download torrent metadata.
            response = get_response(
                file=config['responsefile'],
                url=config['url'],
                errorfunc=self.on_error)

src/b/i/BitTornado-HEAD/btdownloadcurses.py   BitTornado(Download)
import hashlib
import threading
from BitTornado.download_bt1 import BT1Download, defaults, parse_params, \
    get_usage, get_response
from BitTornado.RawServer import RawServer
                    return
 
            response = get_response(config['responsefile'], config['url'],
                                    d.error)
            if not response:

src/b/i/BitTornado-HEAD/btdownloadheadless.py   BitTornado(Download)
import hashlib
import threading
from BitTornado.download_bt1 import BT1Download, defaults, parse_params, \
    get_usage, get_response
from BitTornado.RawServer import RawServer
                return
 
        response = get_response(config['responsefile'], config['url'], h.error)
        if not response:
            break

src/f/r/FriendlyTorrent-HEAD/src/tornado/tftornado.py   FriendlyTorrent(Download)
    except:
        pass
from BitTornado.download_bt1 import BT1Download, defaults, parse_params, get_usage, get_response
from BitTornado.RawServer import RawServer, UPnP_ERROR
from random import seed
                    return
 
            response = get_response(config['responsefile'], config['url'], h.error)
            if not response:
                break

src/b/i/BitTornado-HEAD/btdownloadgui.py   BitTornado(Download)
from webbrowser import open_new
from StringIO import StringIO
from BitTornado.download_bt1 import BT1Download, parse_params, get_usage, \
    get_response
from BitTornado.RawServer import RawServer
            d.connection_stats = rawserver.get_stats()
 
            response = get_response(config['responsefile'], config['url'],
                                    d.error)
            if not response:

src/h/e/Herd-HEAD/murder_client.py   Herd(Download)
        pass
 
from BitTornado.download_bt1 import BT1Download, defaults, parse_params, get_usage, get_response
from BitTornado.RawServer import RawServer, UPnP_ERROR
from random import seed
                return
 
        response = get_response(config['responsefile'], config['url'], h.error)
        if not response:
            break