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
db.getCollection("mastersportal_counrse").aggregate([ | |
{ | |
"$project": { | |
"overview": { | |
"$strLenCP": "$overview" | |
}, | |
"about": { | |
"$strLenCP": "$about" | |
} |
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 ratelimit import limits, sleep_and_retry | |
import requests | |
FIFTEEN_MINUTES = 900 | |
@sleep_and_retry | |
@limits(calls=15, period=FIFTEEN_MINUTES) | |
# 900秒内最多请求15次。 | |
def call_api(url): |
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 pymongo import MongoClient | |
class MongoDBConnection(object): | |
"""MongoDB Connection""" | |
def __init__(self, host='localhost', port=27017): | |
self.host = host | |
self.port = port | |
self.connection = None | |
def __enter__(self): | |
self.connection = MongoClient(self.host, self.port) |
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 nltk | |
nltk.download('omw-1.4') | |
nltk.download('punkt') | |
from nltk.stem import PorterStemmer | |
from nltk.stem import LancasterStemmer | |
from nltk.stem import WordNetLemmatizer | |
wordnet_lemmatizer = WordNetLemmatizer() | |
import os |
OlderNewer