GitXplorerGitXplorer
a

python-www

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
29b50ab0f4db7f27c265ad76e31636f557318ab0

fin

committed 4 years ago
Verified
8b0579cec5c4c6601e307e09d390b3b745944f92

Update README.md

committed 4 years ago
Verified
3274807df0f1dc5cbad244dab53c2318e5b347c2

Create main.py

committed 4 years ago
Verified
5fe7ee41d0655423006ad8bd7c7ed290ca78e87c

Update README.md

committed 4 years ago
Verified
9a5da18e3401c1bfa9429a20a0cf0c63dfb9adfd

Update README.md

committed 4 years ago
Verified
e79e819bb4f5071c954412761d2a7e3fa9a6e5b6

Initial commit

committed 4 years ago

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😉