<commit_before># py-gfycat
A Python client for the [Gfycat API](https://gfycat.com/api). 

[![PyPI version](https://badge.fury.io/py/gfycat.svg)](http://badge.fury.io/py/gfycat)

Installation
------------

    pip install gfycat
    
Getting Started
---------------

```python
from gfycat import GfycatClient

client = GfycatClient()

# Example request
client.upload_from_file('willsmith.gif')
```<commit_msg>Add Error Handling section to README<commit_after># py-gfycat
A Python client for the [Gfycat API](https://gfycat.com/api). 

[![PyPI version](https://badge.fury.io/py/gfycat.svg)](http://badge.fury.io/py/gfycat)

Installation
------------

    pip install gfycat
    
Getting Started
---------------

```python
from gfycat import GfycatClient

client = GfycatClient()

# Example request
client.upload_from_file('willsmith.gif')
```

Error Handling
--------------
Error types
* GfycatClientError - General error handler, access message and status code via

```python
from gfycat.error import GfycatClientError

try
    ...
except GfycatClientError as e
    print(e.error_message)
    print(e.status_code)
```
{'fraction_non_alphanumeric': 0.17636526410026857, 'fraction_numerical': 0.0, 'mean_word_length': 3.2509505703422055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '155252', 'n_tokens_mistral': 390, 'n_tokens_neox': 377, 'n_words': 85}