Simplify code#2
Simplify code#2JASON0916 wants to merge 2 commits intopython-telegram-bot:masterfrom JASON0916:simplify-code
Conversation
|
Hey Jason, thanks for the pull request. I'll be testing/reviewing your code. |
|
Would you mind to push ignoring .idea folder though? Thanks! |
|
Actually i am going to buy a VPN latter. I noticed that there is a new version of your code, i will work on the new version then, just ignore the pull request this time 0 -0. I'm sorry for the .idea, i will pay attention on that next time. |
There was a problem hiding this comment.
In case of data is None, data.keys() will raise an AttributeError.
|
No worries at all. data['photo', 'video', ...] could be either:
if none of the options above, it falls on urlencode(data) simple post request. Thanks! |
|
I found the discussion related on discussion site. I think we may use urlparse in our case, even url.startwith('http') is OK for the flexible url rules. There seems to be little invalid url. How do you think about that? |
|
Uhm, after reading the post you sent, startswith seems to be enough for
|
The change is mainly about Bot._requestUrl(self, url, method, data=None). In sendPhoto(), sendAudio() and sendVideo i found that data.keys()[1] represents the file type, so i tried to simply the code.
For Chinese government's sake i can't access telegram, which disables my test. I'm sorry if my code brings you trouble.