예제 #1
0
 def api(self, name, info, host='localhost:8000', udp=False):
     if udp:
         print(['API (UDP)', name, info])
         self.udp_socket.sendto(json.dumps(info), (udp_host, udp_port))
     else:
         print(['API' if udp else '', name, info])
         url = 'http://%s/api/v0/%s.json' % (host, name)
         j = simpleGet(url, GET={'json': json.dumps(info)}, verbose=True)
         return json.loads(j)
예제 #2
0
 def api(self, name, info, host='localhost:8000', udp=False):
     if udp:
         print(['API (UDP)', name, info])
         self.udp_socket.sendto(json.dumps(info), (udp_host, udp_port))
     else:
         print(['API' if udp else '', name, info])
         url = 'http://%s/api/v0/%s.json' % (host, name)
         j = simpleGet(url, GET={'json': json.dumps(info)}, verbose=True)
         return json.loads(j)
예제 #3
0
def main():

    for (type, filename) in (('js', 'dotmuncher.js'), ('css',
                                                       'dotmuncher.css')):
        destDir = '%s/static/%s' % (REPO, type)
        check_call(['mkdir', '-p', destDir])
        sys.stdout.write('%s... ' % filename)

        data = simpleGet('http://localhost:8000/static/%s/%s' %
                         (type, filename))

        if type == 'js':
            #data = pj.api.closureCompile(data, 'simple')
            data = pj.api.closureCompile(data, 'pretty')
            #sys.path.append('TODO/gordian-minifier')
            #import gordian_minifier
            #data = gordian_minifier.minify(data)

        destPath = '%s/%s' % (destDir, filename)
        with open(destPath, 'wb') as f:
            f.write(data)
        sys.stdout.write('done.\n')
예제 #4
0
def main():
    
    for (type, filename) in (
            ('js', 'dotmuncher.js'),
            ('css', 'dotmuncher.css')):
        destDir = '%s/static/%s' % (REPO, type)
        check_call(['mkdir', '-p', destDir])
        sys.stdout.write('%s... ' % filename)
        
        data = simpleGet('http://localhost:8000/static/%s/%s' % (type, filename))
        
        if type == 'js':
            #data = pj.api.closureCompile(data, 'simple')
            data = pj.api.closureCompile(data, 'pretty')
            #sys.path.append('TODO/gordian-minifier')
            #import gordian_minifier
            #data = gordian_minifier.minify(data)
        
        destPath = '%s/%s' % (destDir, filename)
        with open(destPath, 'wb') as f:
            f.write(data)
        sys.stdout.write('done.\n')