<jupyter_start><jupyter_text>before run this program, run this in command for the internet connect in jupyter notebookunset all_proxy && unset ALL_PROXY<jupyter_code>import requests
import json

page = requests.get("https://api.datamuse.com/words?rel_rhy=funny")
print(type(page))
print(page.text[:150]) # print the first 150 characters
print(page.url) # print the url that was fetched
print("------")
x = page.json() # turn page.text into a python object      == json.loads(page.text)
print(type(x))
print("---first item in the list---")
print(x[0])
print("---the whole list, pretty printed---")
print(json.dumps(x, indent=2)) # pretty print the results<jupyter_output><class 'requests.models.Response'>
[{"word":"money","score":4415,"numSyllables":2},{"word":"honey","score":1213,"numSyllables":2},{"word":"sunny","score":719,"numSyllables":2},{"word":"
https://api.datamuse.com/words?rel_rhy=funny
------
<class 'list'>
---first item in the list---
{'word': 'money', 'score': 4415, 'numSyllables': 2}
---the whole list, pretty printed---
[
  {
    "word": "money",
    "score": 4415,
    "numSyllables": 2
  },
  {
    "word": "honey",
    "score": 1213,
    "numSyllables": 2
  },
  {
    "word": "sunny",
    "score": 719,
    "numSyllables": 2
  },
  {
    "word": "bunny",
    "score": 702,
    "numSyllables": 2
  },
  {
    "word": "blini",
    "score": 613,
    "numSyllables": 2
  },
  {
    "word": "gunny",
    "score": 449,
    "numSyllables": 2
  },
  {
    "word": "tunny",
    "score": 302,
    "numSyllables": 2
  },
  {
    "word": "sonny",
    "score": 286,
    "numSyllables": 2
  },
  {
    "word": "dunny",
    "score": 248,
    "numSyllables": 2
[...]<jupyter_text>To summarize, a Response object, in the full implementation of the requests module has the following useful attributes that can be accessed in your program:.text.url.json().status_code .headers .history<jupyter_code>page = requests.get("https://ncov.dxy.cn/ncovh5/view/pneumonia_peopleapp?from=timeline&isappinstalled=0")
print(type(page))
print(page.status_code)
print(page.headers)
print(list(page.headers.keys()))
# print(page.text)
# a= page.json()<jupyter_output><class 'requests.models.Response'>
200
{'Server': 'nginx', 'Date': 'Sat, 29 Feb 2020 16:06:36 GMT', 'Content-Type': 'text/html', 'Transfer-Encoding': 'chunked', 'Vary': 'Accept-Encoding', 'Last-Modified': 'Sat, 29 Feb 2020 16:06:15 GMT', 'Expires': 'Sat, 29 Feb 2020 16:09:36 GMT', 'Cache-Control': 'max-age=180', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Methods': 'POST,GET,OPTIONS,DELETE,PUT', 'Content-Encoding': 'gzip'}
['Server', 'Date', 'Content-Type', 'Transfer-Encoding', 'Vary', 'Last-Modified', 'Expires', 'Cache-Control', 'Access-Control-Allow-Credentials', 'Access-Control-Allow-Methods', 'Content-Encoding']<jupyter_text>https://www.google.com/search?tbm=isch&q=%22violins+and+guitars%22.<jupyter_code># d = {'q': '"violins and guitars"', 'tbm': 'isch'}
# results = requests.get("https://google.com/search", params=d)
# print(results.url)



import requests

# page = requests.get("https://api.datamuse.com/words?rel_rhy=funny")
kval_pairs = {'rel_rhy': 'funny'}
page = requests.get("https://api.datamuse.com/words", params=kval_pairs)
print(page.text[:150]) # print the first 150 characters
print(page.url) # print the url that was fetched<jupyter_output>[{"word":"money","score":4415,"numSyllables":2},{"word":"honey","score":1213,"numSyllables":2},{"word":"sunny","score":719,"numSyllables":2},{"word":"
https://api.datamuse.com/words?rel_rhy=funny
{'fraction_non_alphanumeric': 0.20501974055273547, 'fraction_numerical': 0.03750705019740553, 'mean_word_length': 5.022071307300509, 'pattern_counts': {'":': 47, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 8, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '357110', 'license': 'MIT', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1286, 'n_words': 260, 'path': 'Py3_programing_Seires/Data_Collection_and_Processing/URLs.ipynb', 'repo_name': 'fengjings/Coursera', 'size': '3546'}