This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from yahoo_finance import Share | |
def get_stock_price_history(share_code, start_date, end_date): | |
""" | |
start_date/end_date are of format: YYYY-MM-DD | |
""" | |
stock = Share(share_code) | |
sopen = stock.get_open() | |
if not sopen: | |
print "Wrong stock code" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.path import Path | |
from matplotlib.spines import Spine | |
from matplotlib.projections.polar import PolarAxes | |
from matplotlib.projections import register_projection | |
def radar_factory(num_vars, frame='circle'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
endpoint = "http://gateway-a.watsonplatform.net/calls/text/TextGetRankedTaxonomy" | |
def get_topics(text): | |
data = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'text': text | |
} | |
headers = {'content-type': 'application/x-www-form-urlencoded'} | |
r = requests.post(endpoint, data=data, headers=headers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
spotify_endpoint = "https://api.spotify.com/v1/" | |
def get_tracks(album_id): | |
tracks = [] | |
url = spotify_endpoint + 'albums/%s/tracks' % album_id | |
while url: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
spotify_endpoint = "https://api.spotify.com/v1/" | |
def get_albums(artist_id): | |
albums = [] | |
params = {'album_type': 'album'} | |
url = spotify_endpoint + 'artists/%s/albums' % artist_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
spotify_endpoint = "https://api.spotify.com/v1/" | |
def get_artist_id(search_term): | |
""" | |
I'm feeling lucky search for artist_id | |
""" | |
params = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
creds = { | |
"url": "https://gateway.watsonplatform.net/tone-analyzer-beta/api", | |
"password": "your_password", | |
"username": "your_username" | |
} | |
def get_tone(text): | |
endpoint = "https://gateway.watsonplatform.net/tone-analyzer-beta/api/v3/tone" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib | |
import requests | |
from pprint import pprint | |
from os.path import expanduser | |
headers = { | |
'Content-Type': 'application/octet-stream', | |
'Ocp-Apim-Subscription-Key': 'your-api-key', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib | |
import requests | |
from pprint import pprint | |
headers = { | |
'Content-Type': 'application/json', | |
'Ocp-Apim-Subscription-Key': 'your-api-key', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
endpoint = "http://gateway-a.watsonplatform.net/calls/url/URLGetRankedTaxonomy" | |
parameters = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'url': 'https://blog.vellumatlanta.com/2016/05/04/apple-stole-my-music-no-seriously/' | |
} | |
r = requests.get(endpoint, params=parameters) |
NewerOlder