mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-01-12 22:43:42 +08:00
updated readme, misc updates
This commit is contained in:
committed by
Muneeb Ali
parent
0d3b2d6643
commit
3e5a44b2ce
@@ -53,3 +53,67 @@ the current version we're using is *0.90.2*. Download from:
|
||||
> python scopesearch/create_search_index.py --create_company_index
|
||||
|
||||
We'll simplify these steps in an upcoming release. We assume that both MongoDB and Elastic Search is running on the server.
|
||||
|
||||
-----------------------------------------------------------------------------------------------------
|
||||
|
||||
Notes: 14, April, 2014:
|
||||
|
||||
Project dependecies:
|
||||
|
||||
requirements.txt files has been updated and contains all the project requriements.
|
||||
|
||||
Notes:
|
||||
before installing pylimbmc make sure libmemcache is installed:
|
||||
|
||||
|
||||
brew install libmemcached
|
||||
pip install pylibmc
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
Create Index: python create_search_index.py --create_index
|
||||
|
||||
|
||||
Note: Make sure mongodb and elastic search are running before creating index
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
API usage:
|
||||
----------------------------------------------
|
||||
|
||||
1) Generate Developer key:
|
||||
|
||||
|
||||
syntax: <machine_ip:port>/v1/gen_developer_key/<developer_id>
|
||||
|
||||
Example: curl -i http://localhost:5003/v1/gen_developer_key/asjad
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
2) Search API
|
||||
----------------------------------------------
|
||||
|
||||
syntax: <machine_ip>/v1/people-search/<developer_id>/<access_token>?keywords='<keywords>'
|
||||
e.g:
|
||||
http://localhost:5003/v1/people-search/asjad/a0fe2f40415f7451c4ba2eae7da963d5?keywords=ryan
|
||||
|
||||
|
||||
http://localhost:5003/v1/people-search/asjad/a0fe2f40415f7451c4ba2eae7da963d5?keywords=1G6pazv8zjWKBWouXVgHHvgmRmSm7JmH3S
|
||||
keywords can accept username, twitter handle and btc
|
||||
|
||||
* Experimental *:
|
||||
http://localhost:5003/v1/people-search/asjad/a0fe2f40415f7451c4ba2eae7da963d5?twitter = muneeb
|
||||
http://localhost:5003/v1/people-search/asjad/a0fe2f40415f7451c4ba2eae7da963d5?btc = muneeb
|
||||
|
||||
----------------------------------------------
|
||||
3) Profile API
|
||||
----------------------------------------------
|
||||
|
||||
Syntax: <machine_ip>/v1/people/id=<onename_id>
|
||||
e.g
|
||||
curl -i http://localhost:5003/v1/people/id=muneeb
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
from flask import request, jsonify, Flask
|
||||
from search_api import get_people
|
||||
from flask import make_response
|
||||
from flask import make_response,Response
|
||||
import json
|
||||
from bson import json_util
|
||||
from helpers import *
|
||||
@@ -73,7 +73,14 @@ def search_people(developer_id,access_token):
|
||||
#---------------------------------------------
|
||||
@app.route('/v1/people/id=<onename_id>', methods = ['GET'])
|
||||
def get_onename_profile(onename_id):
|
||||
return json.dumps(query_people_database(onename_id))
|
||||
|
||||
profile = query_people_database(onename_id)
|
||||
|
||||
if profile is not None:
|
||||
return json.dumps(profile)
|
||||
|
||||
else:
|
||||
return make_response(jsonify( { 'error': 'profile not found' } ), 401)
|
||||
|
||||
#----------------------untested--not working----------------------
|
||||
@app.route('/v1/people/url=<onename_profile_url>', methods = ['GET'])
|
||||
@@ -89,13 +96,15 @@ def query_people_database(onename_id,limit_results=DEFAULT_LIMIT):
|
||||
nodes = db.nodes
|
||||
|
||||
onename_profile = nodes.find_one({"name": 'u/' + onename_id})
|
||||
|
||||
#onename_profile = nodes.find({'value': {"$elemMatch": {"website":"http://muneebali.com"} }})
|
||||
if onename_profile is None:
|
||||
return None
|
||||
|
||||
profile_details = json.loads(onename_profile['value'])
|
||||
else:
|
||||
profile_details = json.loads(onename_profile['value'])
|
||||
|
||||
#TODO: add error handling
|
||||
return onename_profile
|
||||
return profile_details
|
||||
|
||||
#custom error handling to return JSON error msgs
|
||||
#----------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user