Skip to content

Instantly share code, notes, and snippets.

@lastday154
Created November 25, 2017 00:25
Show Gist options
  • Select an option

  • Save lastday154/e0c645a2e08631b498b0b36fa262ecd3 to your computer and use it in GitHub Desktop.

Select an option

Save lastday154/e0c645a2e08631b498b0b36fa262ecd3 to your computer and use it in GitHub Desktop.
HTTP Request python
import requests
API_URL = 'https://en.wikipedia.org/w/api.php?action=parse&section=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