{ "info": { "author": "ruifengyun", "author_email": "rfyiamcool@163.com", "bugtrack_url": null, "classifiers": [], "description": "Control_DB_date\n=======\n\n\u9002\u5408\u573a\u666f\u662f \u6570\u636e\u5e93\u56e0\u4e3a\u91cf\u5927\uff0c\u6839\u636e\u65e5\u671f\u5207\u5206\u6210\u4e0d\u540c\u7684\u5e93,\u8be5\u6a21\u5757\u4f1a\u6839\u636e\u4f60\u63d0\u4f9b\u7684\u65f6\u95f4\u6bb5\uff0c\u8c03\u5ea6\u5230\u4e0d\u540c\u7684\u6570\u636e\u5e93\uff0c\u53ef\u6269\u5c55\u4e0d\u540c\u7684IP\u5730\u5740\u8c03\u5ea6......\n\n\u5f53\u65f6\u662f\u4e3a\u4e86\u5b9e\u73b0ES\u5e93\u7684\u4e2d\u5fc3\u8c03\u5ea6\uff0c\u52a0\u4e86\u5c42tornado\u7684api\uff0c\u4e3a\u4e0d\u540cclient\u63d0\u4f9b\u4e0d\u540c\u7684\u7b56\u7565\u3002\u5b9e\u73b0\u7684\u65b9\u6cd5\u8fd8\u662f\u6709\u4e9b\u7c97\u7cd9\uff0c\u6709\u65f6\u95f4\u5728\u8fdb\u4e00\u6b65\u7684\u6539\u8fdb\u4e00\u4e0b... ... \n\n.. image:: http://img3.douban.com/view/biz/raw/public/f477075ba610e94.jpg\n :height: 240px\n :width: 300 px\n\nInstall from Pypi\n-----------------\n\n pip install Control_DB_date\n\n\nBasic Example\n-------------\n #coding:utf-8\n from datetime import datetime\n from datetime import timedelta\n import time\n \n class Match_db_date(object):\n \"\"\"\n Match = Match_db_date()\n import json\n print json.dumps(Match.to_match('2014-01-11','2014-08-22'))\n \"\"\"\n def getMonthDays(self, year, month ):\n day = 31 \n while day:\n try:\n time.strptime( '%s-%s-%d'%( year, month, day ), '%Y-%m-%d' ) \n return day\n except:\n day -= 1 \n \n def fit_date_format(self,year,month):\n if month<10:\n str_db = \"buzz_v1_%s0%s\"%(year,month)\n else:\n str_db = \"buzz_v1_%s%s\"%(year,month)\n return str_db\n \n def to_match(self,start,end):\n dc = {}\n opt_start_time = datetime.strptime(start,\"%Y-%m-%d\")\n opt_end_time = datetime.strptime(end,\"%Y-%m-%d\")\n count_month = opt_end_time.month - opt_start_time.month\n if count_month == 0:\n \"\"\"buzz_v1_201502\"\"\"\n str_db = \"buzz_v1_%s\"%opt_start_time.strftime('%Y%m')\n dc[str_db] = [start,end]\n return dc\n \n for i in range(0,count_month+1):\n if i == 0:\n year = opt_start_time.year\n month = opt_start_time.month\n dc[self.fit_date_format(year,month)] = [start,\"%s-%s-%s\"%(year,month,self.getMonthDays(year,month))]\n \n elif i == count_month:\n year = opt_end_time.year\n month = opt_end_time.month\n day = opt_end_time.month\n dc[self.fit_date_format(year,month)] = [\"%s-%s-01\"%(year,month),end]\n \n else:\n year = opt_start_time.year\n month = opt_start_time.month+i\n if month<=12:\n dc[self.fit_date_format(year,month)] = [\"%s-%s-01\"%(year,month),\"%s-%s-%s\"%(year,month,self.getMonthDays(year,month) )]\n else:\n year = month / 12 + year\n month = month % 12\n dc[self.fit_date_format(year,month)] = [\"%s-%s-01\"%(year,month),\"%s-%s-%s\"%(year,month,getMonthDays(year,month))]\n \n return dc\n\n\nHow to use it \n-------------\n from Control_DB_date import *\n Match = Match_db_date()\n Match.to_match('2014-05-11,'2014-09-11')", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rfyiamcool", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "Control_DB_date", "package_url": "https://pypi.org/project/Control_DB_date/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Control_DB_date/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rfyiamcool" }, "release_url": "https://pypi.org/project/Control_DB_date/3.0.0/", "requires_dist": null, "requires_python": null, "summary": "get dbname from date and dbname , According to the monthly", "version": "3.0.0" }, "last_serial": 1698950, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "57c3d496440343942f14472bd6c01fad", "sha256": "3495cc7f5325d3236fea7bc5ab81aca0a65e5d123a5ab0e1dfadac2333fa0251" }, "downloads": -1, "filename": "Control_DB_date-0.1.2.tar.gz", "has_sig": false, "md5_digest": "57c3d496440343942f14472bd6c01fad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2420, "upload_time": "2015-03-03T07:54:25", "url": "https://files.pythonhosted.org/packages/37/7e/efb7614a79a806dad561b5f75993c12edf65a7142b9367917abe0edb3291/Control_DB_date-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "14b9bd015d0e46cdd1b7f10e3a987675", "sha256": "531cde60f2b7c275af8a07a54f89a4911cce0844f659ad5763dfafa7ce7155e8" }, "downloads": -1, "filename": "Control_DB_date-0.1.3.tar.gz", "has_sig": false, "md5_digest": "14b9bd015d0e46cdd1b7f10e3a987675", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2423, "upload_time": "2015-03-03T08:02:11", "url": "https://files.pythonhosted.org/packages/13/40/cc375d507d1280d3eab4d623ba13312629bf5778614f2881ade5fedb34f4/Control_DB_date-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "1b992c39fa49b0227390499b4cec0285", "sha256": "6ae65c51ba9d188df516e69d2b8efa2fc7634b56b41c81b326f72c7cf5d50acb" }, "downloads": -1, "filename": "Control_DB_date-0.1.4.tar.gz", "has_sig": false, "md5_digest": "1b992c39fa49b0227390499b4cec0285", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2420, "upload_time": "2015-03-03T08:04:15", "url": "https://files.pythonhosted.org/packages/63/8a/908510d63e4bf43c0301f8979e9aa2c832bb589e6fe06b9eeb0d84ff4c2a/Control_DB_date-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "2ed953f4d64db241481439748cbcab85", "sha256": "bdfed1021b830c527c11c27e092aa4ec13868cf5136d9664db1cc8b950fd8131" }, "downloads": -1, "filename": "Control_DB_date-0.1.5.tar.gz", "has_sig": false, "md5_digest": "2ed953f4d64db241481439748cbcab85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2244, "upload_time": "2015-03-11T15:50:33", "url": "https://files.pythonhosted.org/packages/0e/20/f166efd7cca4847a638f4944ed3235bf586bcd2bda72e785ad31b205c9d1/Control_DB_date-0.1.5.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "d7f95a72d0dd6581c92d8216bd318bcc", "sha256": "560470e15cfc44090877687d0bd5eed682e9a4dbd7e872f23fb336ed7f468dc2" }, "downloads": -1, "filename": "Control_DB_date-1.1.4.tar.gz", "has_sig": false, "md5_digest": "d7f95a72d0dd6581c92d8216bd318bcc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2416, "upload_time": "2015-08-28T02:02:14", "url": "https://files.pythonhosted.org/packages/64/bc/8fb43953bb2858e48d7e8aa6e3331d2ca5fd4a2aa4aa990fe9d4264b4f5b/Control_DB_date-1.1.4.tar.gz" } ], "1.5.0": [ { "comment_text": "", "digests": { "md5": "dc4aa73c888c0e6adc5204c0917239c4", "sha256": "a9c9a3015a85f90d29381badfb2f34f5e71200a7cde17ca65b14d12865ed441d" }, "downloads": -1, "filename": "Control_DB_date-1.5.0.tar.gz", "has_sig": false, "md5_digest": "dc4aa73c888c0e6adc5204c0917239c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2928, "upload_time": "2015-08-28T07:06:14", "url": "https://files.pythonhosted.org/packages/b8/ed/73501f42349f0a52f732a5a78b62c8bac8b5734e31555b1b1374442ccbfc/Control_DB_date-1.5.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "77d42fc3b7b0e563f23cee368cd563d0", "sha256": "75f344e5c13a0ae0ed7d9215cb0dcd0d9ae0ee59d31d7415233d9e7ae532c4f5" }, "downloads": -1, "filename": "Control_DB_date-2.0.0.tar.gz", "has_sig": false, "md5_digest": "77d42fc3b7b0e563f23cee368cd563d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2963, "upload_time": "2015-08-28T22:54:06", "url": "https://files.pythonhosted.org/packages/c9/33/402e6c56a7fe91c0c27d105afb3e4efb8ec1d9821f78968630cbef8f9819/Control_DB_date-2.0.0.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "5a83ccafda94c248ee1f1bee27ce7415", "sha256": "847d1c4910075a4ffdfcb4c0027fe639801c45ba78de97f6c60104e169a0d7fa" }, "downloads": -1, "filename": "Control_DB_date-3.0.0.tar.gz", "has_sig": false, "md5_digest": "5a83ccafda94c248ee1f1bee27ce7415", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2969, "upload_time": "2015-08-28T22:54:33", "url": "https://files.pythonhosted.org/packages/62/8e/d78b3e14e0cb55f449d26e4f5f5178e429067ed52edda2332b2c17074497/Control_DB_date-3.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5a83ccafda94c248ee1f1bee27ce7415", "sha256": "847d1c4910075a4ffdfcb4c0027fe639801c45ba78de97f6c60104e169a0d7fa" }, "downloads": -1, "filename": "Control_DB_date-3.0.0.tar.gz", "has_sig": false, "md5_digest": "5a83ccafda94c248ee1f1bee27ce7415", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2969, "upload_time": "2015-08-28T22:54:33", "url": "https://files.pythonhosted.org/packages/62/8e/d78b3e14e0cb55f449d26e4f5f5178e429067ed52edda2332b2c17074497/Control_DB_date-3.0.0.tar.gz" } ] }