CoCalc Shared Filesmyanacondadont / api_call_example.htmlOpen in CoCalc with one click!
Authors: Tim Clemans SMC, Harald Schilly, William A. Stein, alwaysleaveanote alwaysleaveanote
Views : 20
Description: Jupyter html version of myanacondadont/api_call_example.ipynb
api_call_example
In [6]:
import urllib
import json
import pandas as pd
In [13]:
# read in json
url = 'https://www.nwfsc.noaa.gov/data/api/v1/source/trawl.catch_fact/selection.json?filters=' + \
      'field_identified_taxonomy_dim$scientific_name=Eopsetta%20jordani,date_dim$year>=2010,' + \
      'date_dim$year<=2012&variables=date_dim$yyyymmdd,field_identified_taxonomy_dim$scientific_name'
api_response = urllib.urlopen(url)
json_file = json.loads(api_response.read())
In [15]:
pd.DataFrame(json_file)
Out[15]:
date_dim$yyyymmdd field_identified_taxonomy_dim$scientific_name
0 20120526 Eopsetta jordani
1 20100824 Eopsetta jordani
2 20120526 Eopsetta jordani
3 20110823 Eopsetta jordani
4 20120526 Eopsetta jordani
5 20120821 Eopsetta jordani
6 20100527 Eopsetta jordani
7 20110523 Eopsetta jordani
8 20110524 Eopsetta jordani
9 20120821 Eopsetta jordani
10 20110825 Eopsetta jordani
11 20110825 Eopsetta jordani
12 20100527 Eopsetta jordani
13 20120527 Eopsetta jordani
14 20100825 Eopsetta jordani
15 20110524 Eopsetta jordani
16 20120822 Eopsetta jordani
17 20110524 Eopsetta jordani
18 20100527 Eopsetta jordani
19 20110824 Eopsetta jordani
20 20120526 Eopsetta jordani
21 20110823 Eopsetta jordani
22 20100527 Eopsetta jordani
23 20110825 Eopsetta jordani
24 20120822 Eopsetta jordani
25 20100526 Eopsetta jordani
26 20110822 Eopsetta jordani
27 20110523 Eopsetta jordani
28 20120822 Eopsetta jordani
29 20110523 Eopsetta jordani
... ... ...
981 20110711 Eopsetta jordani
982 20110711 Eopsetta jordani
983 20110717 Eopsetta jordani
984 20110717 Eopsetta jordani
985 20100713 Eopsetta jordani
986 20110711 Eopsetta jordani
987 20110711 Eopsetta jordani
988 20101017 Eopsetta jordani
989 20110717 Eopsetta jordani
990 20121009 Eopsetta jordani
991 20101012 Eopsetta jordani
992 20121010 Eopsetta jordani
993 20120712 Eopsetta jordani
994 20101012 Eopsetta jordani
995 20100712 Eopsetta jordani
996 20100719 Eopsetta jordani
997 20121016 Eopsetta jordani
998 20121012 Eopsetta jordani
999 20121013 Eopsetta jordani
1000 20111012 Eopsetta jordani
1001 20111013 Eopsetta jordani
1002 20121015 Eopsetta jordani
1003 20100717 Eopsetta jordani
1004 20110716 Eopsetta jordani
1005 20100717 Eopsetta jordani
1006 20111012 Eopsetta jordani
1007 20100716 Eopsetta jordani
1008 20110715 Eopsetta jordani
1009 20101014 Eopsetta jordani
1010 20111014 Eopsetta jordani

1011 rows × 2 columns

In [ ]: