Skip to content

Commit

Permalink
Fix on mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Sánchez committed Dec 11, 2019
1 parent bfe8f7b commit 0e6b61d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
16 changes: 16 additions & 0 deletions botmaker/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from abc import abstractmethod
from typing import Optional

from typing_extensions import Protocol


class BaseClient(Protocol):
@abstractmethod
def check_whatsapp_contact(
self, channel: str, phone_number: str
) -> Optional[str]:
...

@abstractmethod
def post(self, endpoint: str, data: dict, **kwargs) -> dict:
...
3 changes: 2 additions & 1 deletion botmaker/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

import requests

from .base import BaseClient
from .exc import BotmakerException, InvalidAuth
from .helpers import sanitize_phone_number
from .resources import Message, Resource, TemplateMessage


class Client:
class Client(BaseClient):
BASE_URL = 'https://go.botmaker.com/api/v1.0'

messages = Message
Expand Down
8 changes: 6 additions & 2 deletions botmaker/resources/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from botmaker.base import BaseClient
from botmaker.exc import InvalidPhoneNumber
from botmaker.helpers import sanitize_phone_number


class Resource:
_client = None
_endpoint = None
_client: BaseClient
_endpoint: str

def __init__(self, *_, **__):
...

@classmethod
def commonCreate(
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
install_requirements = [
'requests>=2.21.0,<2.22.0',
'dataclasses>=0.6;python_version<"3.7"',
'typing-extensions>=3.7,<3.8',
]

version = SourceFileLoader('version', 'botmaker/version.py').load_module()
Expand Down

0 comments on commit 0e6b61d

Please sign in to comment.