haveswing

rank()_01

Dec 30th, 2016
991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. if command.startswith('/rank '):
  2.     rank(msg)
  3.  
  4. def rank(msg):
  5.     chat_id = msg['chat']['id']
  6.     command = msg['text']
  7.    
  8.     user = msg['text'][6:]
  9.     graphUrl = 'https://www.website.com/servlet/graph/' + user + '-in_US.png'
  10.     print graphUrl
  11.    
  12.     theGraph = urllib2.urlopen(graphUrl)
  13.  
  14.     bot.sendPhoto(chat_id, theGraph, caption=('rank graph for ' + user + '.'))
  15.  
  16. # Error:
  17. # 2016-12-30T17:17:50.803142+00:00 app[worker.1]: TelegramError: (u'Bad Request: Photo has unsupported extension. Use one of .jpg, .jpeg, # .gif, .png, .tif or .bmp', 400, {u'ok': False, u'description': u'Bad Request: Photo has unsupported extension. Use one of .jpg, .jpeg, # .gif, .png, .tif or .bmp', u'error_code': 400})
Advertisement
Add Comment
Please, Sign In to add comment