Skip to content

Commit a7e38a9

Browse files
committed
Add get_list_of_key_value_stores()
1 parent 661c730 commit a7e38a9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

apify/functions.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,30 @@ def get_list_of_actors(session=requests.session(), config="apify_config.json", *
110110
return r.json()
111111

112112

113+
def get_list_of_key_value_stores(session=requests.session(), config="apify_config.json", **kwargs):
114+
"""Gets list of key-value stores owned by the user
115+
https://www.apify.com/docs/api/v2#/reference/key-value-stores/store-collection/get-list-of-key-value-stores
116+
117+
Args:
118+
session (requests.Session object): used to send the HTTP requests (default: new session)
119+
config (str, path-like): path to JSON file with user ID and token
120+
kwargs:
121+
offset (int): rank of first request to return (default: 0)
122+
limit (int): maximum number of page results to return (default: 10000)
123+
desc (int): If 1, executions are sorted from newest to oldest (default: None)
124+
unnamed (bool): If True, unnamed key-value stores are returned with named ones (default: False)
125+
126+
Returns:
127+
kv_list (JSON object): basic information about each key-value store
128+
"""
129+
user_id, token = common._get_auth(config)
130+
url = "https://api.apify.com/v2/key-value-stores"
131+
kwargs.setdefault("token", token)
132+
r = session.get(url, params=kwargs)
133+
r.raise_for_status()
134+
return r.json()
135+
136+
113137
def get_list_of_tasks(session=requests.session(), config="apify_config.json", **kwargs):
114138
"""Gets list of tasks a user created or used
115139
https://www.apify.com/docs/api/v2#/reference/actor-tasks/tasks-collection/get-a-list-of-tasks

0 commit comments

Comments
 (0)