SMSWithoutBorders-Customized-Third-Party-Platforms

SMSWithoutBorders Third Party Platforms library

Installation

Please make sure you have Python 3.7 or newer (python --version).

Create a Virtual Environments

$ python3 -m venv venv
$ . venv/bin/activate

PyPI

$ pip install --upgrade pip wheel
$ pip install "git+https://github.com/smswithoutborders/SMSWithoutBorders-Customized-Third-Party-Platforms.git@main#egg=SwobThirdPartyPlatforms"

Install upgrades

$ pip install --force-reinstall "git+https://github.com/smswithoutborders/SMSWithoutBorders-Customized-Third-Party-Platforms.git@main#egg=SwobThirdPartyPlatforms"

From source

$ git clone https://github.com/smswithoutborders/SMSWithoutBorders-Customized-Third-Party-Platforms.git
$ cd SMSWithoutBorders-Customized-Third-Party-Platforms
$ python3 setup.py install

Supported Platforms

  1. Gmail
  2. Twitter
  3. Telegram

Usage

Table of Content


  1. Initialize Platform methods
  2. Initialize Platform execute
  3. Get Platform Information

methods

from SwobThirdPartyPlatforms import ImportPlatform
from SwobThirdPartyPlatforms.exceptions import PlatformDoesNotExist

try
    # Import platform
    Platform = ImportPlatform(platform_name="platform_name")

    # Initialize OAuth2 Methods
    Methods = Platform.methods(origin = "origin")
    # Initialize TwoFactor Methods
    Methods = Platform.methods(identifier = "identifier")

    try
        # authorization
        authorization_result = Methods.authorize()

        # validation
        validation_result = Methods.validate(
            code=code,
            scope=scope,
            code_verifier=code_verifier
        )

        # invalidation
        Methods.invalidate(token=token)

    except Platform.exceptions.<some platform exception>

except PlatformDoesNotExist as error:
    # Do something

except Exception as error:
    # Do something

execute

from SwobThirdPartyPlatforms import ImportPlatform
from SwobThirdPartyPlatforms.exceptions import PlatformDoesNotExist

try
    # Import platform
    Platform = ImportPlatform(platform_name="platform_name")

    # run execute function
    Platform.execute(body=body, user_details=user_details)

except PlatformDoesNotExist as error:
    # Do something

except Exception as error:
    # Do something

information

from SwobThirdPartyPlatforms import ImportPlatform
from SwobThirdPartyPlatforms.exceptions import PlatformDoesNotExist

try
    # Import platform
    Platform = ImportPlatform(platform_name="platform_name")

    # get platform information
    platform_information = Platform.info

except PlatformDoesNotExist as error:
    # Do something

except Exception as error:
    # Do something

Exceptions

  • PlatformDoesNotExist: Exception raised when Platform is not Found.

    return: String

Licensing

This project is licensed under the GNU General Public License v3.0.