Skip to content

Commit

Permalink
using getters and setters
Browse files Browse the repository at this point in the history
  • Loading branch information
John Waller committed Apr 19, 2024
1 parent 1e1ee38 commit 5309b4f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions pygbif/occurrences/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def download(
req.format = format

if is_not_none(verbatim_extensions):
req.payload["verbatimExtensions"] = verbatim_extensions
req.verbatim_extensions = verbatim_extensions

if isinstance(queries, dict):
req.predicate = queries
Expand Down Expand Up @@ -295,7 +295,7 @@ def __init__(self, creator, email, polygon=None):
self.predicates = []
self._main_pred_type = "and"
self._predicate = {"type": self._main_pred_type, "predicates": self.predicates}
self.verbatim_extensions = None
# self._verbatim_extensions = None

self.url = "http://api.gbif.org/v1/occurrence/download/request"
self.header = {
Expand Down Expand Up @@ -360,6 +360,23 @@ def predicate(self, value):
self.payload["predicate"] = self._predicate
else:
raise Exception("predicate must be a dictionary")

@property
def verbatim_extensions(self):
"""get verbatim extensions"""
return self._verbatim_extensions

@verbatim_extensions.setter
def verbatim_extensions(self, value):
"""set verbatim extensions
:param value: list of verbatim extensions to include in the download
"""
if(self.format == "DWCA"):
self._verbatim_extensions = value
self.payload["verbatimExtensions"] = self._verbatim_extensions
else:
raise Exception("verbatim extensions can only be used with the DWCA format")

@property
def format(self):
Expand Down

0 comments on commit 5309b4f

Please sign in to comment.