print('') print('') print('') print('############################################') print('# Microformats Parsing Example #') print('############################################') print('') print('') print('Processing url: ', demo_url) print('') response = alchemyapi.microformats('url',demo_url) if response['status'] == 'OK': print('## Response Object ##') print(json.dumps(response, indent=4)) print('') print('## Microformats ##') for microformat in response['microformats']: print('Field: ', microformat['field'].encode('utf-8')) print('Data: ', microformat['data']) print('') else: print('Error in microformats parsing call: ', response['statusInfo'])
#Feeds print('Checking feeds . . . ') response = alchemyapi.feeds('text', test_text); assert(response['status'] == 'ERROR') #only works for html and url content response = alchemyapi.feeds('html', test_html, {'url':'test'}); assert(response['status'] == 'OK') response = alchemyapi.feeds('url', test_url); assert(response['status'] == 'OK') print('Feed tests complete!') print('') #Microformats print('Checking microformats . . . ') response = alchemyapi.microformats('text', test_text); assert(response['status'] == 'ERROR') #only works for html and url content response = alchemyapi.microformats('html', test_html, {'url':'test'}); assert(response['status'] == 'OK') response = alchemyapi.microformats('url', test_url); assert(response['status'] == 'OK') print('Microformat tests complete!') print('') print('') print('**** All tests complete! ****')
assert (response['status'] == 'OK') response = alchemyapi.category('random', test_url) assert (response['status'] == 'ERROR') #invalid flavor print('Category tests complete!') print('') #Feeds print('Checking feeds . . . ') response = alchemyapi.feeds('text', test_text) assert (response['status'] == 'ERROR') #only works for html and url content response = alchemyapi.feeds('html', test_html, {'url': 'test'}) assert (response['status'] == 'OK') response = alchemyapi.feeds('url', test_url) assert (response['status'] == 'OK') print('Feed tests complete!') print('') #Microformats print('Checking microformats . . . ') response = alchemyapi.microformats('text', test_text) assert (response['status'] == 'ERROR') #only works for html and url content response = alchemyapi.microformats('html', test_html, {'url': 'test'}) assert (response['status'] == 'OK') response = alchemyapi.microformats('url', test_url) assert (response['status'] == 'OK') print('Microformat tests complete!') print('') print('') print('**** All tests complete! ****')
wait = raw_input('press enter to continue') print('') print('') print('') print('############################################') print('# Microformats Parsing Example #') print('############################################') print('') print('') print('Processing url: ', demo_url) print('') response = alchemyapi.microformats('url', demo_url) if response['status'] == 'OK': print('## Response Object ##') print(json.dumps(response, indent=4)) print('') print('## Microformats ##') for microformat in response['microformats']: print('Field: ', microformat['field'].encode('utf-8')) print('Data: ', microformat['data']) print('') else: print('Error in microformats parsing call: ', response['statusInfo'])
print("") print("") print("") print("") print("############################################") print("# Microformats Parsing Example #") print("############################################") print("") print("") print("Processing url: ", demo_url) print("") response = alchemyapi.microformats("url", demo_url) if response["status"] == "OK": print("## Response Object ##") print(json.dumps(response, indent=4)) print("") print("## Microformats ##") for microformat in response["microformats"]: print("Field: ", microformat["field"].encode("utf-8")) print("Data: ", microformat["data"]) print("") else: print("Error in microformats parsing call: ", response["statusInfo"])