-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update python basic example * reduce test size to support small servers
- Loading branch information
Showing
8 changed files
with
39 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import blyss | ||
|
||
api_key = "<YOUR API KEY HERE>" | ||
client = blyss.Client(api_key, "https://alpha.api.blyss.dev") | ||
|
||
# Create the bucket and fill it with some data | ||
bucket_name = "state-capitals" | ||
bucket = None | ||
if not client.exists(bucket_name): | ||
client.create(bucket_name) | ||
|
||
# Connect to your bucket | ||
bucket = client.connect(bucket_name) | ||
|
||
# Write some data (keys are strings, values are bytes) | ||
bucket.write( | ||
{ | ||
"California": "Sacramento".encode(), | ||
"Ohio": "Columbus".encode(), | ||
"New York": "Albany".encode(), | ||
} | ||
) | ||
|
||
# This is a completely *private* query: | ||
# the server *cannot* learn that you looked up "California" or "Texas"! | ||
print("Privately reading the capital of California...") | ||
capitals = bucket.private_read(["California", "Texas"]) | ||
|
||
# when a requested key is not found, its value is None | ||
capitals = [c.decode() if c else None for c in capitals] | ||
print(f"Got '{capitals}'!") |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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