Skip to content

Commit 51b4d00

Browse files
committed
Adapt get_flatfile_list to be used in EDGE
1 parent f3aa267 commit 51b4d00

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

ravenpackapi/core.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,20 @@ def get_document_url(self, rp_story_id):
235235
return response.json()['url']
236236

237237
def get_flatfile_list(self, flatfile_type):
238-
assert flatfile_type in {
239-
'companies', 'full'
240-
}
238+
self._assert_flatfile_type_is_valid(flatfile_type)
241239
response = self.request('/history/%s' % flatfile_type)
242240
return response.json()
243241

242+
def _assert_flatfile_type_is_valid(self, flatfile_type):
243+
if self.product == "rpa":
244+
if flatfile_type in {"companies", "full"}:
245+
return
246+
else:
247+
# In Edge we have too many different types to hardcode them here.
248+
return
249+
raise ValueError(f"Flatfile type {flatfile_type} is not valid for product {self.product}")
250+
251+
244252
def get_flatfile(self, flatfile_type, flatfile_id):
245253
""" Request the flatfile and return a streammable response """
246254
return self.request(

0 commit comments

Comments
 (0)