コード例 #1
0
ファイル: test.py プロジェクト: fabriciops/crud-python-api
    def testUpdateRequest(self, id, nome, img):

        dataUser = [{"id": id, "name": nome, "img": img}]

        responseProductCreate = requests.put('http://127.0.0.1:5000/update',
                                             json=dataUser)

        if (responseProductCreate
                and responseProductCreate.status_code == 200):

            responseProductCreate = requests.put(
                'http://127.0.0.1:5000/update', json=dataUser)

            if (responseProductCreate
                    and responseProductCreate.status_code == 200):
                return responseProductCreate

            else:

                response = make_response(
                    jsonify({"message": "Product is not created"}, 403))
                return response

        else:

            response = make_response(
                jsonify({"message": "Product is not created"}, 403))
            return response
コード例 #2
0
def post_data(Email_Id):
    now = datetime.datetime.now()
    localtime = (now.strftime("%x"))
    if os.path.isfile("feeling_share.json"):
        #The best way to do this is using the withstatement its work for file handling.
        #This ensures that the file is closed when the block inside with is exited.
        with open("feeling_share.json") as file:
            read_file = file.read()
            file_store = json.loads(read_file)
        newfeeling = {
            "Name": request.json["Name"],
            "Feeling": request.json["Feeling"]
            # "Feeling_express":request.json["Feeling_express"]
        }

        if Email_Id not in file_store:
            file_store[Email_Id] = {}

        if localtime in file_store[Email_Id]:
            file_store[Email_Id][localtime].append(newfeeling)
        else:
            file_store[Email_Id][localtime] = []

        file_store[Email_Id][localtime].append(newfeeling)
        with open("feeling_share.json", "w") as file:
            json.dump(file_store, file, indent=4, sort_key=True)
        return jsonify(newfeeling)
    return jsonify({"Errors": "No file"})
コード例 #3
0
ファイル: api.py プロジェクト: ucakmak02/rest_api
    def post(self, username, oldPassword, password):
        cur = mysql.connection.cursor()
        cur.execute("SELECT user_password FROM user WHERE username = %s",
                    [username])
        data = cur.fetchall()
        json_data = list(data)

        #Control Username
        if data == ():
            postContent = jsonify(message="Wrong Username")

        else:
            password_data = json_data[0]['user_password']

            #Control Password
            if oldPassword != password_data:
                postContent = jsonify(message="Wrong Password")

            else:
                print(username, oldPassword, password)
                cur.execute(
                    "UPDATE user SET user_password=%s WHERE username=%s;",
                    [password, username])
                # Commit to DB
                mysql.connection.commit()
                postContent = jsonify(message="Success")
        # Close connection
        cur.close()
        return postContent
コード例 #4
0
def userlist():
    if request.method == 'get':
        return users
    if request.method == 'delete':
        age = request.args.get('age')
        name = request.args.get('name')
        with open('/tmp/data.txt', 'r') as f:
            data = f.read()
            records = JSONTag.loads(data, age)
            for record in records:
                if record['name'] == name:
                    return jsonify(record)
            return jsonify({'error': 'data not found'})
    if request.method == 'post':

        def update_record():
            record = json.loads(request.data)
            new_records = []
            with open('/tmp/data.txt', 'r') as f:
                data = f.read()
                records = json.loads(data)
            for r in records:
                if r['name'] == record['name']:
                    r['email'] = record['email']
                new_records.append(r)
            with open('/tmp/data.txt', 'w') as f:
                f.write(json.dumps(new_records, indent=2))
            return jsonify(record)
コード例 #5
0
def predict_api():
    if request.method == 'POST':
        data = request.get_json()
        loan_amnt = int(data.form['loan_amnt'])
        term = int(data.form['term'])
        int_rate = float(data.form['int_rate'])
        emp_length = float(data.form['emp_length'])
        home_ownership = int(data.form['home_ownership'])
        annual_inc = float(data.form['annual_inc'])
        annual_inc = np.log(annual_inc)
        purpose = int(data.form['purpose'])
        addr_state = int(data.form['addr_state'])
        dti = float(data.form['dti'])
        delinq_2yrs = float(data.form['delinq_2yrs'])
        revol_util = float(data.form['revol_util'])
        total_acc = float(data.form['total_acc'])
        longest_credit_length = float(data.form['longest_credit_length'])
        verification_status = int(data.form['verification_status'])
        prediction = model.predict([[
            loan_amnt, term, int_rate, emp_length, home_ownership, annual_inc,
            purpose, addr_state, dti, delinq_2yrs, revol_util, total_acc,
            longest_credit_length, verification_status
        ]])
        output = prediction[0]
        if output == 0:
            return jsonify("It is not a loan Defaulter")
        return jsonify("It is loan Defaulter")
