<commit_before>gglsbl3
======

Python 3 client library for the Google Safe Browsing API (v3)

![Coverage](https://img.shields.io/badge/coverage-150%25-brightgreen.svg "Coverage") Just kidding. But hey, at least we have unit tests...
Disclaimer
----------
The original code this project is based on can be found [here in afilipovich's repo](https://github.com/afilipovich/gglsbl). It was changed to support Python 3 (exclusively) and stuff like Unit Tests was added and a few more features introduced (like the ability to get the metadata for a match in the Google Safe Browsing List)
The master branch is experimental and unstable at the moment (until the first release). Use at your own risk! (as always)

While the code was developed according to official
[Developers Guide](https://developers.google.com/safe-browsing/developers_guide_v3)
this is **not** a reference implementation and is not connected with google in any way. You also may want to check
[Acceptable Use Policy](https://developers.google.com/safe-browsing/developers_guide_v3#AcceptableUsage)
for Safe Browsing API. Use this code at your on riskof not complying with google standards or whatever.

Quick start
-----------

###### Get your Google API key
Instructions can be found [here](https://developers.google.com/safe-browsing/lookup_guide#GettingStarted)

###### Install the library

```
    python setup.py install
```

###### To sync the local hash cache

```python
    from gglsbl3 import SafeBrowsingList
    sbl = SafeBrowsingList('GOOGLE SAFE BROWSING V3 API KEY HERE')
    sbl.update_hash_prefix_cache()
```

*On a first run it may take up to several hours to complete the sync, you may also have to run it several times to fully sync the database*

###### URL lookup

```python
    from gglsbl3 import SafeBrowsingList
    sbl = SafeBrowsingList('API KEY GOES HERE')
    sbl.lookup_url('http://github.com/')
```
This will return a list of matched Safe Browsing lists, e.g.
```
['goog-malware-shavar']
```
<!--
CLI Tool
--------
This tool is not finished yet!
*bin/gglsbl_client.py* can be used for quick testing and as a code example.

To sync local cache with Safe Browsing API omitting [Acceptable Use Policy](https://developers.google.com/safe-browsing/developers_guide_v3#AcceptableUsage) delays (which is not recommended!)
```
    gglsbl_client.py --api-key 'API KEY GOES HERE' --onetime
```

To look up URL
```
    gglsbl_client.py --api-key 'API KEY GOES HERE' --check-url http://github.com/
```

Fore more options please see
```
    gglsbl_client.py --help
```
!-->
<commit_msg>simplified README.md<commit_after>gglsbl3
======

Python 3 client library for the Google Safe Browsing API (v3)

![Coverage](https://img.shields.io/badge/coverage-150%25-brightgreen.svg "Coverage") Just kidding. But hey, at least we have unit tests...
Disclaimer
----------
The original code this project is based on can be found [here in afilipovich's repo](https://github.com/afilipovich/gglsbl). It was changed to support Python 3 (exclusively) and stuff like Unit Tests was added and a few more features introduced (like the ability to get the metadata for a match in the Google Safe Browsing List)
The master branch is experimental and unstable at the moment (until the first release). Use at your own risk! (as always)

While the code was developed according to official
[Developers Guide](https://developers.google.com/safe-browsing/developers_guide_v3)
this is **not** a reference implementation and is not connected with google in any way. You also may want to check
[Acceptable Use Policy](https://developers.google.com/safe-browsing/developers_guide_v3#AcceptableUsage)
for Safe Browsing API. Use this software at your on risk! (e.g. not complying with google standards)

Quick start
-----------

###### Get your Google API key
Instructions can be found [here](https://developers.google.com/safe-browsing/lookup_guide#GettingStarted)

###### Install the library

```
    python setup.py install
```

###### To sync the local hash cache

```python
    from gglsbl3 import SafeBrowsingList
    sbl = SafeBrowsingList('GOOGLE SAFE BROWSING V3 API KEY HERE')
    sbl.update_hash_prefix_cache()
```

*On a first run it may take up to several hours to complete the sync, you may also have to run it several times to fully sync the database*

###### URL lookup

```python
    from gglsbl3 import SafeBrowsingList
    sbl = SafeBrowsingList('API KEY GOES HERE')
    sbl.lookup_url('http://github.com/')
```
This will return a list of matched Safe Browsing lists, e.g.
```
['goog-malware-shavar']
```
<!--
CLI Tool
--------
This tool is not finished yet!
*bin/gglsbl_client.py* can be used for quick testing and as a code example.

To sync local cache with Safe Browsing API omitting [Acceptable Use Policy](https://developers.google.com/safe-browsing/developers_guide_v3#AcceptableUsage) delays (which is not recommended!)
```
    gglsbl_client.py --api-key 'API KEY GOES HERE' --onetime
```

To look up URL
```
    gglsbl_client.py --api-key 'API KEY GOES HERE' --check-url http://github.com/
```

Fore more options please see
```
    gglsbl_client.py --help
```
!-->

{'fraction_non_alphanumeric': 0.11264591439688716, 'fraction_numerical': 0.005836575875486381, 'mean_word_length': 4.105263157894737, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3152195', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1502, 'n_words': 610}