-
Notifications
You must be signed in to change notification settings - Fork 4
added fetch segment from sdk endpoint #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chillaq
merged 10 commits into
segment-sdk-endpoint
from
FME-9612-fetch-segment-sdk-endpoint
Aug 22, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5e340c4
added fetch segment from sdk endpoint
chillaq fe25722
Updated returned keys set to json object
chillaq 10306e9
updated version
chillaq 767f9a9
rename fetch call
chillaq fe7e6f6
Moved function to microclient class
chillaq fe28441
Removed raising exceptions
chillaq a161327
Added section in readme
chillaq 3efcf48
updated readme
chillaq d3efa92
Added check for empty sdkapi key
chillaq 62ee805
polish
chillaq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,6 +281,39 @@ definition= {"treatments":[ {"name":"on"},{"name":"off"}], | |
} | ||
splitDef.submit_change_request(definition, 'UPDATE', 'updating default rule', 'comment', ['[email protected]'], '') | ||
``` | ||
### Segments Keys | ||
This build allows fetching segments keys from SDK Endpoints to speedup the download for big sized segments. | ||
|
||
The function `client.segment_definitions.get_all_keys` takes 2 parameters, the segment name and an Environment object retrieved from `client.environments` | ||
If the function is successful, it will return a json below with set of all segment keys and the total keys count, see example below: | ||
```json | ||
{ | ||
"keys": {"key1", "key2", "key3"}, | ||
"count": 3 | ||
} | ||
``` | ||
If any network issue or http returned codes are not within 200-300 range, None is returned. All errors are logged in debug mode. | ||
|
||
Below an example of fetching all segments keys in en environment. | ||
|
||
```python | ||
ws = client.workspaces.find("Default") | ||
env = client.environments.find("Production", ws.id) | ||
env.sdkApiToken = "SDK API Key (Server side)" | ||
|
||
for segDef in client.segment_definitions.list(env.id, ws.id): | ||
print(segDef.name) | ||
print("============") | ||
keys = client.segment_definitions.get_all_keys(segDef.name, env) | ||
if keys == None: | ||
print("Failed to get keys, check debug logs") | ||
else: | ||
print ("Segment Keys: ") | ||
print(keys) | ||
print("\n") | ||
|
||
print("done.") | ||
``` | ||
|
||
### Rule-Based Segments | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.