-
-
Notifications
You must be signed in to change notification settings - Fork 250
Adding proxy API's for etherscan #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
|
||
api = Proxies(api_key=key) | ||
block = api.get_block_by_number(5747732) | ||
print(block['number']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
|
||
api = Proxies(api_key=key) | ||
tx_count = api.get_block_transaction_count_by_number(block_number='0x10FB78') | ||
print(int(tx_count, 16)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
api = Proxies(api_key=key) | ||
block = api.get_most_recent_block() | ||
print(int(block, 16)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
|
||
api = Proxies(api_key=key) | ||
transaction = api.get_transaction_by_blocknumber_index(block_number='0x57b2cc', index='0x2') | ||
print(transaction['transactionIndex']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
api = Proxies(api_key=key) | ||
transaction = api.get_transaction_by_hash( | ||
tx_hash='0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1') | ||
print(transaction['hash']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
|
||
api = Proxies(api_key=key) | ||
count = api.get_transaction_count('0x6E2446aCfcec11CC4a60f36aFA061a9ba81aF7e0') | ||
print(int(count, 16)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
api = Proxies(api_key=key) | ||
receipt = api.get_transaction_receipt('0xb03d4625fd433ad05f036abdc895a1837a7d838ed39f970db69e7d832e41205d') | ||
print(receipt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from etherscan.proxies import Proxies | ||
import json | ||
|
||
with open('../../api_key.json', mode='r') as key_file: | ||
key = json.loads(key_file.read())['key'] | ||
|
||
api = Proxies(api_key=key) | ||
uncles = api.get_uncle_by_blocknumber_index(block_number='0x210A9B', index='0x0') | ||
print(uncles['uncles']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
requests==2.18.4 | ||
typing==3.6.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We forgot to remove that comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am currently working on cleaning up the code a bit. I'll remove that in my pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great thanks!
Also I'm not getting why Travis didn't fail on the linter when it should have complained. Running
tox
locally I see some valid complain.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just remove the comment then?
Also, If the proxy apis fail you get this:
I don't think this is accounted for in this PR. However, I think #8 would fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the linter still just pointing at the tests folder only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the two lines comments were with a
self.assertRaises(EmptyResponse)
to describe a bug. But the bug was fixed and assert removed in 06f7b04, but the comment was left. So yes basically just removing that two comment is enough.Also you can delete the
print
, I don't think we needprint
in unit tests. Plus I think we should avoid making actual network calls, but actual mock it, but that's a different story.I'm not sure regarding the rainy scenario. with error code and message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True for the linter it's currently only tests folder, but that one is also failing. e.g.
tests/test_proxies.py:4:1: F401 'etherscan.client.EmptyResponse' imported but unused
https://github.com/corpetty/py-etherscan-api/blob/06f7b04/tests/test_proxies.py#L4 and other couple of more. So really not sure why Travis didn't catch these obvious ones.They don't pop up when you run
tox
on your dev env?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran flake8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I ran
tox
that ransflake8
for you.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay just ran that. Got the same results. When should we switch flake8 to the whole directory?