File tree Expand file tree Collapse file tree 3 files changed +3
-27
lines changed
src/apify/storage_clients/_apify Expand file tree Collapse file tree 3 files changed +3
-27
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import asyncio
4
- import os
5
4
from logging import getLogger
6
5
from typing import TYPE_CHECKING , Any
7
6
8
7
from typing_extensions import override
9
8
10
9
from apify_client import ApifyClientAsync
11
- from apify_shared .consts import ActorEnvVars , ApifyEnvVars
12
10
from crawlee .storage_clients ._base import DatasetClient
13
11
from crawlee .storage_clients .models import DatasetItemsListPage , DatasetMetadata
14
12
@@ -99,13 +97,7 @@ async def open(
99
97
100
98
# If both id and name are None, try to get the default storage ID from environment variables.
101
99
if id is None and name is None :
102
- id = os .environ .get (
103
- ActorEnvVars .DEFAULT_DATASET_ID .value ,
104
- None ,
105
- ) or os .environ .get (
106
- ApifyEnvVars .DEFAULT_DATASET_ID .value ,
107
- None ,
108
- )
100
+ id = getattr (configuration , 'default_dataset_id' , None )
109
101
110
102
if id is None :
111
103
raise ValueError (
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import asyncio
4
- import os
5
4
from logging import getLogger
6
5
from typing import TYPE_CHECKING , Any
7
6
8
7
from typing_extensions import override
9
8
from yarl import URL
10
9
11
10
from apify_client import ApifyClientAsync
12
- from apify_shared .consts import ActorEnvVars , ApifyEnvVars
13
11
from crawlee .storage_clients ._base import KeyValueStoreClient
14
12
from crawlee .storage_clients .models import KeyValueStoreMetadata , KeyValueStoreRecord , KeyValueStoreRecordMetadata
15
13
@@ -101,13 +99,7 @@ async def open(
101
99
102
100
# If both id and name are None, try to get the default storage ID from environment variables.
103
101
if id is None and name is None :
104
- id = os .environ .get (
105
- ActorEnvVars .DEFAULT_KEY_VALUE_STORE_ID .value ,
106
- None ,
107
- ) or os .environ .get (
108
- ApifyEnvVars .DEFAULT_KEY_VALUE_STORE_ID .value ,
109
- None ,
110
- )
102
+ id = getattr (configuration , 'default_key_value_store_id' , None )
111
103
112
104
if id is None :
113
105
raise ValueError (
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import asyncio
4
- import os
5
4
from collections import deque
6
5
from datetime import datetime , timedelta , timezone
7
6
from logging import getLogger
11
10
from typing_extensions import override
12
11
13
12
from apify_client import ApifyClientAsync
14
- from apify_shared .consts import ActorEnvVars , ApifyEnvVars
15
13
from crawlee ._utils .requests import unique_key_to_request_id
16
14
from crawlee .storage_clients ._base import RequestQueueClient
17
15
from crawlee .storage_clients .models import AddRequestsResponse , ProcessedRequest , RequestQueueMetadata
@@ -131,13 +129,7 @@ async def open(
131
129
132
130
# If both id and name are None, try to get the default storage ID from environment variables.
133
131
if id is None and name is None :
134
- id = os .environ .get (
135
- ActorEnvVars .DEFAULT_REQUEST_QUEUE_ID .value ,
136
- None ,
137
- ) or os .environ .get (
138
- ApifyEnvVars .DEFAULT_REQUEST_QUEUE_ID .value ,
139
- None ,
140
- )
132
+ id = getattr (configuration , 'default_request_queue_id' , None )
141
133
142
134
if id is None :
143
135
raise ValueError (
You can’t perform that action at this time.
0 commit comments