コード例 #6
0
def predict():
    if request.method == 'POST':
        try:
            # Get data for prediction (Parse data as JSON)
            json_data = request.get_json()

            # Raise an Error if there are values not entered
            if not all(k in json_data for k in ["hp", "age", "km", "model"]):
                raise ValueError("Not enough data to make a prediction!")

            # Create a DataFrame from JSON
            df = pd.DataFrame.from_dict([json_data], orient='columns')

            # Create dummy variables and persist features
            df = pd.get_dummies(df).reindex(columns=features, fill_value=0)
            # Note that if a column name (value) in JSON is wrong,
            # The relevant column is filled with '0'

            # Predict the target
            prediction = list(model_rf.predict(df))

            # Return the result in JSON format
            return jsonify({"prediction": prediction})

        except:
            return jsonify({'trace': traceback.format_exc()})
    else:
        print("Nothing posted!")
        return "Nothing posted!"
コード例 #7
0
    def decoated(*args, **kwargs):
        token = request.args.get('token')
        if not token:
            return jsonify({'message': 'missing token!!'})

        try:
            data = jwt.decode(token, app.config['secretkey'])
        except:
            return jsonify({'message': 'invaild token!'})
        return f(*args, **kwargs)
コード例 #8
0
 def get(self, user_id):
     name = request.args.get('name')
     age = request.args.get('age')
     with open('/tmp/data.txt', 'r') as f:
         data = f.read()
         records = JSONTag.loads(data)
         for record in records:
             if record['name'] == name:
                 return jsonify(record)
         return jsonify({'error': 'data not found'})
コード例 #9
0
def justice_league_character(real_name):
    """Fetch the Justice League character whose real_name matches
       the path variable supplied by the user, or a 404 if not."""

    canonicalized = real_name.replace(" ", "").lower()
    for character in justice_league_members:
        search_term = character["real_name"].replace(" ", "").lower()

        if search_term == canonicalized:
            return jsonify(character)

    return jsonify({"error": f"Character with real_name {real_name} not found."}), 404
コード例 #10
0
def off():

  if ip is None:
      return jsonify({'status': 'error', 'message': 'no bulb found'})

  bulb = Bulb(ip)

  try:
      bulb.turn_off()
  except:
      return jsonify({'status': 'error', 'message': 'could not turn off bulb'})

  return jsonify({'status': 'OK'})
コード例 #11
0
ファイル: views.py プロジェクト: MoniqueMon/info3180-lab7
def upload():
    uploadfile = UploadForm()
    if uploadfile.validae_on_submit():
        dsc = uploadfile.dscp.data
        fl = uploadfile.iamg.data
        fname = secure_filename(fl.filename)
        fl.save(app.config['UPLOAD_FOLDER'] + fname)
        flash('File Saved', 'success')
        return jsonify({
            "message": "File Upload Successful",
            "filename": fname,
            "description": dsc
        })
    else:
        return jsonify({"errors": form_errors(uploadfile)})
コード例 #12
0
def date_temps_range():
    start_date = start
    end_date = end

    temp_stats_list = start_to_end(start_date, end_date)

    return jsonify(temp_stats_list)
コード例 #13
0
def date_temps_start():
    start_date = start
    end_date = '2017-08-23'

    temp_stats_list = start_to_end(start_date, end_date)

    return jsonify(temp_stats_list)
コード例 #14
0
def login():
    email = flask.request.form.get('email')
    password = mutations.encryption_md5(flask.request.form.get('password'))
    if (not email or not password):
        return jsonify(config.falseReturn('', '用户名和密码不能为空'))
    else:
        return Auth.authenticate(Auth, email, password)
コード例 #15
0
    def logout(self, username):
        try:
            myCommand = "SELECT loggedIn FROM Admin WHERE Username = "******"'" + username + "'"
            self.mycursor.execute(myCommand)
        except:
            return jsonify({'Error': 'Admin does not exist!'})

        for x in self.mycursor:
            loggedIn = x[0]

        if loggedIn == 1:
            myCommand = "UPDATE Admin SET loggedIn = 0 WHERE Username = "******"'" + username + "'"
            self.mycursor.execute(myCommand)
            self.db.commit()
        else:
            return jsonify({'Error': 'Admin already logged out!'})
