Skip to content

Commit d1edee9

Browse files
committed
fix:ExampleFile
1 parent 266c822 commit d1edee9

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

examples/file/search_files.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
# Configure connection to SystemLink server
1111
server_configuration = HttpConfiguration(
12-
server_uri="https://yourserver.yourcompany.com",
13-
api_key="YourAPIKeyGeneratedFromSystemLink",
12+
server_uri="https://test-api.lifecyclesolutions.ni.com/",
13+
api_key="9voCglXGPBxU6-ZIQyFEwmIAymkdn_ynqOO7t52q2v",
1414
)
1515

1616
client = FileClient(configuration=server_configuration)
@@ -100,10 +100,8 @@
100100
custom_metadata = UpdateMetadataRequest(
101101
replace_existing=False,
102102
properties={
103-
"Department": "Engineering",
104-
"Project": "TestAutomation",
105-
"Status": "Active",
106-
"Version": "1.0",
103+
"TestProperty1": "TestValue1",
104+
"TestProperty2": "TestValue2",
107105
},
108106
)
109107
client.update_metadata(metadata=custom_metadata, id=file_id_2)
@@ -114,23 +112,22 @@
114112

115113
# Search by multiple custom properties using AND operator
116114
search_request = models.SearchFilesRequest(
117-
filter='(properties.Department:"Engineering") AND (properties.Project:"TestAutomation")',
115+
filter='(properties.TestProperty1:"TestValue1") AND (properties.TestProperty2:"TestValue2")',
118116
skip=0,
119117
take=10,
120118
)
121119

122120
response = client.search_files(search_request)
123121
print(
124122
f"Found {response.total_count.value if response.total_count else 0} file(s) with "
125-
"Department=Engineering AND Project=TestAutomation"
123+
"TestProperty1=TestValue1 AND TestProperty2=TestValue2"
126124
)
127125
if response.available_files:
128126
for file in response.available_files:
129127
if file.properties:
130128
print(f"- {file.properties.get('Name')}")
131-
print(f" Department: {file.properties.get('Department')}")
132-
print(f" Project: {file.properties.get('Project')}")
133-
print(f" Status: {file.properties.get('Status')}")
129+
print(f" TestProperty1: {file.properties.get('TestProperty1')}")
130+
print(f" TestProperty2: {file.properties.get('TestProperty2')}")
134131

135132
# Clean up: delete both test files
136133
print("\nCleaning up...")

0 commit comments

Comments
 (0)