Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Python Flask获取元掩码帐户?_Python_Flask_Blockchain_Metamask - Fatal编程技术网

如何使用Python Flask获取元掩码帐户?

如何使用Python Flask获取元掩码帐户?,python,flask,blockchain,metamask,Python,Flask,Blockchain,Metamask,我正在学习使用Python构建DAPP。我将Flask用作web脚本部分,将Ganache用作本地区块链 目前,我正在使用此方法获取Python中的帐户 ganacheURL = "HTTP://127.0.0.1:7545" web3 = Web3(Web3.HTTPProvider(ganacheURL)) web3.eth.defaultAccount = web3.eth.accounts[0] #First account in Ganache 我在连接到Ga

我正在学习使用Python构建DAPP。我将Flask用作web脚本部分,将Ganache用作本地区块链

目前,我正在使用此方法获取Python中的帐户

ganacheURL = "HTTP://127.0.0.1:7545"
web3 = Web3(Web3.HTTPProvider(ganacheURL))
web3.eth.defaultAccount = web3.eth.accounts[0]   #First account in Ganache
我在连接到Ganache的Metamask中使用自定义RPC。 我想知道是否可以使用Python从Metamask获取当前帐户地址。如果可能的话,请告诉我

比如:

currentAccountAddresss = getCurrentMetamaskAccount()  #Fetches Current Metamask account
每当我在metamask中选择另一个帐户时,此地址都应该更改。 任何形式的帮助都将不胜感激