コード例 #16
0
ファイル: app.py プロジェクト: xmartin46/shroomish
def predict():
    #print('Recibo mierdas')
    if 'Content-Type' not in request.headers or 'multipart/form-data' not in request.headers[
            'Content-Type']:
        return "Content-Type wasn't 'multipart/form-data'", 400
    print(request)
    try:
        print(request.files)
        formFile = request.files['file']
    except:
        return "FormData didn't include a file", 400
    try:
        print(formFile)
        img = np.array(resize(formFile))
        print(img.shape)
    except:
        return 'Unable to read the image file', 400
    img = np.expand_dims(img, axis=0)
    img = preprocess_input(img)
    #print("Let's start predicting")
    value = model.predict(img)
    K.clear_session()
    prediction = output[np.argmax(value)] if np.max(value) > TH else None
    #print("Value predicted: {}".format(prediction))
    return jsonify({"prediction": prediction})
コード例 #17
0
def disco (ip, 120):


    if ip is None:
        return jsonify({'status': 'error', 'message': 'no bulb found'})

    bulb = Bulb(ip)
コード例 #18
0
def your_stock():

	'''
		Now return the connection object and then
		return the data for a specific user for the
		stocks the user actually purchased.
	'''

	mysql_connection_obj.execute("SELECT id FROM boughtstocks")

	
	'''
		Here we then select and create the object for
		a particular user and its related data for 
		all, now the fetchdata method pulls the data
	'''

	fetchonestock = mysql_connection_obj.fetchone()

	'''
		Throw the response in the json format
		using the JSONIFY method specified in 
		the Json library
	'''

	return jsonify(fetchonestock)
コード例 #19
0
ファイル: api.py プロジェクト: ucakmak02/rest_api
    def post(self):
        json_data = request.get_json(force=True)
        user_id = json_data['userid']
        status = json_data['pictureStatus']
        socketio.emit("{}".format(user_id), {"message": status})

        return jsonify(message=status + "Status is Receipt")
コード例 #20
0
def date_prcp_12mths():
    prcp_12 = session.query(Measurements.date, Measurements.prcp)\
    .filter(or_(Measurements.date.like('2017-%'), # all records from 2017
            Measurements.date.like('2016-1%'), # from oct to dec of 2016
            Measurements.date.like('2016-09%'), # from sep 2016
            Measurements.date.like('2016-08-3%'), # from aug 30 and 31 2016
            Measurements.date.like('2016-08-24'), # the rest added manually
            Measurements.date.like('2016-08-25'),
            Measurements.date.like('2016-08-26'),
            Measurements.date.like('2016-08-27'),
            Measurements.date.like('2016-08-28'),
            Measurements.date.like('2016-08-29'))
       )

    date_list = []
    prcp_list = []

    for each in prcp_12.all():

        date_list.append(each[0])
        prcp_list.append(each[1])

    prcp_dict = {'date': date_list, 'prcp': prcp_list}

    return jsonify(prcp_dict)
コード例 #21
0
def insertInvertory():
    env = request.args.get('env')
    code = request.args.get('code')
    datenow = time.strftime("%Y-%m-%d")

    db = DBUtils(env)
    selectsql = "SELECT a.id propertyId,c.id roomTypeId,c.code RoomType FROM info.property AS a,info.room_class AS b,info.room_type AS c WHERE a.code ='" + code + "' AND b.property_id =a.id AND c.room_class_id =b.id"
    result = db.dbSelect(selectsql)

    for i in range(len(result)):
        property_id = str(result[i]['propertyId'])
        delsql = "DELETE FROM inv.`property_inventory_detail` WHERE property_id ='" + property_id + "' AND effective_date >='" + str(
            datenow) + "'"
        dbs = DBUtils(env)
        resutls = dbs.dbExcute(delsql)
        print("the resutls is:", resutls)
        print(delsql)

    for i in range(len(result)):
        property_id = str(result[i]['propertyId'])
        relation_id = str(result[i]['roomTypeId'])
        insertsql = "INSERT INTO inv.`property_inventory_detail`(property_id,relation_type,relation_id,effective_date,original,consume,STATUS,create_time,update_time,deducted,out_order,non_deducted)VALUES(" + property_id + ",4," + relation_id + ",DATE_ADD('" + str(
            datenow
        ) + "',INTERVAL 0 DAY),100,0,1,NOW(),NOW(),0,0,0),(" + property_id + ",4," + relation_id + ",DATE_ADD('" + str(
            datenow
        ) + "',INTERVAL 1 DAY),100,0,1,NOW(),NOW(),0,0,0),(" + property_id + ",4," + relation_id + ",DATE_ADD('" + str(
            datenow) + "',INTERVAL 90 DAY),100,0,1,NOW(),NOW(),0,0,0);"
        dbs = DBUtils(env)
        resutls = dbs.dbExcute(insertsql)
        print(resutls)
        print(insertsql)
    return jsonify("<p color='green'>{status:200,msg:it's success!!!}</p>")
