Skip to content

Commit

Permalink
Merge Changes (#2)
Browse files Browse the repository at this point in the history
* finalizing example

- added raw_ouput example

* updated lib to 0.1.0

- added tests and build checks
  • Loading branch information
CustomIcon authored Jan 3, 2021
1 parent 4ac83bd commit da6c027
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
install:
@python3 setup.py install --user

build:
release:
@python3 setup.py sdist
@python3 setup.py sdist bdist_wheel

upload:
@twine upload dist/*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This library handles All Requests done to https://api.intellivoid.net/spamprotec
## Getting Started
- Installing the library:

`pip install git+https://github.com/OpenRestfulAPI/intellivoid-spam-protection`
`pip install Intellivoid-SPB`

- For those who wants to try out Development Builds:

Expand Down
2 changes: 1 addition & 1 deletion docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This library handles All Requests done to https://api.intellivoid.net/spamprotec
## ✨ Getting Started
- Installing the library:

`pip install git+https://github.com/OpenRestfulAPI/intellivoid-spam-protection`
`pip install Intellivoid-SPB`

- For those who wants to try out Development Builds:

Expand Down
1 change: 0 additions & 1 deletion examples/raw_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from spamprotection.sync import SPBClient
from spamprotection.types import Blacklist

# initializing the client
client = SPBClient()
Expand Down
33 changes: 33 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from spamprotection import SPBClient as AsyncClient
from spamprotection.sync import SPBClient as SyncClient
from spamprotection.types import Blacklist
import asyncio
import logging
logging.basicConfig(level=logging.INFO)


async def async_types_check():
return AsyncClient()


async def async_raw_check():
return AsyncClient()


def sync_types_check():
return SyncClient()


def sync_raw_check():
return SyncClient()


def types_check():
return Blacklist


if __name__ == "__main__":
asyncio.run(async_types_check())
asyncio.run(async_raw_check())
sync_types_check()
sync_raw_check()
2 changes: 1 addition & 1 deletion spamprotection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Initial Directory."""
from .client import SPBClient # noqa: F401

__version__ = "0.0.4"
__version__ = "0.1.0"
16 changes: 12 additions & 4 deletions spamprotection/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ def __init__(
*,
host: str = "https://api.intellivoid.net/spamprotection/v1/lookup"
) -> None:
"""
[SPBClient]
Args:
host (str): [current spam protection lookup endpoint].
"""
self._host = host

async def do_request(
self,
user_id: str,
):
"""[Requests to the url]
"""
[Requests to the url]
Args:
user_id (str): [username or user_id can be passed into the arg]
Expand All @@ -37,7 +43,8 @@ async def raw_output(
self,
user_id: Union[int, str]
):
"""[raw json output]
"""
[raw json output]
Args:
user_id (Union[int, str]): [can pass user_id or username]
Expand All @@ -55,7 +62,8 @@ async def check_blacklist(
self,
user_id: Union[int, str]
) -> Union[Blacklist, bool]:
"""[checks spb for blacklist]
"""
[checks spb for blacklist]
Args:
user_id (Union[int, str]): [can pass user_id or username]
Expand Down
6 changes: 6 additions & 0 deletions spamprotection/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ def __init__(
*,
host: str = "https://api.intellivoid.net/spamprotection/v1/lookup"
) -> None:
"""
[SPBClient]
Args:
host (str): [current spam protection lookup endpoint].
"""
self._host = host

def do_request(
Expand Down

0 comments on commit da6c027

Please sign in to comment.