regex fix json, issue #1

main
Jeff Moe 2023-09-29 08:13:06 -06:00
parent 99b849c224
commit f671439f6f
1 changed files with 16 additions and 2 deletions

View File

@ -18,7 +18,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
# Sample code for issue #1
from pygbif import species
#from pygbif import species
import re
import sys
# Use GBIF API
#foo = species.name_suggest(q="Puma concolor")
# Read file same as species.name_suggest() instead of hitting
# their API over and over.
f = open("sample/pumas.json")
foo = f.read()
foo = foo[:-1]
foo = re.sub("\'", '\"', foo)
foo = re.sub("False", '"False"', foo)
foo = re.sub("True", '"True"', foo)
foo = species.name_suggest(q="Puma concolor")
print(foo)