コード例 #22
0
def pasco_uptime():
    L1_S6_date = PASCO_L1_S6_UPTIME.iloc[:, 0].tolist()
    L1_S6 = PASCO_L1_S6_UPTIME.iloc[:, 1].tolist()
    L1_S7_date = PASCO_L1_S7_UPTIME.iloc[:, 0].tolist()
    L1_S7 = PASCO_L1_S7_UPTIME.iloc[:, 1].tolist()
    L1_S8_date = PASCO_L1_S8_UPTIME.iloc[:, 0].tolist()
    L1_S8 = PASCO_L1_S8_UPTIME.iloc[:, 1].tolist()
    L1_S9_date = PASCO_L1_S9_UPTIME.iloc[:, 0].tolist()
    L1_S9 = PASCO_L1_S9_UPTIME.iloc[:, 1].tolist()
    L1_S10_date = PASCO_L1_S10_UPTIME.iloc[:, 0].tolist()
    L1_S10 = PASCO_L1_S10_UPTIME.iloc[:, 1].tolist()
    L2_S1_date = PASCO_L2_S1_UPTIME.iloc[:, 0].tolist()
    L2_S1 = PASCO_L2_S1_UPTIME.iloc[:, 1].tolist()
    L2_S2_date = PASCO_L2_S1_UPTIME.iloc[:, 0].tolist()
    L2_S2 = PASCO_L2_S1_UPTIME.iloc[:, 1].tolist()
    L2_S3_date = PASCO_L2_S1_UPTIME.iloc[:, 0].tolist()
    L2_S3 = PASCO_L2_S1_UPTIME.iloc[:, 1].tolist()
    L2_S4_date = PASCO_L2_S1_UPTIME.iloc[:, 0].tolist()
    L2_S4 = PASCO_L2_S1_UPTIME.iloc[:, 1].tolist()
    L2_S5_date = PASCO_L2_S1_UPTIME.iloc[:, 0].tolist()
    L2_S5 = PASCO_L2_S1_UPTIME.iloc[:, 1].tolist()
    return jsonify({'Pasco Uptime': {'Pasco L1 S6 Date': L1_S6_date, 'Pasco L1 S6 Uptime': L1_S6, 'Pasco L1 S7 Date': L1_S7_date, 'Pasco L1 S7 Uptime': L1_S7,
    'Pasco L1 S8 Date': L1_S8_date, 'Pasco L1 S8 Uptime': L1_S8, 'Pasco L1 S9 Date': L1_S9_date, 'Pasco L1 S9 Uptime': L1_S9,
    'Pasco L1 S10 Date': L1_S10_date, 'Pasco L1 S10 Uptime': L1_S10, 'Pasco L2 S1 Date': L2_S1_date, 'Pasco L2 S1 Uptime': L2_S1,
    'Pasco L2 S2 Date': L2_S2_date, 'Pasco L2 S2 Uptime': L2_S2, 'Pasco L2 S3 Date': L2_S3_date, 'Pasco L2 S3 Uptime': L2_S3,
    'Pasco L2 S4 Date': L2_S4_date, 'Pasco L2 S4 Uptime': L2_S4, 'Pasco L2 S5 Date': L2_S5_date, 'Pasco L2 S5 Uptime': L2_S5,}})
コード例 #23
0
def route_delete_todo(id):
    global todos
    el = [todo for todo in todos if todo['id'] == id]
    if len(el) == 0:
        abort(404)
    todos = [todo for todo in todos if todo['id'] != id]
    return jsonify(el[0])
コード例 #24
0
ファイル: api.py プロジェクト: SSre/EKS
def get_group_by():
    # sample http://192.168.20.156:8090/aws_ce/groupby?start=2018-07-10&end=2018-07-17
    start_date = request.args.get('start')
    end_date = request.args.get('end')
    account_name = request.args.get('account_name')
    resp = api_handler.get_group_by(start_date, end_date, account_name)
    return jsonify(resp)
