PY-Into 7
newspaper
newspaper is library that we will use to pull data from media sites. Follow the link, read and try the intro examples.
With this library we will be pulling the data in to a variable for parsing (searching) that will later be analyzed for some criteria.
Now that you have experimented with news paper, build a function that calls it and has an output.
google finance
How to capture real time stock data?We can use an API (application program interface) that Google created to do pulls.
from googlefinance import getQuotes
import json
print(json.dumps(getQuotes('AAPL'), indent=2))
Lets try the above code out in pycharm.
This code is very simple, and static but by using the elements that we have learned so far:
- function creation
- looping
- list creation
- key/value pair
Extending the code to be more dynamic/flexible and useful.