Acquire the value of global state from smart contract

Hi there, I am a newcomer to algorand and smart contract. I met a problem of obtaining the value from the global state of a smart contract application.

For example, there is a smart contract having a gloabl state called “hello”. The value to this key is “nice to meet you”. I would like to use the function of pyteal and py-algorand to do the following things:

First, read the value of this global state from this specific app.
Second, return this value in HTTP response (I am using purestake testnet here), so that I could read this value in local dev like vscode editor.

Until now, I have tried App.globalGet(“hello”) and App.globalGetEx(Int(0), “hello”), but neither of them works. Any ideas?

Welcome @yfmao glad you are here building!

Have a look at this section of the docs for using the SDK to read global state:

Please let me know if that gets you closer. Please provide some of your code samples that are failing and we can troubleshoot further with you. Please use the triple tick to create code blocks:

# Use ``` before and after your code