Skip to content

Instantly share code, notes, and snippets.

@brantfaircloth
Created April 19, 2016 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brantfaircloth/e826885ce1212309cb4d48b674ed97f3 to your computer and use it in GitHub Desktop.
Save brantfaircloth/e826885ce1212309cb4d48b674ed97f3 to your computer and use it in GitHub Desktop.
fishbase 1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
(c) 2016 Brant Faircloth || http://faircloth-lab.org/
All rights reserved.
This code is distributed under a 3-clause BSD license. Please see
LICENSE.txt for more information.
Created on 19 April 2016 08:48 CDT (-0500)
"""
import requests
import pdb
def main():
# get information from species table (should contain species code)
payload = {
'genus': 'lepisosteus',
'species': 'osseus'
}
my_request = requests.get(
'https://fishbase.ropensci.org/species',
params=payload
)
species_result = my_request.json()
# get species code
my_species_code = species_result['data'][0]['SpecCode']
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment