regex fix json, issue #1
parent
99b849c224
commit
f671439f6f
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue