コード例 #1
0
ファイル: tumblr.py プロジェクト: jjmalina/newspics
def tumblr_tag_querystring(query):
    """
    Constructs a URL for a call to Tumblr's API
    """
    query = normalize_query(query)
    endpoint = 'http://api.tumblr.com/v2/'
    api_call = 'tagged?tag=%s&api_key=%s' % (query, tumblr_key)
    return endpoint + api_call
コード例 #2
0
ファイル: parsely.py プロジェクト: jjmalina/newspics
def parsely_querystring(query, amount):
    """
    Constructs a querystring to make an http request to Parse.ly
    Uses a query and amount of results to return
    """
    query = normalize_query(query)
    endpoint = "http://simon.parsely.com:8983/solr/goldindex2/select/"
    api_call = "?wt=json&q=%s&start=0&rows=%i&sort=pub_date+desc" % (query, amount)
    querystring = endpoint + api_call
    return querystring