Comments (10)
Looks like you're missing the with
statement that actually builds the client. Also it looks like your code is synchronous so the snippet should look like this:
import bscscan
YOUR_API_KEY = ""
ADDRESS = ""
with bscscan.BscScan(YOUR_API_KEY, asynchronous=False) as bsc:
print(bsc.get_bnb_balance(address=ADDRESS))
from bscscan-python.
@richin13
Ok, just tried again.
The debugger throws an error, but the Python interactive console, as well as the integrated interactive console in VSCode work fine with the code.
Guess it's really just a cosmetic problem, not code-breaking.
Thank you very much! I was running in circles over that error :)
from bscscan-python.
I found a previous issue that looked the same as mine, and even if I use your solution (the example provided), it still doesn't work. There is no error with the code below, but no output either (goes back to shell prompt).
import asyncio
from bscscan import BscScan
YOUR_API_KEY = "<MYAPIKEY>"
async def main():
async with BscScan(YOUR_API_KEY) as bsc:
print(await bsc.get_bnb_balance(address="<MYADDRESS>"))
Previous issue reported: #25
from bscscan-python.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from bscscan-python.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from bscscan-python.
@richin13 which version do you use?
I tried using it with the with
statement, but it says the following:
I use the 2.0.0 both from repo and cloned from GitHub, both throw that error
from bscscan-python.
@623134636b3768756e643372 that's odd, I'm using 2.0.0 too.
From
pip freeze
bscscan-python==2.0.0
What's your platform?
from bscscan-python.
@623134636b3768756e643372 that's odd, I'm using 2.0.0 too.
From
pip freeze
bscscan-python==2.0.0What's your platform?
Windows 10 x64
Python 3.10.1 64-bit
VSCode with default Python extension
Pylance server enabled
from bscscan-python.
@623134636b3768756e643372 Ok I'm not familiar with VSCode and the Pylance setup but this client uses some magic methods to generate each member (such as get_bnb_balance
and so on) and linters don't like that. It actually shows a very similar message to me using Linux + neovim + pylint:
But the code runs just fine. Have you tried running it?
from bscscan-python.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from bscscan-python.
Related Issues (20)
- Option to pass api endpoint explicitly (to support other chains) HOT 1
- [FEATURE] HOT 2
- get_bep20_token_transfer_events_by_address don't get last blocks [BUG] HOT 4
- [FEATURE] Any way to add token holders information? Thank you HOT 2
- Getting nested transactions [BUG] HOT 1
- [FEATURE] HOT 1
- [BUG] HOT 2
- eth_sendRawTransaction HOT 1
- [BUG] ImportError: cannot import name 'resources' HOT 1
- aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.bscscan.com:443 ssl HOT 2
- [FEATURE]get_bep20_token_transfer_events_by_contract_address_paginated better suport startblock HOT 1
- Through API, real-time data cannot be obtained, such as the latest transaction data HOT 1
- [FEATURE]/questioin
- [FEATURE]/quesiton (help) HOT 1
- How to get the function called HOT 1
- Add Contract Address to get_bep20_token_transfer_events_by_address HOT 1
- module methods such as `get_normal_txs_by_address` not working HOT 1
- get_logs() Doesn't return all of the possible transaction and stops mid-way. HOT 1
- SyncClient is owning NO attributes[BUG] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bscscan-python.