Update FileMessage Attribute name to match
Problem
what __repr__ show

what I expect
event.message["fileName"] # or
event.message.fileName
but this is what to code
event.message.file_name
for fileSize as well
Do you suggest __repr__ implementation should be modified so that it prints like this?
message: { file_name: ..., file_size: ..., ... }
yes
Thanks for opening the nice issue.
Hello @CircleOnCircles, The pull request may meet your request.
Hello @CircleOnCircles, The pull request may meet your request.
Already check that so the PR allow dictionary-access e.g. message['fileName'] Gj 👍
There are 2 more things to consider.
__repr__now matched with dictionary-access which is a nice thing 👍- the dot access e.g.
message.file_nameis it consider an internal api?
if it is, may be leave it as is or refactor the variable name to message._file_name to signal developers and IDE to not suggest that variable.
else we might need another PR to
- refactor the name to
message.fileNameOR - do a monkey patch or
@propertyformessage.fileName
Hello @CircleOnCircles, The pull request may meet your request.
Already check that so the PR allow dictionary-access e.g.
message['fileName']Gj 👍There are 2 more things to consider.
__repr__now matched with dictionary-access which is a nice thing 👍- the dot access e.g.
message.file_nameis it consider an internal api?
There is a good question, it could be answered by official Line developer. I thought it might consider the beautiful Python code.
if it is, may be leave it as is or refactor the variable name to
message._file_nameto signal developers and IDE to not suggest that variable.else we might need another PR to
- refactor the name to
message.fileNameOR- do a monkey patch or
@propertyformessage.fileName
I have the idea that making a switched variable to decide attribute name format (fileName or file_name) in Message class.
What is a 'switch var' in python like? I've never heard this before.
What is a 'switch var' in python like? I've never heard this before.
Oh sorry, it just named by myself. It's mean a variable which could choose whether using the original attribute name. btw, I've committed it to https://github.com/line/line-bot-sdk-python/pull/252
Oh sorry, it just named by myself. It's mean a variable which could choose whether using the original attribute name. btw, I've committed it to #252
oh I see what you mean. 😉
resolved by https://github.com/line/line-bot-sdk-python/pull/252