I have an Enum as follows:
class RequestMethodVerbMapping(Enum):
POST = 'Create'
PUT = 'Update'
DELETE = 'Delete'
Now, in order to access the string associated with a certain HTTP verb, I do the following:
In [19]: RequestMethodVerbMapping.POST.value
Out[19]: 'Create'
Works as expected.However, now the HTTP verb is a class attribute and I want to access the enum in a class method. I did the following:
import RequestMethodVerbMapping
class BaseWorkFlow:
def __init__(self, request_method):
self.request_method = request_method
def print_enum(self):
print (RequestMethodVerbMapping.self.request_method.value)
However, this does not work and gives me an error:
AttributeError: self
What am i doing wrong ?