Hi, I'm playing with python internals to make objects behave like this: if I access to "object.attribute" I want to return the result of an HTTP GET request. However if i call "object.attribute()" I want an HTTP POST request to be executed.
So far I have been able to do the POST part, using two classes like this: class HTTPAttribute(object): def __init__(self, name): self.name = name def __call__(self, *args, **kwargs): url = BASE_URL + self.name requests.post(url, *args, **kwargs) class HTTPObject(object): def __getattr__(self, name): return HTTPAttribute(name) But I'm stuck implementing the HTTP GET request when accessing "object.attribute", Any idea ?? Thanks!! -- Marc -- https://mail.python.org/mailman/listinfo/python-list