lxyu / 17monip Goto Github PK
View Code? Open in Web Editor NEWIP search based on 17mon.cn, the best IP database for China.
Home Page: http://lxyu.github.io/17monip
IP search based on 17mon.cn, the best IP database for China.
Home Page: http://lxyu.github.io/17monip
我的应用布署在sae上面,我想是否可以个性一个通用的版本,当然可能会增加系统开销。替换掉mmap模块。使用更为通用的stringio 之类的。异或是可以提供转换dat至数据库的方法。。。。
举例:
223.255.227.143
223.255.227.170
223.255.227.162
查询结果为空
本地使用IP.find()都是正常的,
import IP
IP.find("www.baidu.com")
'**\t浙江\t杭州'
IP.find("127.0.0.1")
'本机地址\t本机地址'
但是,我现在正在用Python写Hadoop的map, reduce任务,需要在map, reduce中调用IP.find(),
请问具体如何做到?需要怎么打包IP模块到Hadoop中?
使用最新的数据库文件可以解析到具体的某个市了(原来只能到省),经过测试,只需要更新一下数据库文件17monipdb.dat
就可以。
Linux本身有自带名叫ip的命令,安装完成之后17monip也会生成一个名字叫ip的可执行文件,和原有的系统自带的ip冲突了,造成开机时进行网络配置不能。
#!/usr/bin/python
# encoding: utf-8
"""IP地址转换"""
import IP
location = IP.find('www.baidu.com')
print location
Traceback (most recent call last):
File "d:\www\spider\logip2location\cron.py", line 9, in
print location
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.