GitXplorerGitXplorer
a

python-www

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.

No commits found

There are no commits on branch master.

README

The README file for this repository.

python-www

Inspired by justjavac/proxy-www

from typing import Callable
import requests


class WWW:
    def __init__(self, name: str = "http://www"):
        self.name = name

    def __repr__(self):
        return repr(self.name)

    def get(self, *args: Callable):
        res = requests.get(self.name)
        for f in args:
            f(res)

    def __getattr__(self, name):
        return WWW(f"{self.name}.{name}")


www = WWW()
www.example.com.get(
    lambda x: print(x.status_code),
    lambda x: print(x.headers["content-type"]),
)

Just for fun😉