Skip to content

Instantly share code, notes, and snippets.

View toyourheart's full-sized avatar

toyourheart toyourheart

View GitHub Profile
@toyourheart
toyourheart / get_tmall_trade.py
Last active July 22, 2019 01:10
get_tmall_trade
import requests
url = 'https://trade.taobao.com/trade/itemlist/asyncSold.htm?event_submit_do_query=1&_input_charset=utf8'
ps = {}
for p in params.splitlines():
ps[p.split('\t')[0]] = p.split('\t')[1]
mainOrders = data['mainOrders']
orders = mainOrders[0]
@toyourheart
toyourheart / get_tmall_sku_discount_price.py
Created July 18, 2019 14:18
获取天猫单品宝sku 价格
import requests, json, re
yourCookie = input('input your Cookie: ')
token = re.search('_tb_token_=(\w+)', yourCookie)
headers = {
'Cookie': yourCookie,
'User-agent': 'Mozilla/5.0 (Windows NT 5.01; vi-VN; rv:1.9.1.20) Gecko/2018-01-19 19:36:18 Firefox/3.8'
}
uri = 'https://smf.taobao.com/itemactivity/DetailList.do?'
@toyourheart
toyourheart / heruko pg:pull
Last active April 1, 2019 15:14
heroku db
`heroku pg:pull postgresql-fitted-54596 zt`
`heroku pg:push zt postgresql-tapered-87070`
```
heroku addons:create heroku-postgresql:hobby-dev
heroku pg:credentials:url
heroku pg:psql
```
uri = "mongodb://<dbuser>:<dbpassword>@ds050739.mlab.com:50739/goods"
import json
import requests
head = """User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0
Referer: https://einvoice.taobao.com/index
Cookie: cookie
"""
def getHeaders(head):
headers = {}
@toyourheart
toyourheart / gist:d338c6fc31e1a60ca160b984621a521d
Created February 12, 2019 14:28
sheet_to_json doesn't output anything for a blank cell #159
`XLSX.utils.sheet_to_json(workbook.Sheets[sheet],{defval:""})`
@toyourheart
toyourheart / pltFontChinese.py
Created October 1, 2018 02:32
Display chinese in matplotlib 显示中文
import matplotlib.pyplot as plt
# 先下载安装思源黑体或宋体
# MacOS install source han Serif cn then...
plt.rcParams['font.family']=['Source Han Serif CN']
# simple example
plt.title('中文')
plt.show()
@toyourheart
toyourheart / goods.py
Last active September 13, 2018 15:42
foods = {'apple': 2, 'pipe': 6, 'orange': 3}
k = 0
for food, index in foods.items():
if food == 'apple':
print(1, index, food)
else:
print(k + 1, k + index, food)
k += index
print('sum = ' + str(k))
@toyourheart
toyourheart / emojis.json
Created December 18, 2017 05:48 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_biys", "shortname": "", "unicode": "", "html": "&#128104;&zw