Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions parseWebPage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Created in Python 3.6.5
# Justgo129
# May 10, 2018
# adapted from
'''
https://stackoverflow.com/questions/12965203/how-to-get-json-from-webpage-into-python-script
'''

import urllib.request, json

myUrl = "http://199.26.254.151:8080/mudrod-service/SearchVocab?concept=sst"

def parse(myUrl):
with urllib.request.urlopen(myUrl) as url:
data = json.loads(url.read().decode())
print(json.dumps(data, indent=4))

parse(myUrl)

# output:
# {
# "graph": {
# "ontology": [
# {
# "word": "sea surface temperature",
# "weight": 1.0
# },
# {
# "word": "ocean temperature",
# "weight": 1.0
# },
# {
# "word": "group high resolution sea surface temperature dataset",
# "weight": 0.89
# },
# (etc)...