udata 9.1.5.dev31465__py2.py3-none-any.whl → 9.1.5.dev31476__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of udata might be problematic. Click here for more details.

@@ -40,10 +40,16 @@ def serialize_resource_for_event(resource):
40
40
 
41
41
  @task(route="high.resource")
42
42
  def publish(url, document, resource_id, action):
43
- if action == EventMessageType.DELETED:
44
- resource = None
45
- else:
46
- resource = serialize_resource_for_event(get_by(document.resources, "id", resource_id))
43
+ match action:
44
+ case EventMessageType.CREATED:
45
+ method = requests.post
46
+ resource = serialize_resource_for_event(get_by(document.resources, "id", resource_id))
47
+ case EventMessageType.MODIFIED:
48
+ method = requests.put
49
+ resource = serialize_resource_for_event(get_by(document.resources, "id", resource_id))
50
+ case EventMessageType.DELETED:
51
+ method = requests.delete
52
+ resource = None
47
53
  payload = {
48
54
  "resource_id": str(resource_id),
49
55
  "dataset_id": str(document.id),
@@ -52,7 +58,7 @@ def publish(url, document, resource_id, action):
52
58
  headers = {}
53
59
  if current_app.config["RESOURCES_ANALYSER_API_KEY"]:
54
60
  headers = {"Authorization": f"Bearer {current_app.config['RESOURCES_ANALYSER_API_KEY']}"}
55
- r = requests.post(url, json=payload, headers=headers)
61
+ r = method(url, json=payload, headers=headers)
56
62
  r.raise_for_status()
57
63
 
58
64
 
@@ -62,7 +68,7 @@ def publish_added_resource_message(sender, document, **kwargs):
62
68
  "RESOURCES_ANALYSER_URI"
63
69
  ):
64
70
  publish.delay(
65
- f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resource/created/",
71
+ f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resources/",
66
72
  document,
67
73
  kwargs["resource_id"],
68
74
  EventMessageType.CREATED,
@@ -75,7 +81,7 @@ def publish_updated_resource_message(sender, document, **kwargs):
75
81
  "RESOURCES_ANALYSER_URI"
76
82
  ):
77
83
  publish.delay(
78
- f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resource/updated/",
84
+ f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resources/",
79
85
  document,
80
86
  kwargs["resource_id"],
81
87
  EventMessageType.MODIFIED,
@@ -88,7 +94,7 @@ def publish_removed_resource_message(sender, document, **kwargs):
88
94
  "RESOURCES_ANALYSER_URI"
89
95
  ):
90
96
  publish.delay(
91
- f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resource/deleted/",
97
+ f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resources/",
92
98
  document,
93
99
  kwargs["resource_id"],
94
100
  EventMessageType.DELETED,
@@ -31,7 +31,7 @@ class DatasetEventsTest:
31
31
  }
32
32
 
33
33
  mock_req.assert_called_with(
34
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/created/",
34
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
35
35
  json=expected_value,
36
36
  headers={}, # No RESOURCES_ANALYSER_API_KEY, no headers.
37
37
  )
@@ -53,12 +53,12 @@ class DatasetEventsTest:
53
53
  dataset.add_resource(resource)
54
54
 
55
55
  mock_req.assert_called_with(
56
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/created/",
56
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
57
57
  json=expected_value,
58
58
  headers={"Authorization": "Bearer foobar-api-key"},
59
59
  )
60
60
 
61
- @patch("requests.post")
61
+ @patch("requests.put")
62
62
  @pytest.mark.options(RESOURCES_ANALYSER_API_KEY="foobar-api-key")
63
63
  def test_publish_message_resource_modified(self, mock_req):
64
64
  resource = ResourceFactory(schema=Schema(url="http://localhost/my-schema"))
@@ -77,7 +77,7 @@ class DatasetEventsTest:
77
77
  dataset.update_resource(resource)
78
78
 
79
79
  mock_req.assert_called_with(
80
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/updated/",
80
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
81
81
  json=expected_value,
82
82
  headers={"Authorization": "Bearer foobar-api-key"},
83
83
  )
@@ -87,7 +87,7 @@ class DatasetEventsTest:
87
87
  # (for example, encoding Embeds fails)
88
88
  complexjson.dumps(expected_value)
89
89
 
90
- @patch("requests.post")
90
+ @patch("requests.delete")
91
91
  @pytest.mark.options(RESOURCES_ANALYSER_API_KEY="foobar-api-key")
92
92
  def test_publish_message_resource_removed(self, mock_req):
93
93
  resource = ResourceFactory()
@@ -104,7 +104,7 @@ class DatasetEventsTest:
104
104
  dataset.remove_resource(resource)
105
105
 