コード例 #25
0
def mine():
    # We run the proof of work algorithm to get the next proof...
    last_block = blockDAG.last_block
    last_proof = last_block['proof']
    proof = blockDAG.proof_of_work(last_proof)

    # We must receive a reward for finding the proof.
    # The sender is "0" to signify that this node has mined a new coin.
    blockDAG.new_transaction(
        sender="0",
        recipient=node_identifier,
        amount=1,
    )

    # Forge the new Block by adding it to the chain
    previous_hash = blockDAG.hash(last_block)
    block = blockDAG.create_block(proof, previous_hash)

    response = {
        'message': "New Block Forged",
        'index': block['index'],
        'transactions': block['transactions'],
        'proof': block['proof'],
        'previous_hash': block['previous_hash'],
    }
    return jsonify(response), 200
コード例 #26
0
def hello():
    sentence = "Mixhael jackson potato"
    tagged_sent = pos_tag(sentence.split())
    propernouns = [word for word, pos in tagged_sent if pos == 'NNP']
    prediction = list(propernouns)

    return jsonify({'propernouns': propernouns})
コード例 #27
0
ファイル: app.py プロジェクト: nhok1053/TestAPI
def add_post():
    args = request.form
    title = args["title"]
    content = args["content"]
    p = Post(title=title,content=content)
    p.save()
    return jsonify({"code": 1 , "message": "OK" })
コード例 #28
0
def getLargestTopicsTimelines(days, limit):
    fullObject = [{
        'name': t['name'],
        'topic': t['_id'],
        'timeline': getTimeline.byTopic(t['_id'])
    } for t in getTopics.bySize(days, limit)]
    return jsonify(fullObject)
コード例 #29
0
ファイル: api.py プロジェクト: ucakmak02/rest_api
def send_images(cust_id):
    # checks if customer folder exists
    if not os.path.exists(os.path.join(path, cust_id)):
        os.makedirs(os.path.join(path, cust_id))
    # get the current number of images on customer folder
    number = 1
    images = request.files.getlist("images")
    data_message = {}
    for img in images:
        img.save(os.path.join(path, cust_id, f"{number}.jpg"))
        data_message[
            f"image_{number}"] = f"http://134.119.194.237:7000/static/highstone/{number}.jpg/47f6da8f-4409-48c4-86d2-3b926f3cbf54/"
        number += 1

    #send notification
    cur = mysql.connection.cursor()
    cur.execute("SELECT token FROM user WHERE username='******'".format(cust_id))
    token = cur.fetchone()
    push_service = FCMNotification(api_key=fb_api_key)
    registration_id = str(f"{token['token']}")
    message_title = "Danger Detected!"
    message_body = "A Danger situation happened on oven. Due to this danger situation Nuriel turned off the oven. Please verify this stiuation!"
    result = push_service.notify_single_device(registration_id=registration_id,
                                               message_title=message_title,
                                               message_body=message_body,
                                               data_message=data_message)
    # 1123123/static/1.jpg
    return jsonify(message='image received.', status=200)
コード例 #30
0
ファイル: api.py プロジェクト: SSre/EKS
def get_filter():
    # http://192.168.20.156:8090/aws_ce/filter?start=2018-07-10&end=2018-07-17
    start_date = request.args.get('start')
    end_date = request.args.get('end')
    account_name = request.args.get('account_name')
    resp = api_handler.get_filter(start_date, end_date, account_name)
    return jsonify(resp)
コード例 #31
0
def led4():
    led4 = request.json['led4']
    if '1' in led4:
        os.system('python led4on_33.py')
        obj={
            'message':'Light4 On'
            }
        return json.dumps(obj)

    else:
        os.system('python led4off_33.py')
        obj={
            'message':'Light4 Off'
            }
        return json.dumps(obj)

    return make_response(jsonify({'success':'success'}), 200)
コード例 #32
0
def led5():
    led5 = request.json['led5']
    if '1' in led5:
        os.system('python led5on_35.py')
        obj={
            'message':'Light5 On'
            }
        return json.dumps(obj)

    else:
        os.system('python led5off_35.py')
        obj={
            'message':'Light5 Off'
            }
        return json.dumps(obj)
    
    return make_response(jsonify({'success':'success'}), 200)
