Skip to content

Instantly share code, notes, and snippets.

@vipwp
vipwp / caller_name.py
Created April 24, 2019 07:40 — forked from techtonik/caller_name.py
Python - inspect - Get full caller name (package.module.function)
# Public Domain, i.e. feel free to copy/paste
# Considered a hack in Python 2
import inspect
def caller_name(skip=2):
"""Get a name of a caller in the format module.class.method
`skip` specifies how many levels of stack to skip while getting caller
name. skip=1 means "who calls me", skip=2 "who calls my caller" etc.
@vipwp
vipwp / json
Created December 25, 2013 08:55
{
"table":"dr_c_ugc",
"rows":[
{
"dp_crtbywyj": 60,
"dp_web": 778,
"DataChange_CreateTime": "2013-12-25 15:14:46",
"yj_weiyouji": 111,
"yj_weiyouji_app": 53,
"qa_askperson": 45,
@vipwp
vipwp / wpa_qq
Created October 28, 2013 20:43
python wpa QQ
#!/usr/bin/env python
#coding:utf-8
"""
Author: --<>
Purpose:
Created: 2013-10-26
"""
import urllib
import urllib2
@vipwp
vipwp / python
Last active December 26, 2015 07:09
python get IP
def getip():
localIP = socket.gethostbyname(socket.gethostname())#得到本地ip
print "local ip:%s " % localIP
ipList = socket.gethostbyname_ex(socket.gethostname())
for i in ipList:
if i != localIP:
print "external IP:%s" % i