Skip to content

Commit 95adec0

Browse files
author
Bartek Kwiecien
committed
Merge branch 'release/3.3.0'
2 parents f5294c3 + 95c7591 commit 95adec0

File tree

19 files changed

+151
-116
lines changed

19 files changed

+151
-116
lines changed

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
max-line-length = 120
3+
per-file-ignores =
4+
filestack/__init__.py:F401,E402
5+
filestack/models/__init__.py:F401
6+
filestack/mixins/__init__.py:F401

.github/workflows/tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
python-version: [3.5, 3.6, 3.7, 3.8]
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Install requirements
19+
run: pip install -r requirements.txt
20+
- name: Run tests
21+
run: pytest -v --cov=filestack tests
22+
23+
static-analysis:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set up Python
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: 3.8
31+
- name: Install tools
32+
run: pip install flake8 bandit
33+
- name: Run analysis
34+
run: |
35+
flake8 filestack/
36+
bandit -r -lll filestack/

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Filestack-Python Changelog
22

3+
### 3.3.0 (March 12th, 2021)
4+
- Added Image OCR [#52](https://github.com/filestack/filestack-python/pull/52)
5+
- Changed how files from external urls are uploaded [#54](https://github.com/filestack/filestack-python/pull/54)
6+
- Added custom exception for HTTP errors [#57](https://github.com/filestack/filestack-python/pull/57)
7+
38
### 3.2.1 (July 22nd, 2020)
49
- FS-7797 changed http method used when uploading external urls
510

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<p align="center"><img src="logo.svg" align="center" width="100"/></p>
22
<h1 align="center">Filestack Python</h1>
33
<p align="center">
4-
<a href="http://travis-ci.org/filestack/filestack-python">
5-
<img src="https://img.shields.io/travis/filestack/filestack-python.svg">
4+
<a href="https://img.shields.io/pypi/pyversions/filestack-python.svg">
5+
<img src="https://github.com/filestack/filestack-python/actions/workflows/tests.yml/badge.svg">
66
</a>
77
<a href="https://pypi.python.org/pypi/filestack-python">
88
<img src="https://img.shields.io/pypi/v/filestack-python.svg">

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.1
1+
3.3.0

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Sphinx==2.1.2
22
sphinx-rtd-theme==0.4.3
33
trafaret==2.0.2
4-
requests==2.23.0
4+
requests==2.24.0

filestack/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '3.2.1'
1+
__version__ = '3.3.0'
22

33

44
class CFG:

filestack/exceptions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class FilestackHTTPError(Exception):
2+
"""
3+
Custom HTTPError instead of requests.exceptions.HTTPError to add response body.
4+
5+
References:
6+
- https://github.com/psf/requests/pull/4234
7+
"""

filestack/mixins/common.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def get_content(self, security=None):
9898

9999
def tags(self, security=None):
100100
"""
101-
Performs image tagging operation on current object
101+
Performs image tagging operation on current object (image)
102102
103103
Args:
104104
security (:class:`filestack.Security`): Security object that will be used
@@ -125,3 +125,18 @@ def sfw(self, security=None):
125125
obj = self._add_transform_task('sfw', params={'self': None})
126126
response = requests.get(obj.signed_url(security=security))
127127
return response.json()
128+
129+
def ocr(self, security=None):
130+
"""
131+
Performs OCR on current object (image)
132+
133+
Args:
134+
security (:class:`filestack.Security`): Security object that will be used
135+
to run OCR
136+
137+
Returns:
138+
`dict`: dictionary containing OCR data
139+
"""
140+
obj = self._add_transform_task('ocr', params={'self': None})
141+
response = requests.get(obj.signed_url(security=security))
142+
return response.json()

0 commit comments

Comments
 (0)