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
| from functools import reduce | |
| from PIL import Image | |
| import requests | |
| # 计算pHash(只需要三行): | |
| def phash(img): | |
| img = img.resize((8, 8), Image.ANTIALIAS).convert('L') | |
| avg = reduce(lambda x, y: x + y, img.getdata()) / 64. | |
| return reduce( | |
| lambda x, y: x | (y[1] << y[0]), |
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
| # curl -G https://api.infura.io/v1/jsonrpc/mainnet/eth_getBalance --data-urlencode 'params=["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"]' | |
| import requests | |
| import urllib | |
| params_str = '["{}","latest"]'.format('0xc94770007dda54cF92009BFF0dE90c06F603a09f') | |
| params_encode = urllib.parse.quote(params_str) | |
| r = requests.get( | |
| url="https://api.infura.io/v1/jsonrpc/mainnet/eth_getBalance?params={}".format(params_encode), | |
| ) | |
| print(r.json()) | |
| balance = int(r.json()["result"],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
| import grequests | |
| import urllib | |
| address_list = [ | |
| "0xc94770007dda54cF92009BFF0dE90c06F603a09f", | |
| '0x054c64741dbafdc19784505494029823d89c3b13', | |
| '0x0b4bdc478791897274652dc15ef5c135cae61e60', | |
| '0x4af328c52921706dcb739f25786210499169afe6', | |
| '0x49bd2da75b1f7af1e4dfd6b1125fecde59dbec58', | |
| '0x829bd824b016326a401d083b33d092293333a830', |
NewerOlder