106
106
  mock_req.assert_called_with(
107
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/deleted/",
107
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
108
108
  json=expected_value,
109
109
  headers={"Authorization": "Bearer foobar-api-key"},
110
110
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: udata
3
- Version: 9.1.5.dev31465
3
+ Version: 9.1.5.dev31476
4
4
  Summary: Open data portal
5
5
  Home-page: https://github.com/opendatateam/udata
6
6
  Author: Opendata Team
@@ -145,6 +145,7 @@ It is collectively taken care of by members of the
145
145
  - Add a minimal publiccode.yml [#3144](https://github.com/opendatateam/udata/pull/3144)
146
146
  - Fix the boolean filters in the API for the "new system" endpoints [#3139](https://github.com/opendatateam/udata/pull/3139)
147
147
  - Update authlib dependency from 0.14.3 to 1.3.1 [#3135](https://github.com/opendatateam/udata/pull/3135)
148
+ - Use hydra's RESTful endpoint URLs [#3142](https://github.com/opendatateam/udata/pull/3142)
148
149
 
149
150
  ## 9.1.4 (2024-08-26)
150
151
 
@@ -95,7 +95,7 @@ udata/core/dataset/apiv2.py,sha256=VTE4eYx5udzOdHDUkD7TYpuCtppZMKp1okTSEE1fcgI,1
95
95
  udata/core/dataset/commands.py,sha256=__hPAk_6iHtgMnEG51ux0vbNWJHxUjXhi1ukH4hF5jY,3714
96
96
  udata/core/dataset/constants.py,sha256=pkOvrdNBq3k1ojJcv6oSg7kK1IUtb3PqLni-YJ3rKSY,2880
97
97
  udata/core/dataset/csv.py,sha256=XMl8MaYCEyGmkCZqRSWrGRxCht2C9e3aQYGwDQLXYT0,3618
98
- udata/core/dataset/events.py,sha256=LEL9_iMTZ0bZlli2TdkQtV8pCRbFQBd91Hqh_WCW84c,3444
98
+ udata/core/dataset/events.py,sha256=LGSTwipns0H6141jaupLdEdrJhvcyhzL7yRUNBWWi9Q,3712
99
99
  udata/core/dataset/exceptions.py,sha256=uKiayLSpSzsnLvClObS6hOO0qXEqvURKN7_w8eimQNU,498
100
100
  udata/core/dataset/factories.py,sha256=fRDWDlybR_ud4pDs1-ntWuYHKtV9LMHeBOBp2SmTT6M,9006
101
101
  udata/core/dataset/forms.py,sha256=H2oeAD8XckMugnwUcyuKv7o1Xq1rEIlLz9FtxujqbIE,6196
@@ -629,7 +629,7 @@ udata/tests/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
629
629
  udata/tests/dataset/test_csv_adapter.py,sha256=Bupsw2vmkZjFLAbVATSek-6M_WZRsidXNGd28UQRVdE,3444
630
630
  udata/tests/dataset/test_dataset_actions.py,sha256=bgDjVYjOvu3sX_FCTCzf2snZYSprsqor2nAhIVuokSs,722
631
631
  udata/tests/dataset/test_dataset_commands.py,sha256=zMPJG2wYwKBee2zI65kmboxf59Zqa84DDjT8V5wj9uo,801
632
- udata/tests/dataset/test_dataset_events.py,sha256=JP-qC9wxaCFn4CLUI3WWCqiDinXgfaa5nF9j-YhB0iQ,4034
632
+ udata/tests/dataset/test_dataset_events.py,sha256=SYYvtK_YjPUoMzw44CfoVtXn5gOcc7i0PqApcwRZkOw,4007
633
633
  udata/tests/dataset/test_dataset_model.py,sha256=oaqm7q3DwZa4GLCyv7rj3rvtBIKxdCf4wUQdYo1pOiU,29745
634
634
  udata/tests/dataset/test_dataset_rdf.py,sha256=EAUYrM2es4WFOcTh42j1h3CzYTW6p0JfYQddHdiLln8,30082
635
635
  udata/tests/dataset/test_dataset_tasks.py,sha256=rSafDjCiOyEb2_tVUDN4wqGylF6Yf9VNB769SLmxlwI,2283
@@ -697,9 +697,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=WpPzAqVd2Onv_kz45ULUySKPLrpjcc
697
697
  udata/translations/pt/LC_MESSAGES/udata.po,sha256=18Op9RUITewoDRewlOdYzzq6gjsf1lsvepACV1d7zxs,44976
698
698
  udata/translations/sr/LC_MESSAGES/udata.mo,sha256=NIYRNhVoETZUvIvWm3cCW7DtMBAnS2vXzZjMF5ZzD_c,28500
699
699
  udata/translations/sr/LC_MESSAGES/udata.po,sha256=rQB-4V4WJ7bURj6g2j653vItr5TMHadcLQxec7_fDmg,51545
700
- udata-9.1.5.dev31465.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
701
- udata-9.1.5.dev31465.dist-info/METADATA,sha256=tFJYKtHS8Afh62Xq-YaVFXhXtcJFjIakvCHgBS4TdZY,130428
702
- udata-9.1.5.dev31465.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
703
- udata-9.1.5.dev31465.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
704
- udata-9.1.5.dev31465.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
705
- udata-9.1.5.dev31465.dist-info/RECORD,,
700
+ udata-9.1.5.dev31476.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
701
+ udata-9.1.5.dev31476.dist-info/METADATA,sha256=bMXc881-T_lSN5FOuwQI8YacVf-1J3AdhVYSVhefjIQ,130521
702
+ udata-9.1.5.dev31476.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
703
+ udata-9.1.5.dev31476.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
704
+ udata-9.1.5.dev31476.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
705
+ udata-9.1.5.dev31476.dist-info/RECORD,,