コード例 #1
0
def address_complete_ajax():
    """return the full address of the client's request in ajax"""
    value = request.form.get('data')
    address_converted = WorkString(value)
    address_converted = address_converted.get_address_without_punctuation()
    api_geocode = DataApi(address_converted)
    address_complete = api_geocode.get_address_complete()
    return address_complete
コード例 #2
0
def longitude_ajax():
    """return the longitude of the client's request in ajax"""
    value = request.form.get('data')
    address_converted = WorkString(value)
    address_converted = address_converted.get_address_without_punctuation()
    api_geocode = DataApi(address_converted)
    longitude = api_geocode.get_longitude()
    print(longitude)
    return longitude
コード例 #3
0
def wikipedia_url():
    """return the url's article of the client's request in ajax"""
    value = request.form.get('data')
    address_converted = WorkString(value)
    address_converted = address_converted.get_address_selected()
    item_wikipedia = DataApiWikipedia()
    title_wikipedia = item_wikipedia.get_title_page_wikipedia\
        (address_converted)
    url_wikipedia = item_wikipedia.get_url_page_wikipedia(title_wikipedia)
    return url_wikipedia
コード例 #4
0
def wikipedia_article():
    """return the wikipedia's article of the client's request in ajax"""
    value = request.form.get('data')
    address_converted = WorkString(value)
    address_converted = address_converted.get_address_selected()
    item_wikipedia = DataApiWikipedia()
    title_wikipedia = item_wikipedia.get_title_page_wikipedia\
        (address_converted)
    extract_wikipedia = item_wikipedia.get_page_extract(title_wikipedia)
    print(address_converted)
    print(title_wikipedia)
    return extract_wikipedia
コード例 #5
0
def test_get_address_selected():
    """test if we retrieve user data without stop words"""
    address = WorkString(SENTENCE)
    assert address.get_address_selected() == SENTENCE_ADDRESS_SELECTED
コード例 #6
0
def test_get_address_without_punctuation():
    """test if we retrieve user data without punctuation"""
    address = WorkString(SENTENCE)
    assert address.get_address_without_punctuation() == \
           SENTENCE_WITHOUT_PUNCTUATION
コード例 #7
0
def test_get_sentence():
    """test if we retrieve user data"""
    address = WorkString(SENTENCE)
    assert address.data == SENTENCE