1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #1350 from Badiboy/master

Custom request sender
This commit is contained in:
Badiboy
2021-11-03 18:50:25 +03:00
committed by GitHub
3 changed files with 55 additions and 7 deletions

View File

@@ -12,6 +12,11 @@ import logging
from telebot import types
try:
import ujson as json
except ImportError:
import json
try:
# noinspection PyPackageRequirements
from PIL import Image
@@ -165,6 +170,16 @@ class AsyncTask:
return self.result
class CustomRequestResponse():
def __init__(self, json_text, status_code = 200, reason = ""):
self.status_code = status_code
self.text = json_text
self.reason = reason
def json(self):
return json.loads(self.text)
def async_dec():
def decorator(fn):
def wrapper(*args, **kwargs):