1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00
Merge develop to receive the Python3 compatible version of pyTelegramBotAPI.
This commit is contained in:
pieter 2015-07-01 18:29:29 +02:00
commit 938c98ced1
4 changed files with 9 additions and 6 deletions

View File

@ -2,5 +2,6 @@ language: python
python:
- "2.6"
- "2.7"
- "3.4"
install: "pip install -r requirements.txt"
script: cd tests && py.test

View File

@ -6,7 +6,7 @@ Python Telegram Bot API.
## How to install
* Need python2
* Need python2 or python3
* Install from source
```

View File

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import json
import time
import threading
import apihelper
import types
from telebot import apihelper, types
"""
Module : telebot
@ -73,15 +73,15 @@ class TeleBot:
self.polling_thread.start()
def __polling(self):
print 'telegram bot start polling'
print('telegram bot start polling')
while not self.__stop_polling:
try:
self.get_update()
except Exception as e:
print e
print(e)
time.sleep(self.interval)
print 'telegram bot stop polling'
print('telegram bot stop polling')
def stop_polling(self):
self.__stop_polling = True

View File

@ -145,11 +145,13 @@ def check_result(func_name, result):
raise ApiError(func_name + r' error.', result)
return result_json
def convert_markup(markup):
if not isinstance(markup, types.Jsonable):
return markup.to_json()
return markup
class ApiError(Exception):
def __init__(self, message, result):
super(ApiError, self).__init__(message)