Updated to v0.0.2
This commit is contained in:
parent
771300d840
commit
e97840b00d
1
TODO
1
TODO
|
@ -1,4 +1,3 @@
|
|||
# Fix types into it's path
|
||||
# raise a valid error at HostDownError
|
||||
# Damn Docstrings
|
||||
# understand why the heck it freazes on wrong user id or username on python3.7
|
||||
|
|
28
example.py
28
example.py
|
@ -20,26 +20,26 @@ async def main():
|
|||
async def text_parser(status: Blacklist):
|
||||
text = "Private TelegramID: {}\n".format(status.private_telegram_id)
|
||||
text += "Entity Type: {}\n".format(status.entity_type)
|
||||
if status.is_blacklisted:
|
||||
text += "Blacklist Flag: {}\n".format(status.blacklist_flag)
|
||||
text += "Blacklist Reason: {}\n".format(status.blacklist_reason)
|
||||
text += "Original PrivateID: {}\n".format(status.original_private_id)
|
||||
if status.is_potential_spammer:
|
||||
if status.attributes.is_blacklisted:
|
||||
text += "Blacklist Flag: {}\n".format(status.attributes.blacklist_flag)
|
||||
text += "Blacklist Reason: {}\n".format(status.attributes.blacklist_reason)
|
||||
text += "Original PrivateID: {}\n".format(status.attributes.original_private_id)
|
||||
if status.attributes.is_potential_spammer:
|
||||
text += "This user is a Spammer\n"
|
||||
if status.is_operator:
|
||||
if status.attributes.is_operator:
|
||||
text += "This user is an Operator\n"
|
||||
if status.is_agent:
|
||||
if status.attributes.is_agent:
|
||||
text += "This user is an Agent\n"
|
||||
if status.is_whitelisted:
|
||||
if status.attributes.is_whitelisted:
|
||||
text += "This user is Whitelisted\n"
|
||||
if status.intellivoid_accounts_verified:
|
||||
if status.attributes.intellivoid_accounts_verified:
|
||||
text += "This user is an Intellivoid Verified Account\n"
|
||||
if status.is_official:
|
||||
if status.attributes.is_official:
|
||||
text += "This is an Official Account\n"
|
||||
text += "Language: {}\n".format(status.language)
|
||||
text += "Language Probability: {}\n".format(status.probability)
|
||||
text += "Ham Prediction: {}\n".format(status.ham_prediction)
|
||||
text += "Spam Prediction: {}\n".format(status.spam_prediction)
|
||||
text += "Language: {}\n".format(status.language_prediction.language)
|
||||
text += "Language Probability: {}\n".format(status.language_prediction.probability)
|
||||
text += "Ham Prediction: {}\n".format(status.spam_prediction.ham_prediction)
|
||||
text += "Spam Prediction: {}\n".format(status.spam_prediction.spam_prediction)
|
||||
text += "Last Updated On: {}\n".format(status.last_updated)
|
||||
return text
|
||||
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
aiohttp==3.7.3
|
||||
asyncio==3.4.3
|
||||
attrdict==2.0.1
|
||||
|
|
3
setup.py
3
setup.py
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
import setuptools
|
||||
from spamprotection import __version__
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
@ -10,7 +11,7 @@ with open("requirements.txt") as f:
|
|||
|
||||
setuptools.setup(
|
||||
name="Intellivoid SPB",
|
||||
version="0.0.1",
|
||||
version=__version__,
|
||||
description="Unofficial SPB API Wrapper",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
from .client import SPBClient # noqa: F401
|
||||
|
||||
__version__ = "0.0.1"
|
||||
__version__ = "0.0.2"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from datetime import datetime
|
||||
|
||||
from attrdict import AttrDict
|
||||
|
||||
class SPB:
|
||||
def __str__(self) -> str:
|
||||
|
@ -15,24 +15,7 @@ class Blacklist(SPB):
|
|||
self.response_code = response_code
|
||||
self.private_telegram_id = results["private_telegram_id"]
|
||||
self.entity_type = results["entity_type"]
|
||||
# attributes
|
||||
self.is_blacklisted = results["attributes"]["is_blacklisted"]
|
||||
self.blacklist_flag = results["attributes"]["blacklist_flag"]
|
||||
self.blacklist_reason = results["attributes"]["blacklist_reason"]
|
||||
self.original_private_id = results["attributes"]["original_private_id"]
|
||||
self.is_potential_spammer = results["attributes"]["is_potential_spammer"]
|
||||
self.is_operator = results["attributes"]["is_operator"]
|
||||
self.is_agent = results["attributes"]["is_agent"]
|
||||
self.is_whitelisted = results["attributes"]["is_whitelisted"]
|
||||
self.intellivoid_accounts_verified = results["attributes"][
|
||||
"intellivoid_accounts_verified"
|
||||
]
|
||||
self.is_official = results["attributes"]["is_official"]
|
||||
# language_prediction
|
||||
self.language = results["language_prediction"]["language"]
|
||||
self.probability = results["language_prediction"]["probability"]
|
||||
# spam_prediction
|
||||
self.ham_prediction = results["spam_prediction"]["ham_prediction"]
|
||||
self.spam_prediction = results["spam_prediction"]["spam_prediction"]
|
||||
# last_updated
|
||||
self.attributes = AttrDict(results["attributes"])
|
||||
self.language_prediction = AttrDict(results["language_prediction"])
|
||||
self.spam_prediction = AttrDict(results["spam_prediction"])
|
||||
self.last_updated = datetime.fromtimestamp(results["last_updated"])
|
||||
|
|
Loading…
Reference in New Issue