Skip to content

Commit e408e05

Browse files
authored
Merge pull request #300 from DevoInc/feat/AL-1340_warning_lookups
Feat/al 1340 warning lookups
2 parents 2c750a0 + 04a991e commit e408e05

File tree

5 files changed

+64
-2
lines changed

5 files changed

+64
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [6.0.3] - 2025-03-19
8+
9+
### Deprecated
10+
- Right now the upload of lookups is based on the `my.lookup.data` and `my.lookup.control` tables.
11+
This method will soon be deprecated on the Devo backend.
12+
As an alternative, you can use the Lookups API: [Lookups API Documentation](https://docs.devo.com/space/latest/127500289/Lookups+API).
13+
The Python SDK will support the Lookups API in future versions.
14+
715
## [6.0.2] - 2025-03-07
816

917
### Added

devo/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__description__ = "Devo Python Library."
22
__url__ = "http://www.devo.com"
3-
__version__ = "6.0.2"
3+
__version__ = "6.0.3"
44
__author__ = "Devo"
55
__author_email__ = "[email protected]"
66
__license__ = "MIT"

devo/sender/lookup.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# -*- coding: utf-8 -*-
2-
"""File with utils for send Lookups to Devo"""
2+
"""File with utils for send Lookups to Devo
3+
4+
This method, based on the `my.lookup.data` and `my.lookup.control` tables, will soon be deprecated on the Devo backend.
5+
As an alternative, you can use the Lookups API: [https://docs.devo.com/space/latest/127500289/Lookups+API].
6+
The Python SDK will support the Lookups API in future versions.
7+
"""
8+
39

410
import csv
511
import re
612
import sys
713
import time
14+
import warnings
815

916
from devo.sender.data import open_file
1017

@@ -291,6 +298,15 @@ def send_control(self, event=None, headers=None, action=None):
291298
:param action: action, can be START or END
292299
:return:
293300
"""
301+
if event == self.EVENT_START:
302+
warnings.warn(
303+
"The lookup upload functionality based on the `my.lookup.data` and `my.lookup.control` tables "
304+
"will be deprecated in the future. Instead, you can use the Lookups API: "
305+
"https://docs.devo.com/space/latest/127500289/Lookups+API. The next version of the Python SDK will be "
306+
"based on this API.",
307+
DeprecationWarning,
308+
stacklevel=2
309+
)
294310
if event == self.EVENT_END:
295311
time.sleep(self.delay)
296312
line = "%s_%s|%s|%s" % (self.lookup_id, self.name, event, headers)

docs/sender/lookup.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313

1414
<!-- /code_chunk_output -->
1515

16+
> [!WARNING]
17+
> Right now the upload of lookups is based on the `my.lookup.data` and `my.lookup.control` tables.
18+
> This method will soon be deprecated on the Devo backend.
19+
> As an alternative, you can use the Lookups API: [Lookups API Documentation](https://docs.devo.com/space/latest/127500289/Lookups+API).
20+
> The Python SDK will support the Lookups API in future versions.
21+
22+
1623
## Overview
1724

1825
This library allows you to send lookups to the Devo platform.

tests/integration/test_sender_send_lookup.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,37 @@ def test_escape_quotes_in_send_csv_delete_index(setup):
366366
)
367367
clean_field.assert_called_with("ffffff", True, False)
368368

369+
def test_deprecated_warning(setup):
370+
engine_config = SenderConfigSSL(
371+
address=(setup.ssl_address, setup.ssl_port),
372+
key=setup.local_server_key,
373+
cert=setup.local_server_cert,
374+
chain=setup.local_server_chain,
375+
check_hostname=False,
376+
verify_mode=CERT_NONE,
377+
)
378+
con = Sender(engine_config)
379+
with pytest.warns(DeprecationWarning) as record:
380+
lookup = Lookup(name=setup.lookup_name, historic_tag=None, con=con)
381+
382+
with open(setup.lookup_file) as f:
383+
line = f.readline()
384+
385+
lookup.send_csv(
386+
setup.lookup_file,
387+
headers=line.rstrip().split(","),
388+
key=setup.lookup_key,
389+
)
390+
391+
con.socket.shutdown(0)
392+
393+
assert len(record) == 1
394+
warning = record[0]
395+
expected_message = ("The lookup upload functionality based on the `my.lookup.data` and `my.lookup.control` tables "
396+
"will be deprecated in the future. Instead, you can use the Lookups API: "
397+
"https://docs.devo.com/space/latest/127500289/Lookups+API. The next version of the Python SDK "
398+
"will be based on this API.")
399+
assert expected_message in str(warning.message)
369400

370401
if __name__ == "__main__":
371402
pytest.main()

0 commit comments

Comments
 (0)