samedi 24 octobre 2020

Call class method via variable name in python [duplicate]

How I can call class method via variable name, example:

def http_call(http_method):
 url = "https://httpbin.org/get"
 response = requests.http_method(url)
 return response

http_call("get")
http_call("post")

Thanks beforehand.





Aucun commentaire:

Enregistrer un commentaire