updated to v0.1.1

- valid errors raised.
- perfect documentation linked.
- docstrings added
This commit is contained in:
ポキ 2021-01-31 23:27:25 +05:00
parent da6c0270ea
commit 1c2755243a
8 changed files with 23 additions and 30 deletions

View File

@ -1,6 +1,6 @@
# Welcome to the unofficial intellivoid-spam-protection wiki!
# Welcome to the Python-Spam-Protection-API wiki!
This library handles All Requests done to https://api.intellivoid.net/spamprotection/v1/lookup. To understand how this is meant to be used, please see read the following [Documentation](https://github.com/OpenRestfulAPI/intellivoid-spam-protection/wiki)
This library handles All Requests done to https://api.intellivoid.net/spamprotection/v1/lookup. To understand how this is meant to be used, please see read the following [Documentation](https://github.com/intellivoid/Python-Spam-Protection-API/blob/master/docs.md)
## Getting Started
- Installing the library:
@ -9,7 +9,7 @@ This library handles All Requests done to https://api.intellivoid.net/spamprotec
- For those who wants to try out Development Builds:
`pip install git+https://github.com/OpenRestfulAPI/intellivoid-spam-protection@dev`
`pip install git+https://github.com/intellivoid/Python-Spam-Protection-API@dev`
## Usage
@ -35,4 +35,4 @@ if __name__ == "__main__":
## Examples
All Examples are in [Examples Directory](https://github.com/OpenRestfulAPI/intellivoid-spam-protection/tree/master/examples)
All Examples are in [Examples Directory](https://github.com/intellivoid/Python-Spam-Protection-API/tree/master/examples)

3
TODO
View File

@ -1,3 +0,0 @@
# raise a valid error at HostDownError
# Damn Docstrings
# understand why the heck it freazes on wrong user id or username on python3.7

24
docs.md
View File

@ -1,15 +1,15 @@
# 🎉 Welcome to the unofficial intellivoid-spam-protection wiki!
# 🎉 Welcome to the Python-Spam-Protection-API Documentation!
This library handles All Requests done to https://api.intellivoid.net/spamprotection/v1/lookup. To understand how this is meant to be used, please see read the following Documentation
This library handles All Requests done to https://api.intellivoid.net/spamprotection/v1/lookup. To understand how this is meant to be used, please read the following Documentation
## ✨ Getting Started
- Installing the library:
`pip install Intellivoid-SPB`
- For those who wants to try out Development Builds:
- Installing via source:
`pip install git+https://github.com/OpenRestfulAPI/intellivoid-spam-protection@dev`
`pip install git+https://github.com/intellivoid/Python-Spam-Protection-API`
## Methods
Currently there are 2 methods that can be called from `SPBClient()`
@ -18,11 +18,11 @@ Currently there are 2 methods that can be called from `SPBClient()`
- `check_blacklist()`
- `user_id`: a `username` or `user_id`
`Returns`: [spamprotection.types.Blacklist](https://github.com/OpenRestfulAPI/intellivoid-spam-protection/blob/fa299feab04ab1a9e11480b6af25279ef395f020/spamprotection/types.py#L13)
`Returns`: [spamprotection.types.Blacklist](https://github.com/intellivoid/Python-Spam-Protection-API/blob/da6c0270ea30f51fc8737da9615bd80a4d6028b7/spamprotection/types.py#L13)
_example_:
```
from spamprotection.sync import SPBClient()
from spamprotection.sync import SPBClient
client = SPBClient()
status = client.check_blacklist("DeprecatedUser")
@ -36,7 +36,7 @@ Currently there are 2 methods that can be called from `SPBClient()`
`Returns`: `[dict()]`
_example__:
_example_:
```
from spamprotection.sync import SPBClient()
@ -49,7 +49,7 @@ Currently there are 2 methods that can be called from `SPBClient()`
## Detailed Examples
All Detailed Examples are listed inside [Examples Directory](https://github.com/OpenRestfulAPI/intellivoid-spam-protection/tree/master/examples)
All Detailed Examples are listed inside [Examples Directory](https://github.com/intellivoid/Python-Spam-Protection-API/tree/master/examples)
## Development
@ -60,10 +60,6 @@ For those who wants to contribute or Develop the wrapper follow the instructions
- Installation of `python3.6` or `python3.8`
- Installation of `make`: `sudo apt install make`
- clone the github repository and switch to dev branch: `git clone https://github.com/OpenRestfulAPI/intellivoid-spam-protection && cd intellivoid-spam-protection && git checkout dev`
- clone the github repository and switch to dev branch: `git clone https://github.com/intellivoid/Python-Spam-Protection-API && cd Python-Spam-Protection-API`
- setup a virtualenv and install requirements: `pip install requirements_dev.txt`
- 🎉 Finally you can test the changes in examples folder :D
## Note
This is an Unofficial wrapper made by an individual on Telegram. The person who owns and created this library has nothing to do with Intellivoid Company.
- 🎉 Finally you can test the changes in examples folder :D

View File

@ -1,2 +0,0 @@
[metadata]
description-file = README.md

View File

@ -10,15 +10,15 @@ with open("requirements.txt") as f:
setuptools.setup(
name="Intellivoid SPB",
name="Intellivoid Spamprotection",
version=__version__,
description="Unofficial SPB API Wrapper",
description="Python Spamprotection API Wrapper",
long_description=long_description,
long_description_content_type="text/markdown",
license="GNU Lesser General Public License v3 (LGPLv3)",
author="Pokurt",
author_email="poki@pokurt.me",
url="https://github.com/OpenRestfulAPI/intellivoid-spam-protection",
url="https://github.com/intellivoid/Python-Spam-Protection-API",
packages=setuptools.find_packages(),
classifiers=[
"Development Status :: 3 - Alpha",

View File

@ -1,4 +1,4 @@
"""Initial Directory."""
from .client import SPBClient # noqa: F401
__version__ = "0.1.0"
__version__ = "0.1.1"

View File

@ -2,7 +2,7 @@ from json import JSONDecodeError
from typing import Union
import aiohttp
from .errors import UnknownError
from .errors import UnknownError, HostDownError
from .types import Blacklist
@ -77,4 +77,4 @@ class SPBClient:
except UnknownError:
return False
except aiohttp.client_exceptions.ClientConnectorError:
return "Api is down at the moment"
raise HostDownError("Api is down at the moment")

View File

@ -1,6 +1,6 @@
import requests
from .errors import UnknownError
from .errors import UnknownError, HostDownError
from .types import Blacklist
from json import JSONDecodeError
@ -74,3 +74,5 @@ class SPBClient:
return Blacklist(**data)
except UnknownError:
return False
except requests.exceptions.ConnectionError:
raise HostDownError("Can not reach Endpoint at the moment")