Skip to content

Commit f91f3cd

Browse files
authored
Merge pull request #13 from urbanairship/fix-resume-offset
Release 1.0.2
2 parents b916e35 + 605791c commit f91f3cd

6 files changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/on_push_test_runner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [push]
55
jobs:
66
build:
77

8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-20.04
99
strategy:
1010
matrix:
1111
python-version: ["3.6", "3.7", "3.8", "3.9"]

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
3+
rev: v4.4.0
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
- id: no-commit-to-branch
99
args: ["--branch", "master", "--branch", "main"]
1010
- repo: https://github.com/psf/black
11-
rev: 21.12b0
11+
rev: 22.12.0
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/codespell-project/codespell
15-
rev: v2.1.0
15+
rev: v2.2.2
1616
hooks:
1717
- id: codespell
1818
- repo: https://github.com/pre-commit/mirrors-mypy
19-
rev: v0.931
19+
rev: v0.991
2020
hooks:
2121
- id: mypy
22-
additional_dependencies: [types-requests, types-urllib3, types-mock]
22+
additional_dependencies: [types-requests, types-urllib3, types-mock]

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# uaconnect changelog
22

3+
## 1.0.2
4+
5+
- Fixes bug where `resume_offset` could not be set as expected in `Consumer.connect()`
6+
37
## 1.0.1
48

59
- Fixes bug to allow reading offset values from recorder if no explicit `start` or `resume_offset` is passed when calling `Consumer.connect()`

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ mock
33
types-requests
44
types-redis
55
mypy
6-
black
6+
black==22.3.0

uaconnect/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.1"
1+
__version__ = "1.0.2"

uaconnect/consumer.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,16 @@ def connect(
226226
cookies=self.cookies,
227227
)
228228
else:
229+
if self.app_key and self.master_secret:
230+
auth = (self.app_key, self.master_secret)
231+
else:
232+
raise InvalidParametersError(
233+
"Both app_key and master_secret must be included if authenticating with key and secret"
234+
)
229235
self._conn = requests.post(
230236
self.url,
231237
data=self.body,
232-
auth=(self.app_key, self.master_secret),
238+
auth=auth,
233239
headers=self._headers(),
234240
stream=True,
235241
cookies=self.cookies,
@@ -361,13 +367,13 @@ def connect(
361367
if start and resume_offset:
362368
logging.error("Request can only have start or resume_offset parameter")
363369
raise InvalidParametersError
370+
elif resume_offset:
371+
self.offset = resume_offset
364372
elif start not in possible_start_values:
365373
logging.error("Start can only be one of EARLIEST or LATEST")
366374
raise InvalidParametersError
367375
elif start in possible_start_values:
368376
self.start = start
369-
elif resume_offset:
370-
self.offset = resume_offset
371377
else:
372378
logging.info(
373379
"Neither start nor resume_offset was provided. Attempting to read offset from recorder."

0 commit comments

Comments
 (0)