0

I am trying this code to get the data from api in Jupyter Notebook

import urllib

link = "https://api.covidactnow.org/v2/counties.timeseries.json?apiKey=2bd2fb77d0f7415f8313b45e5d260206"
f = urllib.urlopen(link)
myfile = f.read()
print(myfile.head())

I getting this error

AttributeError                            Traceback (most recent call last)
<ipython-input-7-722af2e4bbfc> in <module>
      2 
      3 link = "https://api.covidactnow.org/v2/counties.timeseries.json?apiKey=2bd2fb77d0f7415f8313b45e5d260206"
----> 4 f = urllib.urlopen(link)
      5 myfile = f.read()
      6 print(myfile.head())

AttributeError: module 'urllib' has no attribute 'urlopen'
  • Does this answer your question? [AttributeError: 'module' object has no attribute 'urlopen'](https://stackoverflow.com/questions/3969726/attributeerror-module-object-has-no-attribute-urlopen) – Equinox Oct 21 '20 at 06:40
  • [Check this out](https://docs.python.org/3/library/urllib.request.html#module-urllib.request). This might be of some help to you to resolve your issue. – vvk24 Oct 21 '20 at 06:40

0 Answers0