Exemplo n.º 1
0
class Application(object):
    """a base class for dispatching WSGI requests"""
    def __init__(self, settings={}, prefix=""):
        """initialize the Application with a settings dictionary and an optional
        ``prefix`` if this is a sub application"""
        self.settings = settings
        self.mapper = routes.Mapper()
        self.setup_handlers(self.mapper)
        logpath = os.path.join(settings.log_dir, self.logfilename)
        self.loghandler = FileHandler(logpath)

    def __call__(self, environ, start_response):
        with self.loghandler.threadbound():
            request = werkzeug.Request(environ)
            m = self.mapper.match(environ=environ)
            if m is not None:
                handler = m['handler'](app=self,
                                       request=request,
                                       settings=self.settings)
                try:
                    return handler.handle(**m)(environ, start_response)
                except werkzeug.exceptions.HTTPException, e:
                    return e(environ, start_response)
            # no view found => 404
            return werkzeug.exceptions.NotFound()(environ, start_response)
Exemplo n.º 2
0
class Application(object):
    """a base class for dispatching WSGI requests"""
    
    def __init__(self, settings={}, prefix=""):
        """initialize the Application with a settings dictionary and an optional
        ``prefix`` if this is a sub application"""
        self.settings = settings
        self.mapper = routes.Mapper()
        self.setup_handlers(self.mapper)
        self.loghandler = FileHandler(self.logfilename)

    def __call__(self, environ, start_response):
        with self.loghandler.threadbound():
            request = werkzeug.Request(environ)
            m = self.mapper.match(environ = environ)
            if m is not None:
                handler = m['handler'](app=self, request=request, settings=self.settings)
                try:
                    return handler.handle(**m)(environ, start_response)
                except werkzeug.exceptions.HTTPException, e:
                    return e(environ, start_response)
            # no view found => 404
            return werkzeug.exceptions.NotFound()(environ, start_response)
Exemplo n.º 3
0
        password=password
    )
    
    print("logged in successfully as: %" % client.get('/me').username)

    track = client.post('/tracks', track={
    'title': 'Harmonic Mix %s' % mixfilename,
    'sharing': 'private',
    'description': 'Someone should add the song names in the mix here',
    'asset_data': open(mixfilename, 'rb')
})

    print("uploaded your mix as: %s", track.title)



class extenddict(dict):

    def __setitem__(self, key, value):
        """add the given value to the list of values for this key"""
        self.setdefault(key, []).append(value)




with file_handler.threadbound():
    newest = mixmaster(120)
    #soundcloudupload(newest)
    

Exemplo n.º 4
0
    password = raw_input('Enter your SoundCloud password: '******'/me').username)

    track = client.post(
        '/tracks',
        track={
            'title': 'Harmonic Mix %s' % mixfilename,
            'sharing': 'private',
            'description': 'Someone should add the song names in the mix here',
            'asset_data': open(mixfilename, 'rb')
        })

    print("uploaded your mix as: %s", track.title)


class extenddict(dict):
    def __setitem__(self, key, value):
        """add the given value to the list of values for this key"""
        self.setdefault(key, []).append(value)


with file_handler.threadbound():
    newest = mixmaster(120)
    #soundcloudupload(newest)