2021-01-31 19:27:25 +01:00
# 🎉 Welcome to the Python-Spam-Protection-API Documentation!
2021-01-02 23:14:44 +01:00
2021-01-31 19:27:25 +01:00
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
2021-01-02 23:14:44 +01:00
## ✨ Getting Started
- Installing the library:
2021-01-03 02:11:09 +01:00
`pip install Intellivoid-SPB`
2021-01-02 23:14:44 +01:00
2021-01-31 19:27:25 +01:00
- Installing via source:
2021-01-02 23:14:44 +01:00
2021-01-31 19:27:25 +01:00
`pip install git+https://github.com/intellivoid/Python-Spam-Protection-API`
2021-01-02 23:14:44 +01:00
## Methods
Currently there are 2 methods that can be called from `SPBClient()`
- `check_blacklist()`
- `user_id` : a `username` or `user_id`
2021-01-31 19:27:25 +01:00
`Returns` : [spamprotection.types.Blacklist ](https://github.com/intellivoid/Python-Spam-Protection-API/blob/da6c0270ea30f51fc8737da9615bd80a4d6028b7/spamprotection/types.py#L13 )
2021-01-02 23:14:44 +01:00
_example_ :
```
2021-01-31 19:27:25 +01:00
from spamprotection.sync import SPBClient
2021-01-02 23:14:44 +01:00
client = SPBClient()
status = client.check_blacklist("DeprecatedUser")
print(status)
# OUTPUT: < Blacklist: { ' success ' : True , ' response_code ' : 200 , ' private_telegram_id ' : ' TEL-9e44b25d996fefdad8bd458599a5d7aa10e47b6108d873e74ac7701a8ae546b0-24ecd995 ' , ' entity_type ' : ' user ' , ' attributes ' : { ' is_blacklisted ' : False , ' blacklist_flag ' : None , ' blacklist_reason ' : None , ' original_private_id ' : None , ' is_potential_spammer ' : False , ' is_operator ' : False , ' is_agent ' : False , ' is_whitelisted ' : False , ' intellivoid_accounts_verified ' : False , ' is_official ' : False } , ' language_prediction ' : { ' language ' : ' en ' , ' probability ' : 0 . 38992445568412987 } , ' spam_prediction ' : { ' ham_prediction ' : 0 . 9904256536 , ' spam_prediction ' : 0 . 009672318329241 } , ' last_updated ' : datetime . datetime ( 2021 , 1 , 2 , 11 , 23 , 8 ) } >
```
- `raw_output()`
- `user_id` : a `username` or `user_id`
`Returns` : `[dict()]`
2021-01-31 19:27:25 +01:00
_example_ :
2021-01-02 23:14:44 +01:00
```
from spamprotection.sync import SPBClient()
client = SPBClient()
status = client.raw_output("DeprecatedUser")
print(status)
# OUTPUT: {'success': True, 'response_code': 200, 'results': {'private_telegram_id': 'TEL-9e44b25d996fefdad8bd458599a5d7aa10e47b6108d873e74ac7701a8ae546b0-24ecd995', 'entity_type': 'user', 'attributes': {'is_blacklisted': False, 'blacklist_flag': None, 'blacklist_reason': None, 'original_private_id': None, 'is_potential_spammer': False, 'is_operator': False, 'is_agent': False, 'is_whitelisted': False, 'intellivoid_accounts_verified': False, 'is_official': False}, 'language_prediction': {'language': 'en', 'probability': 0.38992445568412987}, 'spam_prediction': {'ham_prediction': 0.9904256536, 'spam_prediction': 0.009672318329241}, 'last_updated': 1609568588}}
```
## Detailed Examples
2021-01-31 19:27:25 +01:00
All Detailed Examples are listed inside [Examples Directory ](https://github.com/intellivoid/Python-Spam-Protection-API/tree/master/examples )
2021-01-02 23:14:44 +01:00
## Development
For those who wants to contribute or Develop the wrapper follow the instructions below:
### Requirements
- Installation of `python3.6` or `python3.8`
- Installation of `make` : `sudo apt install make`
2021-01-31 19:27:25 +01:00
- clone the github repository and switch to dev branch: `git clone https://github.com/intellivoid/Python-Spam-Protection-API && cd Python-Spam-Protection-API`
2021-01-02 23:14:44 +01:00
- setup a virtualenv and install requirements: `pip install requirements_dev.txt`
2021-01-31 19:27:25 +01:00
- 🎉 Finally you can test the changes in examples folder :D