Update Telethon and use PyPI telethon-aio package

This commit is contained in:
Tulir Asokan
2018-03-04 13:35:24 +02:00
parent 172e472221
commit 021b60a45e
18 changed files with 37 additions and 38 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ import asyncio
import sqlalchemy as sql import sqlalchemy as sql
from sqlalchemy import orm from sqlalchemy import orm
from telethon.sessions import AlchemySessionContainer from telethon_aio.sessions import AlchemySessionContainer
from mautrix_appservice import AppService from mautrix_appservice import AppService
from .base import Base from .base import Base
@@ -66,7 +66,7 @@ if args.generate_registration:
sys.exit(0) sys.exit(0)
if config["appservice.debug"]: if config["appservice.debug"]:
telethon_log = logging.getLogger("telethon") telethon_log = logging.getLogger("telethon_aio")
telethon_log.addHandler(handler) telethon_log.addHandler(handler)
telethon_log.setLevel(logging.DEBUG) telethon_log.setLevel(logging.DEBUG)
log.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG)
+1 -1
View File
@@ -17,7 +17,7 @@
import platform import platform
import os import os
from telethon.tl.types import * from telethon_aio.tl.types import *
from mautrix_appservice import MatrixRequestError from mautrix_appservice import MatrixRequestError
from .tgclient import MautrixTelegramClient from .tgclient import MautrixTelegramClient
+4 -4
View File
@@ -17,10 +17,10 @@
import logging import logging
import re import re
from telethon.tl.types import * from telethon_aio.tl.types import *
from telethon.tl.functions.messages import GetChatsRequest from telethon_aio.tl.functions.messages import GetChatsRequest
from telethon.tl.functions.channels import GetChannelsRequest from telethon_aio.tl.functions.channels import GetChannelsRequest
from telethon.errors import ChannelInvalidError, ChannelPrivateError from telethon_aio.errors import ChannelInvalidError, ChannelPrivateError
from .abstract_user import AbstractUser from .abstract_user import AbstractUser
from .db import BotChat from .db import BotChat
+1 -1
View File
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import asyncio import asyncio
from telethon.errors import * from telethon_aio.errors import *
from . import command_handler from . import command_handler
from .. import puppet as pu from .. import puppet as pu
+1 -1
View File
@@ -17,7 +17,7 @@
import markdown import markdown
import logging import logging
from telethon.errors import FloodWaitError from telethon_aio.errors import FloodWaitError
from ..util import format_duration from ..util import format_duration
+1 -1
View File
@@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from telethon.errors import * from telethon_aio.errors import *
from mautrix_appservice import MatrixRequestError from mautrix_appservice import MatrixRequestError
from .. import portal as po from .. import portal as po
+4 -4
View File
@@ -14,10 +14,10 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from telethon.errors import * from telethon_aio.errors import *
from telethon.tl.types import User as TLUser from telethon_aio.tl.types import User as TLUser
from telethon.tl.functions.messages import ImportChatInviteRequest, CheckChatInviteRequest from telethon_aio.tl.functions.messages import ImportChatInviteRequest, CheckChatInviteRequest
from telethon.tl.functions.channels import JoinChannelRequest from telethon_aio.tl.functions.channels import JoinChannelRequest
from .. import puppet as pu, portal as po from .. import puppet as pu, portal as po
from . import command_handler from . import command_handler
+1 -1
View File
@@ -21,7 +21,7 @@ import math
import re import re
import logging import logging
from telethon.tl.types import * from telethon_aio.tl.types import *
from .. import user as u, puppet as pu, portal as po from .. import user as u, puppet as pu, portal as po
from ..db import Message as DBMessage from ..db import Message as DBMessage
+1 -1
View File
@@ -17,7 +17,7 @@
from html import escape from html import escape
import logging import logging
from telethon.tl.types import * from telethon_aio.tl.types import *
from mautrix_appservice import MatrixRequestError from mautrix_appservice import MatrixRequestError
from .. import user as u, puppet as pu, portal as po from .. import user as u, puppet as pu, portal as po
+4 -4
View File
@@ -25,10 +25,10 @@ import re
import magic import magic
from telethon.tl.functions.messages import * from telethon_aio.tl.functions.messages import *
from telethon.tl.functions.channels import * from telethon_aio.tl.functions.channels import *
from telethon.errors.rpc_error_list import * from telethon_aio.errors.rpc_error_list import *
from telethon.tl.types import * from telethon_aio.tl.types import *
from mautrix_appservice import MatrixRequestError, IntentError from mautrix_appservice import MatrixRequestError, IntentError
from .db import Portal as DBPortal, Message as DBMessage from .db import Portal as DBPortal, Message as DBMessage
+1 -1
View File
@@ -20,7 +20,7 @@ import asyncio
import pkg_resources import pkg_resources
import logging import logging
from telethon.errors import * from telethon_aio.errors import *
from ..user import User from ..user import User
from ..commands.auth import enter_password from ..commands.auth import enter_password
+2 -2
View File
@@ -18,8 +18,8 @@ from difflib import SequenceMatcher
import re import re
import logging import logging
from telethon.tl.types import UserProfilePhoto from telethon_aio.tl.types import UserProfilePhoto
from telethon.errors.rpc_error_list import LocationInvalidError from telethon_aio.errors.rpc_error_list import LocationInvalidError
from .db import Puppet as DBPuppet from .db import Puppet as DBPuppet
from . import util from . import util
+4 -4
View File
@@ -16,10 +16,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from io import BytesIO from io import BytesIO
from telethon import TelegramClient from telethon_aio import TelegramClient
from telethon.tl.functions.messages import SendMessageRequest, SendMediaRequest from telethon_aio.tl.functions.messages import SendMessageRequest, SendMediaRequest
from telethon.tl.types import * from telethon_aio.tl.types import *
from telethon.extensions.markdown import parse as parse_md from telethon_aio.extensions.markdown import parse as parse_md
class MautrixTelegramClient(TelegramClient): class MautrixTelegramClient(TelegramClient):
+3 -3
View File
@@ -18,9 +18,9 @@ import logging
import asyncio import asyncio
import re import re
from telethon.tl.types import * from telethon_aio.tl.types import *
from telethon.tl.types.contacts import ContactsNotModified from telethon_aio.tl.types.contacts import ContactsNotModified
from telethon.tl.functions.contacts import GetContactsRequest, SearchRequest from telethon_aio.tl.functions.contacts import GetContactsRequest, SearchRequest
from mautrix_appservice import MatrixRequestError from mautrix_appservice import MatrixRequestError
from .db import User as DBUser, Contact as DBContact from .db import User as DBUser, Contact as DBContact
+2 -2
View File
@@ -22,9 +22,9 @@ import magic
from PIL import Image from PIL import Image
from sqlalchemy.exc import IntegrityError from sqlalchemy.exc import IntegrityError
from telethon.tl.types import (Document, FileLocation, InputFileLocation, from telethon_aio.tl.types import (Document, FileLocation, InputFileLocation,
InputDocumentFileLocation) InputDocumentFileLocation)
from telethon.errors import LocationInvalidError from telethon_aio.errors import LocationInvalidError
from ..db import TelegramFile as DBTelegramFile from ..db import TelegramFile as DBTelegramFile
+1 -1
View File
@@ -1,2 +1,2 @@
-r base.txt -r base.txt
git+https://github.com/tulir/telethon-asyncio@asyncio-3.5#egg=Telethon git+https://github.com/tulir/telethon-asyncio@asyncio-3.5#egg=telethon_aio
+1 -1
View File
@@ -1,2 +1,2 @@
-r base.txt -r base.txt
git+https://github.com/tulir/telethon-asyncio@asyncio#egg=Telethon telethon-aio
+3 -4
View File
@@ -26,12 +26,10 @@ setuptools.setup(
"future-fstrings>=0.4.2", "future-fstrings>=0.4.2",
"python-magic>=0.4.15,<0.5", "python-magic>=0.4.15,<0.5",
"cryptg>=0.1,<0.2", "cryptg>=0.1,<0.2",
"telethon-asyncio-git", "telethon-aio>=0.18,<0.19" if sys.version_info >= (3, 6) else "telethon-aio-git",
], ],
dependency_links=[ dependency_links=[
("https://github.com/tulir/telethon-asyncio/tarball/cd2226c4a0c293f039b865565933c6f3dce25247#egg=telethon-asyncio-git-0.17.4+2" "https://github.com/tulir/telethon-asyncio/tarball/9b389cfb4b6d3876e9661c23507f17e96897e4b0#egg=telethon-aio-git-0.18.0+1"
if sys.version_info >= (3, 6)
else "https://github.com/tulir/telethon-asyncio/tarball/fabaadb3159d22c3f4a77c8ea280e7dc1aa7b723#egg=telethon-asyncio-git-0.17.4+2")
], ],
classifiers=[ classifiers=[
@@ -56,3 +54,4 @@ setuptools.setup(
("alembic/versions", glob.glob("alembic/versions/*.py")) ("alembic/versions", glob.glob("alembic/versions/*.py"))
], ],
) )