Skip to content

Instantly share code, notes, and snippets.

@jspalink
Last active March 30, 2016 15:14
Show Gist options
  • Save jspalink/bb1007bb7135ad98cf58f3f3a40180e3 to your computer and use it in GitHub Desktop.
Save jspalink/bb1007bb7135ad98cf58f3f3a40180e3 to your computer and use it in GitHub Desktop.
Example of how to use econtext-api-python-client to quickly classify social content
import requests
from econtextclient.classify.social import Social
session = requests.Session()
session.auth = (username, password)
session.headers.update({'Content-type':'application/json'})
tweets = [
"How to Optimize Your Content for Google's Featured Snippet Box http://hubs.ly/H02vJnW0 #SEO "
"SEO & Content Marketing Expert. I Tweet Industry News That Is Actually Worth Reading!"
"13 Super-Easy Ways to Immediately Improve Your SEO http://ow.ly/ZZjiN #SEO "
"Why Portugal should be more than a sidenote on your itinerary for Spain: "
"Leveraging #SocialMedia for Local #SEO - http://selnd.com/1Rx4XIK "
]
classify = Social(session)
classify.data = {"social":tweets}
response = classify.classify(True).retrieve_results()
for category in response['categories'].values():
print("* "+category['name'])
* Content Marketing
* Search Engine Optimization
* Search Engine Optimization Service Providers
* Social Media
* Twitter
* Google
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment