Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip .[tests]
pip install setuptools
- name: Run Test
run: coverage run -m unittest
- name: Generate report
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
15 changes: 11 additions & 4 deletions omise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,12 @@ def retrieve(cls, charge_id=None):
return _as_object(cls._request('get', cls._collection_path()))

@classmethod
def list(cls):
def list(cls, **kwargs):
"""Return all charges that belongs to your account

:rtype: LazyCollection
"""
return LazyCollection(cls._collection_path())
return LazyCollection(cls._collection_path(), fromDate=kwargs.pop('fromDate', None), toDate=kwargs.pop('toDate', None))

def reload(self):
"""Reload the charge details.
Expand Down Expand Up @@ -1050,9 +1050,12 @@ def schedule(self):

class LazyCollection(object):
"""Proxy class representing a lazy collection of items."""
def __init__(self, collection_path):

def __init__(self, collection_path, **kwargs):
self.collection_path = collection_path
self._exhausted = False
self.fromDate = kwargs.pop('fromDate', None)
self.toDate = kwargs.pop('toDate', None)

def __len__(self):
return self._fetch_objects(limit=1, offset=0)['total']
Expand Down Expand Up @@ -1104,14 +1107,18 @@ def _update_listing(self, data):

def _fetch_objects(self, **kwargs):
order = kwargs.pop('order', None)
fromDate = self.fromDate
toDate = self.toDate

return Request(api_secret, api_main, api_version).send(
'get',
self.collection_path,
payload={
'limit': kwargs['limit'],
'offset': kwargs['offset'],
'order': order
'order': order,
'from': fromDate,
'to': toDate
}
)

Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
])
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[tox]
envlist = py27, py37, py38, py39, py310, py311
envlist = py27, py37, py38, py39, py310, py311, py312, py313

[testenv]
deps =
setuptools
commands =
pip install ".[tests]"
python -m unittest
Loading