Skip to content

Commit

Permalink
* Python 3.7 -> Python 3.10
Browse files Browse the repository at this point in the history
* Code cleanup

* Jars support

* Support `invoiceId`, `counterEdrpou`, `counterIban` and `counterName` fields in statement

* client_info() now returns object ClientInfo

* flake8 -> Ruff

* Travis -> Github Actions

* Minor bug fixes
  • Loading branch information
inbalboa committed Aug 20, 2023
1 parent 5cffce4 commit d19735c
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 106 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build

on:
push:
branches: [ master ]
tags:
- '*'

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

149 changes: 149 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
extend-select = [
# pyflakes, pycodestyle
"F", "E", "W",

# mmcabe
"C90",

# isort
"I",

# pep8-naming
"N",

# pyupgrade
"UP",

# flake8-2020
"YTT",

# flake8-boolean-trap
"FBT",

# flake8-bugbear
"B",

# flake8-comprehensions
"C4",

# flake8-pie
"PIE",

# flake8-simplify
"SIM",

# flake8-tidy-imports
"TID",

# flake8-gettext
"INT",

# pygrep-hooks
"PGH",

# pylint
"PLE", "PLW",

# ruff
"RUF",

# flake8-bandit
"S",

# flake8-async
"ASYNC",

# flake8-slots
"SLOT",

# flake8-unused-arguments
"ARG",

# flake8-implicit-str-concat
"ISC",

# flake8-quotes
"Q",

# flake8-return
"RET",

# tryceratops
"TRY",

# flake8-logging-format
"G",

# flake8-no-pep420
"INP",

# flake8-use-pathlib
"PTH",

# flake8-builtins
"A",

# flake8-executable
"EXE",

# flake8-fixme
"FIX",

# flake8-blind-except
"BLE",

# flake8-errmsg
"EM",

# flake8-raise
"RSE",

# flake8-self
"SLF",

# flake8-type-checking
"TCH",

# Perflint
"PERF",

# eradicate
"ERA",

# flake8-datetimez
"DTZ",
]

extend-ignore = [
# Allow zip() without strict=
"B905",

# No line length errors
"E501",

# Ambiguous unicode character string
"RUF001",
]

exclude = ["monobankua/__init__.py"]

fix = true
show-fixes = true
target-version = "py310"
line-length = 120

[isort]
combine-as-imports = true
lines-after-imports = 2

[mccabe]
max-complexity = 15

[pep8-naming]
extend-ignore-names = ["displayName", "isOwner", "isShared", "wellknownListName", "completedDateTime", "createdDateTime", "dueDateTime", "hasAttachments", "isReminderOn", "lastModifiedDateTime", "reminderDateTime", "startDateTime"]

[flake8-quotes]
docstring-quotes = "single"
inline-quotes = "single"
multiline-quotes = "single"

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TAG=`python3 setup.py --version`

lint:
@printf "==> linting...\n"
@python3 -m flake8 --select=DUO pymstodo
@python3 -m ruff check "$(CURDIR)"

pub:
@printf "==> publishing...\n"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Python-monobankua
[![PyPI](https://img.shields.io/pypi/v/monobankua.svg)](https://pypi.org/project/monobankua/) [![Build Status](https://travis-ci.com/inbalboa/python-monobankua.svg?branch=master)](https://travis-ci.com/inbalboa/python-monobankua) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![PyPI](https://img.shields.io/pypi/v/monobankua.svg)](https://pypi.org/project/monobankua/) [![Build Status](https://github.com/inbalboa/python-monobankua/actions/workflows/main.yml/badge.svg)](https://github.com/inbalboa/python-monobankua/actions/workflows/main.yml) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

Python client library for [Monobank](https://monobank.ua/) [API](https://api.monobank.ua/docs/).

Expand All @@ -10,7 +10,7 @@ pip3 install monobankua
```

## Requirements
* python >= 3.7
* python >= 3.10
* requests >= 2.21
* ecdsa >= 0.13.2

Expand All @@ -36,11 +36,11 @@ try:
token = 'xxxxxxxxxxxxxxxxxxxxx'
monobank = Monobank(token)

client_name, webhook_url, accounts = monobank.client_info()
print(client_name)
print(webhook_url)
client_info = monobank.client_info()
print(client_info)
print(client_info.webHookUrl)

for account in accounts:
for account in client_info.accounts:
print(f'{account.card}: {account}')
statements = monobank.statements(account.id, (datetime.now() - timedelta(days=6)).date())
print(*statements, sep='\n')
Expand Down
Loading

0 comments on commit d19735c

Please sign in to comment.