What type of topic is this?
Discussion
I Am using Python ic-py module library to fetch/source neuron’s data using get_neuron method(sns)
governance = Canister(agent=agent, canister_id=id, candid=governance_did) governance.get_neuron( { 'neuron_id': id } )
how do i pass the neuron id ?? is there some link or doc’s that i can refer to ?
I would suggest that you double-check the Governance canister Candid file to get the list of available functions.
Could you confirm which function you are trying to use? get_neuron
is not an exposed function.
Though I am not as familiar with ic-py as @ccyanxyz, they do provide an example in the ic-py
README for the list_proposals
function:
from ic.canister import Canister
from ic.client import Client
from ic.identity import Identity
from ic.agent import Agent
from ic.candid import Types
iden = Identity()
client = Client()
agent = Agent(iden, client)
# read governance candid from file
governance_did = open("governance.did").read()
# create a governance canister instance
governance = Canister(agent=agent, canister_id="rrkah-fqaaa-aaaaa-aaaaq-cai", candid=governance_did)
# call canister method with instance
res = governance.list_proposals(
{
'include_reward_status': [],
'before_proposal': [],
'limit': 100,
'exclude_topic': [],
'include_status': [1]
}
)
which corresponds to the type provided by the Governance Candid file:
list_proposals : (ListProposalInfo) -> (ListProposalInfoResponse) query;
type ListProposalInfo = record {
include_reward_status : vec int32;
omit_large_fields : opt bool;
before_proposal : opt NeuronId;
limit : nat32;
exclude_topic : vec int32;
include_all_manage_neuron_proposals : opt bool;
include_status : vec int32;
};
Based on the example that you provided, I am assuming that you probably are going something with the NeuronID which should be a record with an id of a nat64. type NeuronId = record { id : nat64 };
However, it would be great if you could double check the function that you are trying to use.
Hope this helps! Please let us know if any more questions.