This file contains 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', |
This file contains 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 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 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 requests | |
import json | |
headers = { | |
'Accept': 'application/json', | |
'Referer': 'https://scrapinghub.com/autoextract', | |
'Origin': 'https://scrapinghub.com', | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36', | |
'Sec-Fetch-Mode': 'cors', | |
'Content-Type': 'application/json', | |
} |
This file contains 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 calendar | |
import datetime | |
choose_week = {'1': 'MONDAY', | |
'2': 'TUESDAY', | |
'3': 'WEDNESDAY', | |
'4': 'THURSDAY', | |
'5': 'FRIDAY', | |
'6': 'SATURDAY', | |
'7': 'SUNDAY', } |
This file contains 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
''' | |
京东联盟开放平台API的一个通用的Client封装。 | |
京东联盟开放平台的文档详见 https://union.jd.com/openplatform | |
Example: | |
client = JdApiClient("<YOUR_APP_KEY>", "<YOUR_SECRET_KEY>") | |
resp = client.call("jd.union.open.goods.promotiongoodsinfo.query", | |
{'skuIds':'12072066'}) | |
print(resp.json()) | |
''' |
This file contains 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
''' | |
Created on Apr 7, 2020 | |
@author: admin | |
PyAutoGUI是一个纯Python的GUI自动化工具,其目的是可以用程序自动控制鼠标和键盘操作,多平台支持(Windows,OS X,Linux)。可以用pip安装,Github上有源代码。 | |
下面的代码让鼠标移到屏幕中央。 | |
''' | |
import pyautogui, time, pyperclip |
This file contains 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 selenium import webdriver | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
import requests | |
import logging | |
def test_chrome_server(host): | |
""" | |
主动调用,等待docker容器内chrome浏览器server启动 | |
:return: |
This file contains 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 asyncio | |
from pyppeteer import launch | |
import jsonpath | |
import random | |
from scrapy.selector import Selector | |
from pyquery import PyQuery as pq | |
merchant_list = { | |
"data": | |
[ | |
{ |
This file contains 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
# https://blog.csdn.net/u014291399/article/details/106636619 | |
from selenium.webdriver.chrome.remote_connection import ChromeRemoteConnection | |
from selenium import webdriver | |
import time | |
chromeOptions = webdriver.ChromeOptions() | |
# chromeOptions.add_argument('-headless') # 设为无头模式 | |
# chromeOptions.add_argument('--user-agent=Mozilla/5.0 HAHA') # 配置对象添加替换User-Agent的命令 | |
chromeOptions.add_argument('--disable-infobars') # 去掉提示:Chrome正收到自动测试软件的控制 | |
chromeOptions.add_experimental_option('excludeSwitches', ['enable-automation']) | |
chromeOptions.add_experimental_option('useAutomationExtension', False) |
OlderNewer