-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(notes): added note_upload_service
- Loading branch information
1 parent
05e654f
commit 06dd47b
Showing
4,101 changed files
with
567,168 additions
and
52 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[default] | ||
aws_access_key_id = "AKIAXBWYNHCVA3KMXP4F" | ||
aws_secret_access_key = "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" |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,38 @@ | ||
import grpc | ||
import notes_pb2 | ||
import notes_pb2_grpc | ||
|
||
def upload_note(stub, user_id, filename, file_content): | ||
# Create a request message | ||
request = notes_pb2.UploadNoteRequest(userId=user_id, filename=filename, fileContent=file_content) | ||
# Make the call to the server | ||
response = stub.UploadNote(request) | ||
return response | ||
|
||
def retrieve_note(stub, note_id): | ||
# Create a request message | ||
request = notes_pb2.RetrieveNoteRequest(noteId=note_id) | ||
# Make the call to the server | ||
response = stub.RetrieveNote(request) | ||
return response | ||
|
||
def run(): | ||
# Update with the appropriate server address and port | ||
with grpc.insecure_channel('localhost:50051') as channel: | ||
stub = notes_pb2_grpc.NoteServiceStub(channel) # Updated to NoteServiceStub | ||
|
||
# Example usage: upload a note | ||
user_id = '123' | ||
filename = 'example_note.txt' | ||
file_content = b'This is the content of the note.' | ||
upload_response = upload_note(stub, user_id, filename, file_content) | ||
print(f"Uploaded Note ID: {upload_response.noteId}") | ||
|
||
# Example usage: retrieve a note | ||
# Note: You need to implement this part on the server side for it to work | ||
note_id = upload_response.noteId | ||
retrieve_response = retrieve_note(stub, note_id) | ||
print(f"Retrieved Note Content: {retrieve_response.fileContent}") | ||
|
||
if __name__ == '__main__': | ||
run() |
This file was deleted.
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
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
Oops, something went wrong.