Giter Club home page Giter Club logo

Comments (10)

richin13 avatar richin13 commented on June 8, 2024 1

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.

THED4NIEL avatar THED4NIEL commented on June 8, 2024 1

@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.

image

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.

chiwalfrm avatar chiwalfrm commented on June 8, 2024

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.

stale avatar stale commented on June 8, 2024

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.

stale avatar stale commented on June 8, 2024

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.

THED4NIEL avatar THED4NIEL commented on June 8, 2024

@richin13 which version do you use?
I tried using it with the with statement, but it says the following:
image

I use the 2.0.0 both from repo and cloned from GitHub, both throw that error

from bscscan-python.

richin13 avatar richin13 commented on June 8, 2024

@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.

THED4NIEL avatar THED4NIEL commented on June 8, 2024

@623134636b3768756e643372 that's odd, I'm using 2.0.0 too.

From pip freeze
bscscan-python==2.0.0

What's your platform?

Windows 10 x64
Python 3.10.1 64-bit
VSCode with default Python extension
Pylance server enabled

from bscscan-python.

richin13 avatar richin13 commented on June 8, 2024

@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:

image

But the code runs just fine. Have you tried running it?

from bscscan-python.

stale avatar stale commented on June 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.