def joinAllThreads(resultObjectsDict):
    for key in resultObjectsDict:
        currentThread = 0
        for thread in resultObjectsDict[key]['threads']:
            currentThread += 1
            thread.join()
            roverLogOnBothConsoleAndFile.info("Joined " + key + " thread: " + str(currentThread))
def joinAllThreads(resultObjectsDict):
    for key in resultObjectsDict:
        currentThread = 0
        for thread in resultObjectsDict[key]['threads']:
            currentThread += 1
            thread.join()
            roverLogOnBothConsoleAndFile.info("Joined " + key + " thread: " +
                                              str(currentThread))
def getGooglePlaces(lattitude, longitude, radius, searchString, googlePlaces,
                    googleThreadCount):
    roverLogOnBothConsoleAndFile.info("Google thread " +
                                      str(googleThreadCount) +
                                      " started execution")
    payload = getURLPayloadForGoogleAPICall(lattitude, longitude, radius,
                                            searchString)
    response = requests.get(urlMain, params=payload)
    parseGoogleResponseJSONAndUpdateGooglePlaces(response.text, googlePlaces)
    roverLogOnBothConsoleAndFile.info("Google thread " +
                                      str(googleThreadCount) +
                                      " finished execution")
Example #4
0
def getYelpPlaces(lattitude, longitude, searchString, radius, yelpPlaces, yelpThreadCount):
    roverLogOnBothConsoleAndFile.info("Yelp thread: " + str(yelpThreadCount) + " stated execution")
    payload = getURLPayloadForYelpAPICall(lattitude, longitude, searchString, radius)
    consumer_key = CONSUMER_KEY
    consumer_secret = CONSUMER_SECRET
    token = TOKEN_KEY
    token_secret = TOKEN_SECRET
    session = rauth.OAuth1Session(
      consumer_key = consumer_key
      ,consumer_secret = consumer_secret
      ,access_token = token
      ,access_token_secret = token_secret)
    request = session.get("http://api.yelp.com/v2/search",params=payload)
    #Transforms the JSON API response into a Python dictionary
    data = request.json()
    session.close()
    parseYelpResponseJSONAndUpdateYelpPlaces(data, yelpPlaces)
    roverLogOnBothConsoleAndFile.info("Yelp thread: " + str(yelpThreadCount) + " finished execution")
Example #5
0
def getYelpPlaces(lattitude, longitude, searchString, radius, yelpPlaces,
                  yelpThreadCount):
    roverLogOnBothConsoleAndFile.info("Yelp thread: " + str(yelpThreadCount) +
                                      " stated execution")
    payload = getURLPayloadForYelpAPICall(lattitude, longitude, searchString,
                                          radius)
    consumer_key = CONSUMER_KEY
    consumer_secret = CONSUMER_SECRET
    token = TOKEN_KEY
    token_secret = TOKEN_SECRET
    session = rauth.OAuth1Session(consumer_key=consumer_key,
                                  consumer_secret=consumer_secret,
                                  access_token=token,
                                  access_token_secret=token_secret)
    request = session.get("http://api.yelp.com/v2/search", params=payload)
    #Transforms the JSON API response into a Python dictionary
    data = request.json()
    session.close()
    parseYelpResponseJSONAndUpdateYelpPlaces(data, yelpPlaces)
    roverLogOnBothConsoleAndFile.info("Yelp thread: " + str(yelpThreadCount) +
                                      " finished execution")
def getGooglePlaces(lattitude, longitude, radius, searchString, googlePlaces, googleThreadCount):
    roverLogOnBothConsoleAndFile.info("Google thread " + str(googleThreadCount) + " started execution")
    payload = getURLPayloadForGoogleAPICall(lattitude, longitude, radius, searchString)
    response = requests.get(urlMain, params=payload)
    parseGoogleResponseJSONAndUpdateGooglePlaces(response.text, googlePlaces)
    roverLogOnBothConsoleAndFile.info("Google thread " + str(googleThreadCount) + " finished execution")