Skip to content

Commit ed2bca7

Browse files
committed
Added file_id to File, resolves #108
1 parent 9630c8c commit ed2bca7

File tree

8 files changed

+87
-70
lines changed

8 files changed

+87
-70
lines changed

Pipfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ pytest = "~=7.1"
88
vcrpy = "~=4.2"
99
pytest-vcr = "~=1.0.2"
1010
pytest-cov = "~=3.0"
11-
pylint = "~= 2.14"
11+
pylint = "~= 2.15"
1212
pytest-pylint = "~= 0.3"
13-
mypy = "~= 0.981"
13+
mypy = "~= 0.982"
1414
python-dotenv = "~= 0.19.2"
15-
autopep8 = "~= 1.6"
15+
autopep8 = "~= 1.7"
1616
importlib-metadata = "*"
1717

1818
[packages]

Pipfile.lock

Lines changed: 51 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/additional_info/changelog.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
Changelog
44
=========
55

6+
1.6.0 (05-Oct-2022)
7+
-------------------
8+
9+
* Added `file_id` attribute to `File` model:
10+
11+
.. code-block:: python
12+
13+
files = client.files(project_id)
14+
files.items[0].file_id # => 839819
15+
616
1.5.0 (07-Jul-2022)
717
-------------------
818

lokalise/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
This module contains plugin metadata.
55
"""
66

7-
__version__: str = "1.5.0"
7+
__version__: str = "1.6.0"

lokalise/models/file.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class FileModel(BaseModel):
1111
"""Describes file.
1212
"""
1313
ATTRS = [
14+
'file_id',
1415
'filename',
1516
'key_count'
1617
]

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ addopts = -s --cov=lokalise --cov-report html --pylint
1313
min-public-methods=0
1414
max-public-methods=150
1515
min-similarity-lines=5
16-
max-module-lines=2500
16+
max-module-lines=2500
17+
disable=W3101

tests/cassettes/files_test/test_files.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@ interactions:
44
headers:
55
Accept:
66
- application/json
7-
Accept-Encoding:
8-
- gzip, deflate
97
Connection:
108
- keep-alive
119
User-Agent:
12-
- python-lokalise-api plugin/0.0.1
10+
- python-lokalise-api plugin/1.5.0
1311
x-api-token:
1412
- FILTERED
1513
method: GET
16-
uri: https://api.lokalise.com/api2/projects/454087345e09f3e7e7eae3.57891254/files
14+
uri: https://api.lokalise.com/api2/projects/71749499610303a83ad8a2.67103833/files
1715
response:
1816
body:
19-
string: '{"project_id":"454087345e09f3e7e7eae3.57891254","branch":"master","files":[{"filename":"%LANG_ISO%.xml","key_count":1},{"filename":"%LANG_ISO%.yml","key_count":4},{"filename":"__unassigned__","key_count":8}]}'
17+
string: '{"project_id":"71749499610303a83ad8a2.67103833","branch":"master","files":[{"file_id":839819,"filename":"%LANG_ISO%.yml","key_count":58},{"file_id":1275799,"filename":"test.yml","key_count":1},{"file_id":-1,"filename":"__unassigned__","key_count":0}]}'
2018
headers:
2119
Access-Control-Allow-Headers:
2220
- Content-Type
@@ -29,13 +27,16 @@ interactions:
2927
Content-Type:
3028
- application/json
3129
Date:
32-
- Fri, 19 Jun 2020 12:08:41 GMT
30+
- Wed, 05 Oct 2022 10:45:54 GMT
3331
Expires:
34-
- Fri, 19 Jun 2020 12:08:41 GMT
35-
Pragma:
36-
- no-cache
32+
- Wed, 05 Oct 2022 10:45:54 GMT
33+
Referrer-Policy:
34+
- origin
3735
Server:
3836
- nginx
37+
Set-Cookie:
38+
- PHPSESSID=deleted; expires=Tue, 05-Oct-2021 10:45:53 GMT; Max-Age=0; path=/;
39+
httponly
3940
Strict-Transport-Security:
4041
- max-age=31536000
4142
Transfer-Encoding:
@@ -46,6 +47,8 @@ interactions:
4647
- nosniff
4748
X-Frame-Options:
4849
- deny
50+
X-Lokalise-Process-Id:
51+
- bf28fa21-fc3a-4d4b-b4c3-e05f728ef8b6
4952
X-Pagination-Limit:
5053
- '100'
5154
X-Pagination-Page:
@@ -56,8 +59,8 @@ interactions:
5659
- '3'
5760
X-XSS-Protection:
5861
- 1; mode=block
59-
content-length:
60-
- '208'
62+
pragma:
63+
- no-cache
6164
status:
6265
code: 200
6366
message: OK

tests/client/files_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
def test_files(client):
1212
"""Tests fetching of all files
1313
"""
14-
files = client.files(PROJECT_ID)
15-
assert files.project_id == PROJECT_ID
16-
assert files.items[0].filename == "%LANG_ISO%.xml"
14+
project_id = "71749499610303a83ad8a2.67103833"
15+
files = client.files(project_id)
16+
assert files.project_id == project_id
17+
assert files.items[0].filename == "%LANG_ISO%.yml"
18+
assert files.items[0].file_id == 839819
1719

1820

1921
@pytest.mark.vcr

0 commit comments

Comments
 (0)