Created
November 25, 2017 00:25
-
-
Save lastday154/e0c645a2e08631b498b0b36fa262ecd3 to your computer and use it in GitHub Desktop.
HTTP Request python
This file contains hidden or 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 | |
| API_URL = 'https://en.wikipedia.org/w/api.php?action=parse§ion=0&prop=text&format=json&page=' | |
| def get(topic): | |
| r = requests.get(API_URL + topic) | |
| return r.text | |
| def getTopicCount(topic): | |
| text = get(topic) | |
| return text.count(topic) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment