Comment

Comment by maxmcd

The service can call itself, forever

    import urllib.request
    import json
    import threading

    def do_request():
        data = {"lang":"python", "code": open(__file__).read(), "stdin": ""}
        req = urllib.request.Request(
            "https://www.sharepad.io/run", 
            data=json.dumps(data).encode('utf-8'), 
            headers={
                'Content-Type': 'application/json'
            }
        )

        f = urllib.request.urlopen(req)
        print(f.read().decode('utf-8'))
    x = threading.Thread(target=do_request)
    x.start()
    do_request()
    x.join()
parent maxmcd 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton