def main(argv=None):
    rv = 0
    if argv is None:
        argv = ['???']

    prefs = core.load_prefs()
    options, args = parse_args(argv)

    if options.prefs:
        rv = run_prefs_gui(prefs)
    elif options.exit_daemon:
        rv = exit_daemon()
    elif options.daemon:
        rv = run_daemon(prefs, options.period, options.spread, options.detach)
    else:
        core.change_wallpaper(prefs)

    # clean up
    prefs.nuke()
    pythoscope.stop()
    return rv
def main (argv=None):
    rv = 0
    if argv is None:
        argv = ['???']

    prefs = core.load_prefs()
    options, args = parse_args(argv)

    if options.prefs:
        rv = run_prefs_gui(prefs)
    elif options.exit_daemon:
        rv = exit_daemon()
    elif options.daemon:
        rv = run_daemon(prefs, options.period, options.spread, options.detach)
    else:
        core.change_wallpaper(prefs)

    # clean up
    prefs.nuke()
    pythoscope.stop()
    return rv
Пример #3
0
        s.send("GET / HTTP/1.1\r\nHost: gunicorn.org\r\n\r\n")

        while True:
            data = s.recv(1024)
            if not data:
                break

            recved = len(data)
            nparsed = p.execute(data, recved)
            assert nparsed == recved

            if p.is_headers_complete() and not header_done:
                print p.get_headers()
                header_done = True

            if p.is_partial_body():
                body.append(p.recv_body())

            if p.is_message_complete():
                break

        print "".join(body)

    finally:
        s.close()


if __name__ == "__main__":
    main()
    pythoscope.stop()
Пример #4
0
        while True:
            data = s.recv(1024)
            if not data:
                break

            recved = len(data)
            nparsed = p.execute(data, recved)
            assert nparsed == recved

            if p.is_headers_complete() and not header_done:
                print p.get_headers()
                header_done = True

            if p.is_partial_body():
                body.append(p.recv_body())

            if p.is_message_complete():
                break

        print "".join(body)

    finally:
        s.close()

if __name__ == "__main__":
    main()
    pythoscope.stop()