pyinaturalist 0.16.0dev3__tar.gz → 0.17.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/.readthedocs.yml +5 -1
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/HISTORY.md +39 -9
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/LICENSE +1 -1
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/PKG-INFO +36 -35
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/README.md +23 -22
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/conf.py +1 -1
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/endpoints.md +1 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/__init__.py +1 -1
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/auth.py +40 -7
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/client.py +3 -19
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/constants.py +6 -5
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/controllers/projects.py +2 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/converters.py +31 -4
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/docs/model_docs.py +25 -15
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/docs/templates.py +67 -5
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/lazy_property.py +22 -24
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/request_params.py +46 -23
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/session.py +55 -51
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v0/observations.py +2 -3
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/__init__.py +3 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/observations.py +42 -14
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/projects.py +139 -7
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/users.py +3 -3
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyproject.toml +19 -19
- pyinaturalist-0.17.0dev1/setup.py +59 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/conftest.py +17 -5
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/controllers/test_project_controller.py +2 -2
- pyinaturalist-0.17.0dev1/test/sample_data/get_jwt.json +3 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_projects.json +2 -1
- pyinaturalist-0.17.0dev1/test/sample_data/put_projects.json +109 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_auth.py +77 -9
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_client.py +0 -21
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_converters.py +26 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_request_params.py +2 -2
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_session.py +41 -54
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_observations.py +32 -3
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_projects.py +48 -4
- pyinaturalist-0.16.0dev3/setup.py +0 -59
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/CONTRIBUTING.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/CONTRIBUTORS.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docker-compose.yml +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_static/collapsible_container.css +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_static/collapsible_container.js +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_static/colors.css +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_static/favicon.ico +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_static/pyinaturalist_logo.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_static/python-logo-green.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_static/table.css +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_templates/autosummary/module.rst_t +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_templates/autosummary_core/class.rst +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_templates/header.html +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_templates/localtoc.html +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_templates/module.rst_t +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/_templates/package.rst_t +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/automodapi.rst +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/code_of_conduct.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/contributing.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/contributors.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/examples.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/history.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-new-application-complete.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-new-application.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-identifiers.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-observers.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-page-annotated.odg +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-page-annotated.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-page.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-search-bar.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-search-filters.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-observation-species-counts.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-taxon-autocomplete.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-taxon-page.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/inat-user-login.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/password_manager_keying.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pprint_table.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo.xcf +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo_hex.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo_hex.xcf +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo_med.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo_stacked.xcf +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo_white.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/pyinaturalist_logo_white.xcf +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/python-logo-green.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/images/python-logo-green.xcf +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/index.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/pyinaturalist.controllers.rst +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/pyinaturalist.models.rst +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/reference.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/docs/user_guide.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/Data Visualizations - Matplotlib.ipynb +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/Data Visualizations - Regional Activity Report.ipynb +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/Data Visualizations - Regional Observation Stats.ipynb +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/Data Visualizations - Seaborn.ipynb +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/README.md +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/Tutorial_1_Observations.ipynb +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/Tutorial_2_Taxa.ipynb +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/Tutorial_3_Data_Visualizations.ipynb +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/__init__.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/combined_activity_stats.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/histogram_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/identifiers_by_month.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/observation_image_grid.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/observation_map.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/observations_by_date_and_time.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/observations_by_month.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/observations_by_quality_grade.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/observations_by_year.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/observers_by_month.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/taxa_by_month.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/total_observations_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/images/total_taxa_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/observation_photo_metadata.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/observations_to_gpx.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/observations_to_tsp.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/sample_data/fips_to_inat_place_ids.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/sample_data/observation_fields.parquet +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/sample_data/observations.gpx +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/sample_data/observations.tsp +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/sample_data/photo_info.html +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/sample_data/us_county_fips_codes.csv +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/examples/sample_data.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/controllers/__init__.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/controllers/base.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/controllers/observations.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/controllers/taxa.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/controllers/users.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/docs/__init__.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/docs/docstrings.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/docs/emoji.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/docs/signatures.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/exceptions.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/formatters.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/__init__.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/base.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/comment.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/controlled_term.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/identification.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/life_list.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/message.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/observation.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/observation_field.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/photo.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/place.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/project.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/search.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/taxon.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/taxon_meta.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/models/user.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/node_api.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/paginator.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/py.typed +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/rest_api.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v0/__init__.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v0/observation_fields.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/controlled_terms.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/identifications.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/messages.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/observation_fields.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/places.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/posts.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/search.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v1/taxa.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/pyinaturalist/v2/__init__.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/__init__.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/controllers/test_observation_controller.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/controllers/test_taxon_controller.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/controllers/test_user_controller.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/docs/test_docstrings.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/docs/test_signatures.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/add_project_observation.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/create_observation_fail.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/create_observation_result.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/create_observation_v1.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_access_token.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_access_token_401.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_all_observation_identifiers_ex_results.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_all_observation_observers_ex_results.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_all_observation_species_counts_ex_results.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_all_observation_species_counts_page1.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_all_observation_species_counts_page2.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_controlled_terms.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_controlled_terms_for_taxon.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_identifications.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_identifications.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_messages.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_nonexistent_observation.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_2.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_fields.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_fields_page1.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_fields_page2.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_day.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_day.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_hour.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_hour.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_month.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_month.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_month_of_year.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_month_of_year.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_week.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_week.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_week_of_year.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_histogram_week_of_year.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_identifiers_ex_results.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_identifiers_node_page1.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_identifiers_node_page2.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_observers_ex_results.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_observers_node_page1.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_observers_node_page2.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_species_counts.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_species_counts.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_taxon_summary.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_taxon_summary_conserved.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_taxon_summary_listed.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_taxonomy.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_with_ofvs.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_with_quality_metrics.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observation_with_sounds.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations.atom +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations.csv +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations.dwc +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations.js +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations.kml +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations_node.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations_node_page1.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_observations_node_page2.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_places_autocomplete.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_places_autocomplete.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_places_by_id.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_places_by_id.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_places_nearby.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_places_nearby.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_posts_login.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_posts_project.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_projects.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_projects_by_id.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_projects_by_id.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_projects_obs_fields.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_search.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_search.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_autocomplete.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_autocomplete.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_autocomplete_minified.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_by_id.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_by_id.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_by_id_conservation_statuses.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_map_layers.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_with_all_names.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_taxa_with_preferred_place.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_user_by_id.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_user_by_id.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_users_autocomplete.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/get_users_autocomplete.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/obs_image.jpg +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/obs_sound.wav +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/post_observation_photos.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/post_observation_photos_list.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/post_observation_sounds.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/post_observation_sounds_list.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/post_put_observation_field_value.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/update_observation_result.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/upload_photos.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/upload_photos_and_sounds.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data/upload_sounds.json +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/sample_data.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_compat.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_formatters.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_models.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/test_paginator.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v0/test_observation_fields_v0.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v0/test_observations_v0.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_controlled_terms.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_identifications.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_messages.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_node_api.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_observation_fields.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_places.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_posts.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_search.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_taxa.py +0 -0
- {pyinaturalist-0.16.0dev3 → pyinaturalist-0.17.0dev1}/test/v1/test_users.py +0 -0
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
# Read the Docs configuration file
|
|
2
2
|
version: 2
|
|
3
3
|
|
|
4
|
+
build:
|
|
5
|
+
os: ubuntu-20.04
|
|
6
|
+
tools:
|
|
7
|
+
python: '3.10'
|
|
8
|
+
|
|
4
9
|
sphinx:
|
|
5
10
|
builder: html
|
|
6
11
|
configuration: docs/conf.py
|
|
7
12
|
|
|
8
13
|
python:
|
|
9
|
-
version: 3.8
|
|
10
14
|
system_packages: True
|
|
11
15
|
install:
|
|
12
16
|
- method: pip
|
|
@@ -1,20 +1,50 @@
|
|
|
1
1
|
# History
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.17.0 (Unreleased)
|
|
4
|
+
[See all Issues & PRs for 0.17](https://github.com/niconoe/pyinaturalist/milestone/8?closed=1)
|
|
5
|
+
|
|
6
|
+
### New Endpoints
|
|
7
|
+
* Added new **Project** endpoint and helper functions:
|
|
8
|
+
* `update_project()`
|
|
9
|
+
* `add_project_users()`
|
|
10
|
+
* `delete_project_users()`
|
|
11
|
+
|
|
12
|
+
### Modified Endpoints
|
|
13
|
+
* Updated `get_projects_by_id()` to allow string values (URL slugs) for `project_id`
|
|
14
|
+
* Updated `get_user_by_id()` to allow string values (usernames) for `user_id`
|
|
15
|
+
|
|
16
|
+
### Authentication
|
|
17
|
+
* Added support for JWT authentication, which will now be used by default
|
|
18
|
+
* To get an OAuth access token instead of a JWT, call `get_access_token(jwt=False)`
|
|
19
|
+
* Added caching to `get_access_token()`. JWTs will be stored in the API response cache and reused
|
|
20
|
+
until they expire.
|
|
21
|
+
|
|
22
|
+
### Other Changes
|
|
23
|
+
* Dropped support for python 3.6
|
|
24
|
+
* Added support for setting timeout for individual API requests (with `timeout` parameter)
|
|
25
|
+
* Added support for setting cache timeout for individual API requests (with `expire_after` parameter)
|
|
26
|
+
* Added support for bypassing the cache for individual API requests (with `refresh` parameter)
|
|
27
|
+
|
|
28
|
+
## 0.16.0 (2022-02-22)
|
|
4
29
|
[See all Issues & PRs for 0.16](https://github.com/niconoe/pyinaturalist/milestone/7?closed=1)
|
|
5
30
|
|
|
6
31
|
### New Endpoints
|
|
7
|
-
*
|
|
8
|
-
*
|
|
32
|
+
* Added new **Taxon** endpoint: `get_taxa_map_layers()`
|
|
33
|
+
* Added new **Message** endpoints:
|
|
9
34
|
* `get_messages()`
|
|
10
35
|
* `get_message_by_id()`
|
|
11
36
|
* `get_unread_meassage_count()`
|
|
12
37
|
|
|
38
|
+
### Observation Media
|
|
39
|
+
The following changes apply to `upload()`, `create_observation()`, and `update_observation()`:
|
|
40
|
+
* Added support for uploading observation photo & sound files from URLs
|
|
41
|
+
* Added support for attaching previously uploaded photos to an observation by photo ID
|
|
42
|
+
|
|
13
43
|
### Other Changes
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
*
|
|
44
|
+
* Added support for python 3.10
|
|
45
|
+
* Removed `pyinaturalist.user_agent` global variable and API function keyword args, and recommend setting on session object instead
|
|
46
|
+
* Removed `pyinaturalist.DRY_RUN*` global variables, and recommend setting in environment variables instead
|
|
47
|
+
* Fixed `count_only=True`/`per_page=0` to not run full query
|
|
18
48
|
* Do not error on unrecognized `**kwargs`, for cases where the API may accept some additional undocumented parameters
|
|
19
49
|
* Allow overriding default location for API request cache
|
|
20
50
|
|
|
@@ -271,8 +301,8 @@ Model features:
|
|
|
271
301
|
* Made all API function signatures consistent by taking request params as keyword arguments
|
|
272
302
|
|
|
273
303
|
### Other Changes
|
|
274
|
-
* Dropped
|
|
275
|
-
* Added
|
|
304
|
+
* Dropped support for python 3.4
|
|
305
|
+
* Added support for python 3.9
|
|
276
306
|
* Added parameter validation for multiple-choice request parameters
|
|
277
307
|
|
|
278
308
|
## 0.10.0 (2020-06-16)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyinaturalist
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.17.0dev1
|
|
4
4
|
Summary: iNaturalist API client for python
|
|
5
5
|
Home-page: https://github.com/niconoe/pyinaturalist
|
|
6
6
|
License: MIT
|
|
7
7
|
Keywords: inaturalist,biodiversity,conservation,citizen-science,community-science,api,api-client,data-model,requests
|
|
8
8
|
Author: Nicolas Noé
|
|
9
9
|
Author-email: nicolas@niconoe.eu
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.7,<4.0
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Intended Audience :: Education
|
|
@@ -22,25 +22,25 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
22
22
|
Classifier: Typing :: Typed
|
|
23
23
|
Provides-Extra: all
|
|
24
24
|
Provides-Extra: docs
|
|
25
|
-
Requires-Dist: appdirs (>=1.4)
|
|
26
25
|
Requires-Dist: attrs (>=21.2)
|
|
27
|
-
Requires-Dist: furo (
|
|
28
|
-
Requires-Dist: ipython (>=7.25.0,<8.0.0);
|
|
26
|
+
Requires-Dist: furo (>=2022.2.14.1,<2023.0.0.0); extra == "docs"
|
|
27
|
+
Requires-Dist: ipython (>=7.25.0,<8.0.0); extra == "docs"
|
|
29
28
|
Requires-Dist: keyring (>=22.3)
|
|
30
29
|
Requires-Dist: linkify-it-py (>=1.0.1,<2.0.0); extra == "docs"
|
|
31
|
-
Requires-Dist: myst-parser (>=0.
|
|
30
|
+
Requires-Dist: myst-parser (>=0.17.0,<0.18.0); extra == "docs"
|
|
32
31
|
Requires-Dist: nbsphinx (>=0.8.5,<0.9.0); extra == "docs"
|
|
32
|
+
Requires-Dist: platformdirs (>=2.5)
|
|
33
33
|
Requires-Dist: python-dateutil (>=2.0)
|
|
34
34
|
Requires-Dist: python-forge (>=18.6)
|
|
35
|
-
Requires-Dist: requests (>=2.
|
|
36
|
-
Requires-Dist: requests-cache (
|
|
35
|
+
Requires-Dist: requests (>=2.22)
|
|
36
|
+
Requires-Dist: requests-cache (==0.10.0.dev0)
|
|
37
37
|
Requires-Dist: requests-ratelimiter (>=0.2.1)
|
|
38
|
-
Requires-Dist: rich (>=10.
|
|
38
|
+
Requires-Dist: rich (>=10.9)
|
|
39
39
|
Requires-Dist: sphinx (>=4.2.0,<5.0.0); extra == "docs"
|
|
40
|
-
Requires-Dist: sphinx-autodoc-typehints (>=1.
|
|
41
|
-
Requires-Dist: sphinx-automodapi (>=0.
|
|
42
|
-
Requires-Dist: sphinx-copybutton (>=0.
|
|
43
|
-
Requires-Dist: sphinx-inline-tabs (>=
|
|
40
|
+
Requires-Dist: sphinx-autodoc-typehints (>=1.17,<2.0); extra == "docs"
|
|
41
|
+
Requires-Dist: sphinx-automodapi (>=0.14,<0.15); extra == "docs"
|
|
42
|
+
Requires-Dist: sphinx-copybutton (>=0.5); extra == "docs"
|
|
43
|
+
Requires-Dist: sphinx-inline-tabs (>=2022.1.2b11,<2023.0.0); (python_version >= "3.8") and (extra == "docs")
|
|
44
44
|
Requires-Dist: sphinx-panels (>=0.6.0,<0.7.0); extra == "docs"
|
|
45
45
|
Requires-Dist: sphinxcontrib-apidoc (>=0.3,<0.4); extra == "docs"
|
|
46
46
|
Project-URL: Documentation, https://pyinaturalist.readthedocs.io
|
|
@@ -70,8 +70,8 @@ get involved in the natural world by observing and identifying the living things
|
|
|
70
70
|
Collectively, the community produces a rich source of global biodiversity data that can be valuable
|
|
71
71
|
to anyone from hobbyists to scientists.
|
|
72
72
|
|
|
73
|
-
**pyinaturalist** is
|
|
74
|
-
|
|
73
|
+
**pyinaturalist** is a client for the [iNaturalist API](https://api.inaturalist.org/v1) that makes
|
|
74
|
+
these data easily accessible in the python programming language.
|
|
75
75
|
|
|
76
76
|
- [Features](#features)
|
|
77
77
|
- [Quickstart](#quickstart)
|
|
@@ -80,27 +80,29 @@ aims to make these data easily accessible in the python programming language.
|
|
|
80
80
|
- [Related Projects](#related-projects)
|
|
81
81
|
|
|
82
82
|
## Features
|
|
83
|
-
* **Easier requests:**
|
|
84
|
-
|
|
85
|
-
* **Convenient responses:** Type conversions to the things you would expect in python, and
|
|
86
|
-
|
|
87
|
-
* **
|
|
88
|
-
* **
|
|
89
|
-
* **
|
|
83
|
+
* ➡️ **Easier requests:** Simplified request formats, easy pagination, and complete request
|
|
84
|
+
parameter type annotations for better IDE integration
|
|
85
|
+
* ⬅️ **Convenient responses:** Type conversions to the things you would expect in python, and an
|
|
86
|
+
optional object-oriented inteface for response data
|
|
87
|
+
* 🔒 **Security:** Keyring integration for secure credential storage
|
|
88
|
+
* 📗 **Docs:** Example requests, responses, scripts, and Jupyter notebooks to help get you started
|
|
89
|
+
* 💚 **Responsible use:** Follows the
|
|
90
90
|
[API Recommended Practices](https://www.inaturalist.org/pages/api+recommended+practices),
|
|
91
|
-
so you can be nice to the iNaturalist servers and not worry about rate-limiting errors
|
|
92
|
-
* **
|
|
91
|
+
by default, so you can be nice to the iNaturalist servers and not worry about rate-limiting errors
|
|
92
|
+
* 🧪 **Testing:** A dry-run testing mode to preview your requests before potentially modifying data
|
|
93
93
|
|
|
94
|
+
### Supported Endpoints
|
|
94
95
|
Many of the most relevant API endpoints are supported, including:
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
96
|
+
* 📝 Annotations and observation fields
|
|
97
|
+
* 🆔 Identifications
|
|
98
|
+
* 💬 Messages
|
|
99
|
+
* 👀 Observations (multiple formats)
|
|
100
|
+
* 📷 Observation photos + sounds
|
|
101
|
+
* 📊 Observation observers, identifiers, histograms, life lists, and species counts
|
|
102
|
+
* 📍 Places
|
|
103
|
+
* 👥 Projects
|
|
104
|
+
* 🐦Species
|
|
105
|
+
* 👤 Users
|
|
104
106
|
|
|
105
107
|
## Quickstart
|
|
106
108
|
Here are usage examples for some of the most commonly used features.
|
|
@@ -254,8 +256,7 @@ place to start.
|
|
|
254
256
|
## Related Projects
|
|
255
257
|
Other python projects related to iNaturalist:
|
|
256
258
|
|
|
257
|
-
* [Dronefly](https://github.com/synrg/dronefly): A Discord bot with iNaturalist
|
|
258
|
-
used by the iNaturalist Discord server.
|
|
259
|
+
* [Dronefly](https://github.com/synrg/dronefly): A Discord bot with iNaturalist integration, used by the iNaturalist Discord server.
|
|
259
260
|
* [pyinaturalist-convert](https://github.com/JWCook/pyinaturalist-convert): Tools to convert observation data to and from multiple formats
|
|
260
261
|
* [pyinaturalist-open-data](https://github.com/JWCook/pyinaturalist-open-data): Tools for working with [iNaturalist open data](https://registry.opendata.aws/inaturalist-open-data/)
|
|
261
262
|
* [pyinaturalist-notebook](https://github.com/JWCook/pyinaturalist-notebook): Jupyter notebook Docker image for pyinaturalist
|
|
@@ -21,8 +21,8 @@ get involved in the natural world by observing and identifying the living things
|
|
|
21
21
|
Collectively, the community produces a rich source of global biodiversity data that can be valuable
|
|
22
22
|
to anyone from hobbyists to scientists.
|
|
23
23
|
|
|
24
|
-
**pyinaturalist** is
|
|
25
|
-
|
|
24
|
+
**pyinaturalist** is a client for the [iNaturalist API](https://api.inaturalist.org/v1) that makes
|
|
25
|
+
these data easily accessible in the python programming language.
|
|
26
26
|
|
|
27
27
|
- [Features](#features)
|
|
28
28
|
- [Quickstart](#quickstart)
|
|
@@ -31,27 +31,29 @@ aims to make these data easily accessible in the python programming language.
|
|
|
31
31
|
- [Related Projects](#related-projects)
|
|
32
32
|
|
|
33
33
|
## Features
|
|
34
|
-
* **Easier requests:**
|
|
35
|
-
|
|
36
|
-
* **Convenient responses:** Type conversions to the things you would expect in python, and
|
|
37
|
-
|
|
38
|
-
* **
|
|
39
|
-
* **
|
|
40
|
-
* **
|
|
34
|
+
* ➡️ **Easier requests:** Simplified request formats, easy pagination, and complete request
|
|
35
|
+
parameter type annotations for better IDE integration
|
|
36
|
+
* ⬅️ **Convenient responses:** Type conversions to the things you would expect in python, and an
|
|
37
|
+
optional object-oriented inteface for response data
|
|
38
|
+
* 🔒 **Security:** Keyring integration for secure credential storage
|
|
39
|
+
* 📗 **Docs:** Example requests, responses, scripts, and Jupyter notebooks to help get you started
|
|
40
|
+
* 💚 **Responsible use:** Follows the
|
|
41
41
|
[API Recommended Practices](https://www.inaturalist.org/pages/api+recommended+practices),
|
|
42
|
-
so you can be nice to the iNaturalist servers and not worry about rate-limiting errors
|
|
43
|
-
* **
|
|
42
|
+
by default, so you can be nice to the iNaturalist servers and not worry about rate-limiting errors
|
|
43
|
+
* 🧪 **Testing:** A dry-run testing mode to preview your requests before potentially modifying data
|
|
44
44
|
|
|
45
|
+
### Supported Endpoints
|
|
45
46
|
Many of the most relevant API endpoints are supported, including:
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
47
|
+
* 📝 Annotations and observation fields
|
|
48
|
+
* 🆔 Identifications
|
|
49
|
+
* 💬 Messages
|
|
50
|
+
* 👀 Observations (multiple formats)
|
|
51
|
+
* 📷 Observation photos + sounds
|
|
52
|
+
* 📊 Observation observers, identifiers, histograms, life lists, and species counts
|
|
53
|
+
* 📍 Places
|
|
54
|
+
* 👥 Projects
|
|
55
|
+
* 🐦Species
|
|
56
|
+
* 👤 Users
|
|
55
57
|
|
|
56
58
|
## Quickstart
|
|
57
59
|
Here are usage examples for some of the most commonly used features.
|
|
@@ -205,8 +207,7 @@ place to start.
|
|
|
205
207
|
## Related Projects
|
|
206
208
|
Other python projects related to iNaturalist:
|
|
207
209
|
|
|
208
|
-
* [Dronefly](https://github.com/synrg/dronefly): A Discord bot with iNaturalist
|
|
209
|
-
used by the iNaturalist Discord server.
|
|
210
|
+
* [Dronefly](https://github.com/synrg/dronefly): A Discord bot with iNaturalist integration, used by the iNaturalist Discord server.
|
|
210
211
|
* [pyinaturalist-convert](https://github.com/JWCook/pyinaturalist-convert): Tools to convert observation data to and from multiple formats
|
|
211
212
|
* [pyinaturalist-open-data](https://github.com/JWCook/pyinaturalist-open-data): Tools for working with [iNaturalist open data](https://registry.opendata.aws/inaturalist-open-data/)
|
|
212
213
|
* [pyinaturalist-notebook](https://github.com/JWCook/pyinaturalist-notebook): Jupyter notebook Docker image for pyinaturalist
|
|
@@ -43,7 +43,7 @@ DATA_DIR_SYMLINK = join(DOCS_DIR, 'sample_data')
|
|
|
43
43
|
NOTEBOOK_DIR_COPY = join(DOCS_DIR, 'examples')
|
|
44
44
|
|
|
45
45
|
# General information about the project.
|
|
46
|
-
copyright = '
|
|
46
|
+
copyright = '2022, Nicolas Noé, Jordan Cook'
|
|
47
47
|
exclude_patterns = ['_build', f'{MODULE_DOCS_DIR}/pyinaturalist.rst']
|
|
48
48
|
master_doc = 'index'
|
|
49
49
|
needs_sphinx = '4.0'
|
|
@@ -48,6 +48,7 @@ For all available endpoints, see: <http://api.inaturalist.org/v1/docs/>
|
|
|
48
48
|
| GET | /posts | {py:func}`.get_posts`
|
|
49
49
|
| GET | /projects | {py:func}`.get_projects`
|
|
50
50
|
| GET | /projects/{id} | {py:func}`.get_projects_by_id`
|
|
51
|
+
| PUT | /projects/{id} | {py:func}`.update_project`
|
|
51
52
|
| GET | /projects/{id}/members |
|
|
52
53
|
| GET | /projects/{id}/subscriptions |
|
|
53
54
|
| POST | /projects/{id}/add | {py:func}`.add_project_observation`
|
|
@@ -4,10 +4,11 @@ from typing import Dict, Optional
|
|
|
4
4
|
|
|
5
5
|
from keyring import get_password, set_password
|
|
6
6
|
from keyring.errors import KeyringError
|
|
7
|
+
from requests import Response
|
|
7
8
|
|
|
8
|
-
from pyinaturalist.constants import API_V0_BASE_URL, KEYRING_KEY
|
|
9
|
+
from pyinaturalist.constants import API_V0_BASE_URL, JWT_EXPIRATION, KEYRING_KEY
|
|
9
10
|
from pyinaturalist.exceptions import AuthenticationError
|
|
10
|
-
from pyinaturalist.session import
|
|
11
|
+
from pyinaturalist.session import ClientSession, get_local_session
|
|
11
12
|
|
|
12
13
|
logger = getLogger(__name__)
|
|
13
14
|
|
|
@@ -17,13 +18,17 @@ def get_access_token(
|
|
|
17
18
|
password: str = None,
|
|
18
19
|
app_id: str = None,
|
|
19
20
|
app_secret: str = None,
|
|
21
|
+
jwt: bool = True,
|
|
20
22
|
) -> str:
|
|
21
23
|
"""Get an access token using the user's iNaturalist username and password, using the
|
|
22
24
|
Resource Owner Password Credentials Flow. Requires registering an iNaturalist app.
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
.. rubric:: Notes
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
* API reference: https://www.inaturalist.org/pages/api+reference#auth
|
|
29
|
+
* See :ref:`auth` for additional options for storing credentials.
|
|
30
|
+
* This can be used to get either a JWT or OAuth token. These can be used interchangeably for
|
|
31
|
+
many endpoints. JWT is preferred for newer endpoints.
|
|
27
32
|
|
|
28
33
|
Examples:
|
|
29
34
|
|
|
@@ -55,10 +60,19 @@ def get_access_token(
|
|
|
55
60
|
password: iNaturalist password (same as the one you use to login on inaturalist.org)
|
|
56
61
|
app_id: OAuth2 application ID
|
|
57
62
|
app_secret: OAuth2 application secret
|
|
63
|
+
jwt: Return a JSON Web Token; otherwise return an OAuth2 access token.
|
|
58
64
|
|
|
59
65
|
Raises:
|
|
60
66
|
:py:exc:`requests.HTTPError`: (401) if credentials are invalid
|
|
61
67
|
"""
|
|
68
|
+
# First check if we have a previously cached JWT
|
|
69
|
+
session = get_local_session()
|
|
70
|
+
response = _get_jwt(session, only_if_cached=True)
|
|
71
|
+
if response.ok:
|
|
72
|
+
logger.info('Using cached access token')
|
|
73
|
+
return response.json()['api_token']
|
|
74
|
+
|
|
75
|
+
# Otherwise check for credentials in either args or environment variables
|
|
62
76
|
payload = {
|
|
63
77
|
'username': username or getenv('INAT_USERNAME'),
|
|
64
78
|
'password': password or getenv('INAT_PASSWORD'),
|
|
@@ -67,7 +81,7 @@ def get_access_token(
|
|
|
67
81
|
'grant_type': 'password',
|
|
68
82
|
}
|
|
69
83
|
|
|
70
|
-
# If
|
|
84
|
+
# If any fields were missing, then check the keyring
|
|
71
85
|
if not all(payload.values()):
|
|
72
86
|
payload.update(get_keyring_credentials())
|
|
73
87
|
if all(payload.values()):
|
|
@@ -75,9 +89,17 @@ def get_access_token(
|
|
|
75
89
|
else:
|
|
76
90
|
raise AuthenticationError('Not all authentication parameters were provided')
|
|
77
91
|
|
|
78
|
-
|
|
92
|
+
# Get OAuth access token
|
|
93
|
+
response = session.post(f'{API_V0_BASE_URL}/oauth/token', json=payload)
|
|
79
94
|
response.raise_for_status()
|
|
80
|
-
|
|
95
|
+
access_token = response.json()['access_token']
|
|
96
|
+
|
|
97
|
+
# If specified, use OAuth token to get (and cache) a JWT
|
|
98
|
+
if jwt:
|
|
99
|
+
response = _get_jwt(session, access_token)
|
|
100
|
+
response.raise_for_status()
|
|
101
|
+
access_token = response.json()['api_token']
|
|
102
|
+
return access_token
|
|
81
103
|
|
|
82
104
|
|
|
83
105
|
def get_keyring_credentials() -> Dict[str, Optional[str]]:
|
|
@@ -117,3 +139,14 @@ def set_keyring_credentials(
|
|
|
117
139
|
set_password(KEYRING_KEY, 'password', password)
|
|
118
140
|
set_password(KEYRING_KEY, 'app_id', app_id)
|
|
119
141
|
set_password(KEYRING_KEY, 'app_secret', app_secret)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _get_jwt(
|
|
145
|
+
session: ClientSession, access_token: str = '', only_if_cached: bool = False
|
|
146
|
+
) -> Response:
|
|
147
|
+
return session.get(
|
|
148
|
+
f'{API_V0_BASE_URL}/users/api_token',
|
|
149
|
+
headers={'Authorization': f'Bearer {access_token}'},
|
|
150
|
+
expire_after=JWT_EXPIRATION, # type: ignore
|
|
151
|
+
only_if_cached=only_if_cached, # If True, will return a 504 if not cached
|
|
152
|
+
)
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
1
|
from logging import getLogger
|
|
3
2
|
from typing import Any, Callable, Dict
|
|
4
3
|
|
|
5
4
|
from requests import Session
|
|
6
5
|
|
|
7
6
|
from pyinaturalist.auth import get_access_token
|
|
8
|
-
from pyinaturalist.constants import
|
|
7
|
+
from pyinaturalist.constants import JsonResponse
|
|
9
8
|
from pyinaturalist.controllers import (
|
|
10
9
|
ObservationController,
|
|
11
10
|
ProjectController,
|
|
@@ -79,7 +78,7 @@ class iNatClient:
|
|
|
79
78
|
|
|
80
79
|
Args:
|
|
81
80
|
creds: Optional arguments for :py:func:`.get_access_token`, used to get and refresh access
|
|
82
|
-
tokens as needed.
|
|
81
|
+
tokens as needed. Using a keyring instead is recommended, though.
|
|
83
82
|
default_params: Default request parameters to pass to any applicable API requests
|
|
84
83
|
dry_run: Just log all requests instead of sending real requests
|
|
85
84
|
session: Session object to use instead of creating a new one
|
|
@@ -109,21 +108,6 @@ class iNatClient:
|
|
|
109
108
|
self.taxa = TaxonController(self) #: Interface for taxon requests
|
|
110
109
|
self.users = UserController(self) #: Interface for user requests
|
|
111
110
|
|
|
112
|
-
@property
|
|
113
|
-
def access_token(self):
|
|
114
|
-
"""Reuse an existing access token, if it's not expired; otherwise, get a new one"""
|
|
115
|
-
if self._is_token_expired():
|
|
116
|
-
logger.info('Access token expired, requesting a new one')
|
|
117
|
-
self._access_token = get_access_token(**self.creds)
|
|
118
|
-
self._token_expires = datetime.utcnow() + TOKEN_EXPIRATION
|
|
119
|
-
else:
|
|
120
|
-
logger.debug('Using active access token')
|
|
121
|
-
return self._access_token
|
|
122
|
-
|
|
123
|
-
def _is_token_expired(self):
|
|
124
|
-
initialized = self._access_token and self._token_expires
|
|
125
|
-
return not (initialized and datetime.utcnow() < self._token_expires)
|
|
126
|
-
|
|
127
111
|
def _update_kwargs(self, request_function, auth: bool = False, **kwargs):
|
|
128
112
|
"""Apply any applicable client settings to request parameters before sending a request.
|
|
129
113
|
Explicit keyword arguments will override any client settings.
|
|
@@ -136,7 +120,7 @@ class iNatClient:
|
|
|
136
120
|
|
|
137
121
|
# Add access token and default params, if applicable
|
|
138
122
|
if auth:
|
|
139
|
-
client_settings['access_token'] = self.
|
|
123
|
+
client_settings['access_token'] = get_access_token(**self.creds) # type: ignore
|
|
140
124
|
client_settings.update(get_valid_kwargs(request_function, self.default_params))
|
|
141
125
|
|
|
142
126
|
for k, v in client_settings.items():
|
|
@@ -3,8 +3,8 @@ from os.path import abspath, dirname, join
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import IO, TYPE_CHECKING, Any, BinaryIO, Dict, Iterable, List, Optional, Tuple, Union
|
|
5
5
|
|
|
6
|
-
from appdirs import user_cache_dir
|
|
7
6
|
from dateutil.relativedelta import relativedelta
|
|
7
|
+
from platformdirs import user_cache_dir
|
|
8
8
|
|
|
9
9
|
# iNaturalist URLs
|
|
10
10
|
API_V0_BASE_URL = 'https://www.inaturalist.org'
|
|
@@ -26,6 +26,7 @@ PER_PAGE_RESULTS = 200 # Default number of records per page for paginated queri
|
|
|
26
26
|
LARGE_REQUEST_WARNING = 5000 # Show a warning for queries that will return over this many results
|
|
27
27
|
|
|
28
28
|
# Rate-limiting and retry settings
|
|
29
|
+
CONNECT_TIMEOUT = 5
|
|
29
30
|
MAX_DELAY = 60 # Maximum time to wait for rate-limiting before aborting
|
|
30
31
|
REQUEST_BURST_RATE = 5
|
|
31
32
|
REQUESTS_PER_SECOND = 1
|
|
@@ -35,10 +36,7 @@ REQUEST_TIMEOUT = 10
|
|
|
35
36
|
REQUEST_RETRIES = 5 # Maximum number of retries for a failed request
|
|
36
37
|
RETRY_BACKOFF = 0.5 # Exponential backoff factor for retries
|
|
37
38
|
|
|
38
|
-
#
|
|
39
|
-
# Deprecated; use dry_run parameter or DRY_RUN_ENABLED environment variable instead
|
|
40
|
-
DRY_RUN_ENABLED = False # Mock all requests, including GET
|
|
41
|
-
DRY_RUN_WRITE_ONLY = False # Only mock 'write' requests
|
|
39
|
+
# HTTP methods that apply to write-only dry-run mode
|
|
42
40
|
WRITE_HTTP_METHODS = ['PATCH', 'POST', 'PUT', 'DELETE']
|
|
43
41
|
|
|
44
42
|
# Project directories
|
|
@@ -58,6 +56,7 @@ CACHE_EXPIRATION = {
|
|
|
58
56
|
}
|
|
59
57
|
CACHE_FILE = join(CACHE_DIR, 'api_requests.db')
|
|
60
58
|
TOKEN_EXPIRATION = timedelta(hours=1)
|
|
59
|
+
JWT_EXPIRATION = timedelta(days=1)
|
|
61
60
|
|
|
62
61
|
# Response formats supported by GET /observations endpoint
|
|
63
62
|
OBSERVATION_FORMATS = ['atom', 'csv', 'dwc', 'json', 'kml', 'widget']
|
|
@@ -202,6 +201,8 @@ DATETIME_PARAMS = [
|
|
|
202
201
|
'observed_on_string',
|
|
203
202
|
'older_than',
|
|
204
203
|
'on',
|
|
204
|
+
'prefers_rule_d1',
|
|
205
|
+
'prefers_rule_d2',
|
|
205
206
|
'since',
|
|
206
207
|
'updated_since',
|
|
207
208
|
]
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
"""Type conversion utilities"""
|
|
1
|
+
"""Type conversion utilities used for both requests and responses"""
|
|
2
|
+
import re
|
|
2
3
|
from datetime import date, datetime, timedelta
|
|
4
|
+
from io import BytesIO
|
|
3
5
|
from logging import getLogger
|
|
4
|
-
from
|
|
6
|
+
from os.path import abspath, expanduser
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import IO, Any, Dict, List, MutableSequence, Optional, Union
|
|
5
9
|
from warnings import catch_warnings, simplefilter
|
|
6
10
|
|
|
7
11
|
from dateutil.parser import UnknownTimezoneWarning # type: ignore # (missing from type stubs)
|
|
8
12
|
from dateutil.parser import parse as parse_date
|
|
9
13
|
from dateutil.tz import tzlocal, tzoffset
|
|
14
|
+
from requests import Session
|
|
10
15
|
|
|
11
16
|
from pyinaturalist.constants import (
|
|
17
|
+
AnyFile,
|
|
12
18
|
Coordinates,
|
|
13
19
|
Dimensions,
|
|
14
20
|
HistogramResponse,
|
|
@@ -27,6 +33,9 @@ OBSERVATION_TIME_FIELDS = (
|
|
|
27
33
|
'time_zone_offset',
|
|
28
34
|
)
|
|
29
35
|
|
|
36
|
+
# Extremely simplified URL regex, just enough to differentiate from local paths
|
|
37
|
+
URL_PATTERN = re.compile(r'^https?://.+')
|
|
38
|
+
|
|
30
39
|
logger = getLogger(__name__)
|
|
31
40
|
|
|
32
41
|
|
|
@@ -81,7 +90,7 @@ def convert_histogram(response: JsonResponse) -> HistogramResponse:
|
|
|
81
90
|
|
|
82
91
|
def convert_csv_list(obj: Any) -> str:
|
|
83
92
|
"""Convert list parameters into an API-compatible (comma-delimited) string"""
|
|
84
|
-
if isinstance(obj, list):
|
|
93
|
+
if isinstance(obj, list) or isinstance(obj, tuple):
|
|
85
94
|
return ','.join(map(str, obj))
|
|
86
95
|
else:
|
|
87
96
|
return obj
|
|
@@ -254,10 +263,28 @@ def strip_empty_values(values: Dict) -> Dict:
|
|
|
254
263
|
return {k: v for k, v in values.items() if v or v in [False, 0, 0.0]}
|
|
255
264
|
|
|
256
265
|
|
|
257
|
-
# Type conversion functions for collections
|
|
266
|
+
# Type conversion functions for files and collections
|
|
258
267
|
# -------------------
|
|
259
268
|
|
|
260
269
|
|
|
270
|
+
def ensure_file_obj(value: AnyFile, session: Session = None) -> IO:
|
|
271
|
+
"""Load data into a file-like object, if it isn't already. Accepts local file paths and URLs."""
|
|
272
|
+
# Load from URL
|
|
273
|
+
if isinstance(value, str) and URL_PATTERN.match(value):
|
|
274
|
+
session = session or Session()
|
|
275
|
+
return session.get(value).raw
|
|
276
|
+
|
|
277
|
+
# Load from local file path
|
|
278
|
+
if isinstance(value, (str, Path)):
|
|
279
|
+
file_path = abspath(expanduser(value))
|
|
280
|
+
logger.info(f'Reading from file: {file_path}')
|
|
281
|
+
with open(file_path, 'rb') as f:
|
|
282
|
+
return BytesIO(f.read())
|
|
283
|
+
|
|
284
|
+
# Otherwise, assume it's already a file or file-like object
|
|
285
|
+
return value
|
|
286
|
+
|
|
287
|
+
|
|
261
288
|
def ensure_list(
|
|
262
289
|
value: Any, convert_csv: bool = False, delimiter: str = ','
|
|
263
290
|
) -> MutableSequence[Any]:
|