コード例 #33
0
def led3():
    led3 = request.json['led3']
    if '1' in led3:
        os.system('python led3on_31.py')
        obj={
            'message':'Light3 On'
            }
        return json.dumps(obj)

    else:
        os.system('python led3off_31.py')
        obj={
            'message':'Light3 Off'
            }
        return json.dumps(obj)

    return make_response(jsonify({'success':'success'}), 200)
コード例 #34
0
def motor1():
    motor1 = request.json['motor1']
    if '1' in motor1:
        os.system('python motor1on_37.py')
        obj={
            'message':'Motor1 On'
            }
        return json.dumps(obj)

    else:
        os.system('python motor1off_37.py')
        obj={
            'message':'Motor1 Off'
            }
        return json.dumps(obj)

    return make_response(jsonify({'success':'success'}), 200)
コード例 #35
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getLargestTopicsTimelines(days, limit):
    return jsonify(largestTopicsTimelines(days, limit))
コード例 #36
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def cokeywords(keyword):
    return jsonify(getCoKeywords(keyword))
コード例 #37
0
ファイル: api.py プロジェクト: gt-big-data/retina-api
def getFeeds(): #Get a list of all the sources
    return jsonify(getSources.fullList())
コード例 #38
0
ファイル: api.py プロジェクト: gt-big-data/retina-api
def daterangeGraphEnt(start, end):
    return jsonify(getGraph.entGraph(start, end))
コード例 #39
0
ファイル: api.py プロジェクト: gt-big-data/retina-api
def getLargestTopicsTimelines(days, limit):
    fullObject = [{'name': t['name'], 'topic': t['_id'], 'timeline': getTimeline.byTopic(t['_id'])} for t in getTopics.bySize(days, limit)]
    return jsonify(fullObject)
コード例 #40
0
ファイル: api.py プロジェクト: gt-big-data/retina-api
def trendingKeywords():
    return jsonify(getKeywords.byTrending())
コード例 #41
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getFeeds(): #Get a list of all the sources
    return jsonify(sourceList())
コード例 #42
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getSourcesList(): #Get a list of all the sources
    return jsonify(db.qdoc.distinct('source'))
コード例 #43
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getLastHoursArticles(hours):
    return jsonify(articlesXHours(hours))
コード例 #44
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getArticleById(articleId):
    return jsonify(articleById(articleId))
コード例 #45
0
ファイル: api.py プロジェクト: jpm6/retina-api
def getTweets(delay, amount):
    return jsonify(loadTweets(delay, amount))
コード例 #46
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getTopicTimeline(topic):
    return jsonify(topicTimeline(topic))
コード例 #47
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getTopicGraph(topic):
    return jsonify(topicGraph(topic))
コード例 #48
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getSourcesTimeline(): #Get a timeline for a specific source
    return jsonify(allSourcesTimeline())
コード例 #49
0
ファイル: api.py プロジェクト: gt-big-data/retina-api
def getTopicTimeline(topic):
    return jsonify(getTimeline.byTopic(topic))
コード例 #50
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getSourceTimeline(source): #Get a timeline for a specific source
    return jsonify(sourceTimeline(source))
コード例 #51
0
ファイル: api.py プロジェクト: gt-big-data/retina-api
def getLargestTopicsEnt(days, limit):
    return jsonify(getTopics.bySize(days, limit))
コード例 #52
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getRecentFromSource(source, limit): #Get <limit> most recent articles from source <source>
    return jsonify(getArticlesFromSource(source, limit))
コード例 #53
0
ファイル: api.py プロジェクト: gt-big-data/retina-api
def daterangeGraphKw(start, end):
    return jsonify(getGraph.kwGraph(start, end))
コード例 #54
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getArticlesWithKeywords(keywords): #Get articles who share at least one keyword with one of the keywords provided in the params.
    keywords = keywords.split(',')
    return jsonify(articlesWithKeywords(keywords))
コード例 #55
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def keywordTimeline(keyword, days):
    return jsonify(getKeywordTimeline(keyword, days))
コード例 #56
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def daterangeGraph(start, end):
    return jsonify(dateRangeGraph(start, end))
コード例 #57
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getTweets(start, end):
    return jsonify(loadTweets(start, end))
コード例 #58
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def trendingKeywords():
    return jsonify(getTrendingKeywords())
コード例 #59
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getTweetsGraph():
    return jsonify(buildNodesAndEdges())
コード例 #60
0
ファイル: api.py プロジェクト: cindysunyixin/retina-api
def getRecentArticlesByPage(page, perPage=20):
    articleList = recentArticlesByPage(page, 20)
    return jsonify(articleList)