pyinaturalist 0.17.0.dev3__tar.gz → 0.17.0.dev4__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.17.0dev3 → pyinaturalist-0.17.0dev4}/HISTORY.md +2 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/PKG-INFO +2 -2
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/endpoints.md +1 -1
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/constants.py +3 -1
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/observations.py +18 -5
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/converters.py +7 -5
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/docs/templates.py +2 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/formatters.py +2 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/__init__.py +7 -1
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/base.py +21 -4
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/controlled_term.py +51 -3
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/observation.py +4 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/session.py +3 -2
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/__init__.py +1 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/observations.py +61 -32
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyproject.toml +5 -6
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/setup.py +2 -2
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/controllers/test_observation_controller.py +14 -0
- pyinaturalist-0.17.0dev4/test/sample_data/get_observation_popular_field_values.json +1260 -0
- pyinaturalist-0.17.0dev4/test/sample_data/get_observation_popular_field_values.py +352 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_converters.py +3 -3
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_models.py +42 -4
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_observations.py +32 -16
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/.readthedocs.yml +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/CONTRIBUTING.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/CONTRIBUTORS.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/LICENSE +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/README.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docker-compose.yml +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_static/collapsible_container.css +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_static/collapsible_container.js +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_static/colors.css +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_static/favicon.ico +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_static/pyinaturalist_logo.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_static/python-logo-green.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_static/table.css +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_templates/autosummary/module.rst_t +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_templates/autosummary_core/class.rst +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_templates/header.html +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_templates/localtoc.html +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_templates/module.rst_t +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/_templates/package.rst_t +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/automodapi.rst +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/code_of_conduct.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/conf.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/contributing.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/contributors.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/examples.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/history.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-new-application-complete.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-new-application.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-identifiers.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-observers.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-page-annotated.odg +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-page-annotated.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-page.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-search-bar.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-search-filters.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-observation-species-counts.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-taxon-autocomplete.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-taxon-page.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/inat-user-login.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/open-in-vscode.svg +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/password_manager_keying.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pprint_table.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo.xcf +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo_hex.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo_hex.xcf +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo_med.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo_stacked.xcf +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo_white.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/pyinaturalist_logo_white.xcf +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/python-logo-green.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/images/python-logo-green.xcf +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/index.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/pyinaturalist.controllers.rst +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/pyinaturalist.models.rst +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/reference.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/docs/user_guide.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/Data Visualizations - Matplotlib.ipynb +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/Data Visualizations - Regional Activity Report.ipynb +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/Data Visualizations - Regional Observation Stats.ipynb +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/Data Visualizations - Seaborn.ipynb +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/README.md +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/Tutorial_1_Observations.ipynb +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/Tutorial_2_Taxa.ipynb +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/Tutorial_3_Data_Visualizations.ipynb +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/__init__.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/combined_activity_stats.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/histogram_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/identifiers_by_month.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/observation_image_grid.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/observation_map.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/observations_by_date_and_time.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/observations_by_month.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/observations_by_quality_grade.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/observations_by_year.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/observers_by_month.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/taxa_by_month.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/total_observations_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/images/total_taxa_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/observation_photo_metadata.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/observations_to_gpx.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/observations_to_tsp.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/sample_data/fips_to_inat_place_ids.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/sample_data/observation_fields.parquet +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/sample_data/observations.gpx +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/sample_data/observations.tsp +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/sample_data/photo_info.html +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/sample_data/us_county_fips_codes.csv +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/examples/sample_data.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/__init__.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/auth.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/client.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/__init__.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/base.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/places.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/projects.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/taxa.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/users.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/docs/__init__.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/docs/docstrings.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/docs/emoji.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/docs/model_docs.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/docs/signatures.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/exceptions.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/comment.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/identification.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/lazy_property.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/life_list.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/message.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/observation_field.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/photo.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/place.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/project.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/search.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/taxon.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/taxon_meta.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/user.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/node_api.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/paginator.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/py.typed +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/request_params.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/rest_api.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v0/__init__.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v0/observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v0/observations.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/controlled_terms.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/identifications.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/messages.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/places.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/posts.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/projects.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/search.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/taxa.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v1/users.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/v2/__init__.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/__init__.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/conftest.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/controllers/test_place_controller.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/controllers/test_project_controller.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/controllers/test_taxon_controller.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/controllers/test_user_controller.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/docs/test_docstrings.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/docs/test_signatures.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/add_project_observation.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/create_observation_fail.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/create_observation_result.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/create_observation_v1.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_access_token.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_access_token_401.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_all_observation_identifiers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_all_observation_observers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_all_observation_species_counts_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_all_observation_species_counts_page1.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_all_observation_species_counts_page2.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_controlled_terms.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_controlled_terms_for_taxon.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_identifications.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_identifications.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_jwt.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_messages.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_nonexistent_observation.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_2.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_fields_page1.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_fields_page2.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_day.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_day.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_hour.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_hour.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_month.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_month.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_month_of_year.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_month_of_year.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_week.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_week.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_week_of_year.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_histogram_week_of_year.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_identifiers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_identifiers_node_page1.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_identifiers_node_page2.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_observers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_observers_node_page1.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_observers_node_page2.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_species_counts.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_species_counts.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_taxon_summary.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_taxon_summary_conserved.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_taxon_summary_listed.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_taxonomy.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_with_ofvs.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_with_quality_metrics.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observation_with_sounds.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations.atom +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations.csv +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations.dwc +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations.js +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations.kml +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations_node.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations_node_page1.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_observations_node_page2.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_places_autocomplete.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_places_autocomplete.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_places_by_id.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_places_by_id.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_places_nearby.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_places_nearby.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_posts_login.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_posts_project.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_projects.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_projects.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_projects_by_id.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_projects_by_id.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_projects_obs_fields.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_search.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_search.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_autocomplete.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_autocomplete.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_autocomplete_minified.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_by_id.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_by_id.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_by_id_conservation_statuses.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_map_layers.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_with_all_names.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_taxa_with_preferred_place.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_user_by_id.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_user_by_id.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_users_autocomplete.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/get_users_autocomplete.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/obs_image.jpg +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/obs_sound.wav +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/post_observation_photos.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/post_observation_photos_list.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/post_observation_sounds.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/post_observation_sounds_list.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/post_put_observation_field_value.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/put_projects.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/update_observation_result.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/upload_photos.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/upload_photos_and_sounds.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data/upload_sounds.json +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/sample_data.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_auth.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_client.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_compat.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_formatters.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_paginator.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_request_params.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/test_session.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v0/test_observation_fields_v0.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v0/test_observations_v0.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_controlled_terms.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_identifications.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_messages.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_node_api.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_places.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_posts.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_projects.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_search.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_taxa.py +0 -0
- {pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/test/v1/test_users.py +0 -0
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
[See all Issues & PRs for 0.17](https://github.com/niconoe/pyinaturalist/milestone/8?closed=1)
|
|
5
5
|
|
|
6
6
|
### New Endpoints
|
|
7
|
+
* Added new **Observation** endpoint:
|
|
8
|
+
* `get_observation_popular_field_values()`
|
|
7
9
|
* Added new **Project** endpoint and helper functions:
|
|
8
10
|
* `update_project()`
|
|
9
11
|
* `add_project_users()`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyinaturalist
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.0dev4
|
|
4
4
|
Summary: iNaturalist API client for python
|
|
5
5
|
Home-page: https://github.com/niconoe/pyinaturalist
|
|
6
6
|
License: MIT
|
|
@@ -33,7 +33,7 @@ Requires-Dist: platformdirs (>=2.5)
|
|
|
33
33
|
Requires-Dist: python-dateutil (>=2.0)
|
|
34
34
|
Requires-Dist: python-forge (>=18.6)
|
|
35
35
|
Requires-Dist: requests (>=2.22)
|
|
36
|
-
Requires-Dist: requests-cache (
|
|
36
|
+
Requires-Dist: requests-cache (>=1.0.0a0)
|
|
37
37
|
Requires-Dist: requests-ratelimiter (>=0.3.1)
|
|
38
38
|
Requires-Dist: rich (>=10.9)
|
|
39
39
|
Requires-Dist: sphinx (>=4.2.0,<5.0.0); extra == "docs"
|
|
@@ -39,7 +39,7 @@ For all available endpoints, see: <http://api.inaturalist.org/v1/docs/>
|
|
|
39
39
|
| GET | /observations/histogram | {py:func}`.get_observation_histogram`
|
|
40
40
|
| GET | /observations/identifiers | {py:func}`.get_observation_identifiers`
|
|
41
41
|
| GET | /observations/observers | {py:func}`.get_observation_observers`
|
|
42
|
-
| GET | /observations/popular_field_values |
|
|
42
|
+
| GET | /observations/popular_field_values | {py:func}`.get_observation_popular_field_values`
|
|
43
43
|
| GET | /observations/species_counts | {py:func}`.get_observation_species_counts`
|
|
44
44
|
| GET | /observations/taxonomy | {py:func}`.get_observation_taxonomy`
|
|
45
45
|
| GET | /places/{id} | {py:func}`.get_places_by_id`
|
|
@@ -10,7 +10,6 @@ from platformdirs import user_cache_dir
|
|
|
10
10
|
API_V0_BASE_URL = 'https://www.inaturalist.org'
|
|
11
11
|
API_V1_BASE_URL = 'https://api.inaturalist.org/v1'
|
|
12
12
|
API_V2_BASE_URL = 'https://api.inaturalist.org/v2'
|
|
13
|
-
DWC_ARCHIVE_URL = 'http://www.inaturalist.org/observations/gbif-observations-dwca.zip'
|
|
14
13
|
EXPORT_URL = 'https://www.inaturalist.org/observations/export'
|
|
15
14
|
INAT_BASE_URL = API_V0_BASE_URL
|
|
16
15
|
INAT_REPO = 'https://raw.githubusercontent.com/inaturalist/inaturalist/main'
|
|
@@ -54,6 +53,9 @@ CACHE_EXPIRATION = {
|
|
|
54
53
|
'api.inaturalist.org/v*/controlled_terms*': timedelta(days=7),
|
|
55
54
|
'api.inaturalist.org/v*/places*': timedelta(days=7),
|
|
56
55
|
'api.inaturalist.org/v*/taxa*': timedelta(days=7),
|
|
56
|
+
f'{PHOTO_CC_BASE_URL}/*': -1,
|
|
57
|
+
f'{PHOTO_BASE_URL}/*': -1,
|
|
58
|
+
f'{ICONIC_TAXA_BASE_URL}/*': -1,
|
|
57
59
|
'*': timedelta(minutes=30),
|
|
58
60
|
}
|
|
59
61
|
CACHE_FILE = join(CACHE_DIR, 'api_requests.db')
|
{pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/controllers/observations.py
RENAMED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
from pyinaturalist.constants import HistogramResponse, IntOrStr, ListResponse
|
|
2
2
|
from pyinaturalist.controllers import BaseController
|
|
3
3
|
from pyinaturalist.docs import document_controller_params
|
|
4
|
-
from pyinaturalist.models import
|
|
4
|
+
from pyinaturalist.models import (
|
|
5
|
+
ControlledTermCounts,
|
|
6
|
+
LifeList,
|
|
7
|
+
Observation,
|
|
8
|
+
TaxonCounts,
|
|
9
|
+
TaxonSummary,
|
|
10
|
+
UserCounts,
|
|
11
|
+
)
|
|
5
12
|
from pyinaturalist.paginator import Paginator
|
|
6
13
|
from pyinaturalist.v1 import (
|
|
7
14
|
create_observation,
|
|
@@ -9,6 +16,7 @@ from pyinaturalist.v1 import (
|
|
|
9
16
|
get_observation_histogram,
|
|
10
17
|
get_observation_identifiers,
|
|
11
18
|
get_observation_observers,
|
|
19
|
+
get_observation_popular_field_values,
|
|
12
20
|
get_observation_species_counts,
|
|
13
21
|
get_observation_taxon_summary,
|
|
14
22
|
get_observation_taxonomy,
|
|
@@ -43,15 +51,20 @@ class ObservationController(BaseController):
|
|
|
43
51
|
response = self.client.request(get_observation_identifiers, **params)
|
|
44
52
|
return UserCounts.from_json(response)
|
|
45
53
|
|
|
54
|
+
@document_controller_params(get_observation_taxonomy, add_common_args=False)
|
|
55
|
+
def life_list(self, user_id: IntOrStr, **params) -> LifeList:
|
|
56
|
+
response = self.client.request(get_observation_taxonomy, user_id=user_id, **params)
|
|
57
|
+
return LifeList.from_json(response)
|
|
58
|
+
|
|
46
59
|
@document_controller_params(get_observation_observers)
|
|
47
60
|
def observers(self, **params) -> UserCounts:
|
|
48
61
|
response = self.client.request(get_observation_observers, **params)
|
|
49
62
|
return UserCounts.from_json(response)
|
|
50
63
|
|
|
51
|
-
@document_controller_params(
|
|
52
|
-
def
|
|
53
|
-
response = self.client.request(
|
|
54
|
-
return
|
|
64
|
+
@document_controller_params(get_observation_popular_field_values)
|
|
65
|
+
def popular_fields(self, **params) -> ControlledTermCounts:
|
|
66
|
+
response = self.client.request(get_observation_popular_field_values, **params)
|
|
67
|
+
return ControlledTermCounts.from_json(response)
|
|
55
68
|
|
|
56
69
|
@document_controller_params(get_observation_species_counts)
|
|
57
70
|
def species_counts(self, **params) -> TaxonCounts:
|
|
@@ -71,17 +71,19 @@ def convert_all_timestamps(results: List[ResponseResult]) -> List[ResponseResult
|
|
|
71
71
|
return results
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
def
|
|
74
|
+
def convert_observation_histogram(response: JsonResponse) -> HistogramResponse:
|
|
75
75
|
"""Convert a response containing time series data into a single ``{date: value}`` dict"""
|
|
76
76
|
# The inner result object's key will be the name of the interval requested
|
|
77
77
|
interval = next(iter(response['results'].keys()))
|
|
78
|
-
|
|
78
|
+
return convert_histogram(response['results'][interval], interval)
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
|
|
81
|
+
def convert_histogram(result: JsonResponse, interval: str):
|
|
82
|
+
"""Convert keys to appropriate type depending on interval"""
|
|
81
83
|
if interval in ['month_of_year', 'week_of_year']:
|
|
82
|
-
return {int(k): v for k, v in
|
|
84
|
+
return {int(k): v for k, v in result.items()}
|
|
83
85
|
else:
|
|
84
|
-
return {parse_date(k): v for k, v in
|
|
86
|
+
return {parse_date(k): v for k, v in result.items()}
|
|
85
87
|
|
|
86
88
|
|
|
87
89
|
# Type conversion functions for individual results or values
|
|
@@ -202,6 +202,7 @@ def _observation_v1(
|
|
|
202
202
|
without_term_value_id: MultiInt = None,
|
|
203
203
|
acc_above: str = None,
|
|
204
204
|
acc_below: str = None,
|
|
205
|
+
acc_below_or_unknown: str = None,
|
|
205
206
|
created_d1: AnyDateTime = None,
|
|
206
207
|
created_d2: AnyDateTime = None,
|
|
207
208
|
created_on: AnyDate = None,
|
|
@@ -271,6 +272,7 @@ def _observation_v1(
|
|
|
271
272
|
Must be combined with the ``term_id`` parameter
|
|
272
273
|
acc_above: Must have an positional accuracy above this value (meters)
|
|
273
274
|
acc_below: Must have an positional accuracy below this value (meters)
|
|
275
|
+
acc_below_or_unknown: Must have an positional accuracy below this value (meters) or unknown
|
|
274
276
|
created_d1: Must be created at or after this time
|
|
275
277
|
created_d2: Must be created at or before this time
|
|
276
278
|
created_on: Must be created on this date
|
|
@@ -24,6 +24,7 @@ from pyinaturalist.models import (
|
|
|
24
24
|
BaseModelCollection,
|
|
25
25
|
Comment,
|
|
26
26
|
ControlledTerm,
|
|
27
|
+
ControlledTermCount,
|
|
27
28
|
ControlledTermValue,
|
|
28
29
|
Identification,
|
|
29
30
|
LifeList,
|
|
@@ -115,6 +116,7 @@ UNIQUE_RESPONSE_ATTRS = {
|
|
|
115
116
|
'thread_id': Message,
|
|
116
117
|
'body': Comment, # Subset of ID attrs; if it's not an ID, assume it's a comment
|
|
117
118
|
'multivalued': ControlledTerm,
|
|
119
|
+
'controlled_value': ControlledTermCount,
|
|
118
120
|
'blocking': ControlledTermValue,
|
|
119
121
|
'count_without_taxon': LifeList,
|
|
120
122
|
'captive': Observation,
|
|
@@ -75,7 +75,13 @@ from pyinaturalist.models.taxon_meta import (
|
|
|
75
75
|
TaxonSummary,
|
|
76
76
|
)
|
|
77
77
|
from pyinaturalist.models.taxon import Taxon, TaxonCount, TaxonCounts
|
|
78
|
-
from pyinaturalist.models.controlled_term import
|
|
78
|
+
from pyinaturalist.models.controlled_term import (
|
|
79
|
+
Annotation,
|
|
80
|
+
ControlledTerm,
|
|
81
|
+
ControlledTermCount,
|
|
82
|
+
ControlledTermCounts,
|
|
83
|
+
ControlledTermValue,
|
|
84
|
+
)
|
|
79
85
|
from pyinaturalist.models.comment import Comment
|
|
80
86
|
from pyinaturalist.models.identification import Identification
|
|
81
87
|
from pyinaturalist.models.life_list import LifeList, LifeListTaxon
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Base class and utilities for data models"""
|
|
2
2
|
import json
|
|
3
3
|
from collections import UserList
|
|
4
|
+
from copy import deepcopy
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from logging import getLogger
|
|
6
7
|
from os.path import expanduser
|
|
@@ -31,6 +32,14 @@ class BaseModel:
|
|
|
31
32
|
temp_attrs: List[str] = []
|
|
32
33
|
headers: Dict[str, str] = {}
|
|
33
34
|
|
|
35
|
+
@classmethod
|
|
36
|
+
def copy(cls, obj: 'BaseModel') -> 'BaseModel':
|
|
37
|
+
"""Copy a model object. This is defined as a classmethod to easily initialize a subclass
|
|
38
|
+
from a parent class instance. For copying an instance to the same type,
|
|
39
|
+
:py:func:`copy.deepcopy` can be used.
|
|
40
|
+
"""
|
|
41
|
+
return cls(**obj.to_dict(recurse=False))
|
|
42
|
+
|
|
34
43
|
@classmethod
|
|
35
44
|
def from_json(cls: Type[T], value: JsonResponse, **kwargs) -> T:
|
|
36
45
|
"""Initialize a single model object from an API response or response result.
|
|
@@ -64,10 +73,13 @@ class BaseModel:
|
|
|
64
73
|
"""Get values and headers to display as a row in a table"""
|
|
65
74
|
raise NotImplementedError
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
def to_dict(self, **kwargs) -> JsonResponse:
|
|
77
|
+
"""Convert this object back to dict format"""
|
|
78
|
+
|
|
79
|
+
def vs(_inst, _key, value):
|
|
80
|
+
return value.to_dict() if isinstance(value, BaseModel) else value
|
|
81
|
+
|
|
82
|
+
return {k.lstrip('_'): v for k, v in asdict(self, value_serializer=vs, **kwargs).items()}
|
|
71
83
|
|
|
72
84
|
def __rich_repr__(self):
|
|
73
85
|
"""Custom output to use when pretty-printed with rich. Compared to default rich behavior for
|
|
@@ -111,6 +123,11 @@ class BaseModelCollection(BaseModel, UserList, Generic[T]):
|
|
|
111
123
|
data: List[T] = field(factory=list, init=False, repr=False)
|
|
112
124
|
_id_map: Dict[int, T] = field(default=None, init=False, repr=False)
|
|
113
125
|
|
|
126
|
+
@classmethod
|
|
127
|
+
def copy(cls, obj):
|
|
128
|
+
"""Copy a model collection"""
|
|
129
|
+
return cls(data=[deepcopy(item) for item in obj])
|
|
130
|
+
|
|
114
131
|
@classmethod
|
|
115
132
|
def from_json(cls: Type[TC], value: JsonResponse, **kwargs) -> TC:
|
|
116
133
|
if 'results' in value:
|
{pyinaturalist-0.17.0dev3 → pyinaturalist-0.17.0dev4}/pyinaturalist/models/controlled_term.py
RENAMED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
from typing import List
|
|
1
|
+
from typing import Dict, List
|
|
2
2
|
|
|
3
|
-
from pyinaturalist.constants import TableRow
|
|
4
|
-
from pyinaturalist.models import
|
|
3
|
+
from pyinaturalist.constants import JsonResponse, TableRow
|
|
4
|
+
from pyinaturalist.models import (
|
|
5
|
+
BaseModel,
|
|
6
|
+
LazyProperty,
|
|
7
|
+
User,
|
|
8
|
+
define_model,
|
|
9
|
+
define_model_collection,
|
|
10
|
+
field,
|
|
11
|
+
)
|
|
12
|
+
from pyinaturalist.models.base import BaseModelCollection
|
|
5
13
|
|
|
6
14
|
|
|
7
15
|
@define_model
|
|
@@ -94,3 +102,43 @@ class ControlledTerm(BaseModel):
|
|
|
94
102
|
|
|
95
103
|
def __str__(self):
|
|
96
104
|
return f'[{self.id}] {self.label}: {self.value_labels}'
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@define_model
|
|
108
|
+
class ControlledTermCount(BaseModel):
|
|
109
|
+
""":fa:`tag` A count + histogram of a controlled term and value"""
|
|
110
|
+
|
|
111
|
+
count: int = field(default=0, doc='')
|
|
112
|
+
histogram: Dict[int, int] = field(factory=dict)
|
|
113
|
+
term = LazyProperty(ControlledTerm.from_json, type=ControlledTerm)
|
|
114
|
+
value = LazyProperty(ControlledTermValue.from_json, type=ControlledTermValue)
|
|
115
|
+
|
|
116
|
+
@classmethod
|
|
117
|
+
def from_json(cls, value: JsonResponse, user_id: int = None, **kwargs) -> 'ControlledTermCount':
|
|
118
|
+
"""Rename some response fields before initializing"""
|
|
119
|
+
value['histogram'] = value.pop('month_of_year', None)
|
|
120
|
+
value['term'] = value.pop('controlled_attribute', None)
|
|
121
|
+
value['value'] = value.pop('controlled_value', None)
|
|
122
|
+
return super(ControlledTermCount, cls).from_json(value)
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def row(self) -> TableRow:
|
|
126
|
+
return {
|
|
127
|
+
'Term': self.term.label,
|
|
128
|
+
'Value': self.value.label,
|
|
129
|
+
'Count': self.count,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
def __str__(self) -> str:
|
|
133
|
+
return f'{self.term.label}={self.value.label}: {self.count}'
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@define_model_collection
|
|
137
|
+
class ControlledTermCounts(BaseModelCollection):
|
|
138
|
+
""":fa:`tag` :fa:`list` Used with
|
|
139
|
+
:v1:`GET /observations/popular_field_values <Observations/get_observations_popular_field_values>`.
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
data: List[ControlledTermCount] = field(
|
|
143
|
+
factory=list, converter=ControlledTermCount.from_json_list
|
|
144
|
+
)
|
|
@@ -8,6 +8,7 @@ from pyinaturalist.constants import (
|
|
|
8
8
|
ALL_LICENSES,
|
|
9
9
|
DATETIME_SHORT_FORMAT,
|
|
10
10
|
GEOPRIVACY_LEVELS,
|
|
11
|
+
INAT_BASE_URL,
|
|
11
12
|
QUALITY_GRADES,
|
|
12
13
|
Coordinates,
|
|
13
14
|
DateTime,
|
|
@@ -219,6 +220,9 @@ class Observation(BaseModel):
|
|
|
219
220
|
observed_on_string, tz_offset, tz_name, ignoretz=True
|
|
220
221
|
)
|
|
221
222
|
|
|
223
|
+
if not kwargs.get('uri'):
|
|
224
|
+
kwargs['uri'] = f'{INAT_BASE_URL}/observations/{kwargs.get("id", "")}'
|
|
225
|
+
|
|
222
226
|
self.__attrs_init__(**kwargs) # type: ignore
|
|
223
227
|
|
|
224
228
|
@classmethod
|
|
@@ -125,6 +125,7 @@ class ClientSession(CacheMixin, LimiterMixin, Session):
|
|
|
125
125
|
per_second=per_second,
|
|
126
126
|
per_minute=per_minute,
|
|
127
127
|
per_day=per_day,
|
|
128
|
+
per_host=True,
|
|
128
129
|
burst=burst,
|
|
129
130
|
max_delay=MAX_DELAY,
|
|
130
131
|
**kwargs,
|
|
@@ -144,14 +145,14 @@ class ClientSession(CacheMixin, LimiterMixin, Session):
|
|
|
144
145
|
adapter = HTTPAdapter(max_retries=retry)
|
|
145
146
|
self.mount('https://', adapter)
|
|
146
147
|
|
|
147
|
-
def send(
|
|
148
|
+
def send( # type: ignore # Adds kwargs not present in Session.send()
|
|
148
149
|
self,
|
|
149
150
|
request: PreparedRequest,
|
|
150
151
|
expire_after: ExpirationTime = None,
|
|
151
152
|
refresh: bool = False,
|
|
152
153
|
timeout: int = None,
|
|
153
154
|
**kwargs,
|
|
154
|
-
) -> Response:
|
|
155
|
+
) -> Response:
|
|
155
156
|
"""Send a request with caching, rate-limiting, and retries
|
|
156
157
|
|
|
157
158
|
Args:
|
|
@@ -42,6 +42,7 @@ from pyinaturalist.v1.observations import (
|
|
|
42
42
|
get_observation_histogram,
|
|
43
43
|
get_observation_identifiers,
|
|
44
44
|
get_observation_observers,
|
|
45
|
+
get_observation_popular_field_values,
|
|
45
46
|
get_observation_species_counts,
|
|
46
47
|
get_observation_taxon_summary,
|
|
47
48
|
get_observation_taxonomy,
|
|
@@ -14,6 +14,7 @@ from pyinaturalist.converters import (
|
|
|
14
14
|
convert_all_timestamps,
|
|
15
15
|
convert_generic_timestamps,
|
|
16
16
|
convert_histogram,
|
|
17
|
+
convert_observation_histogram,
|
|
17
18
|
convert_observation_timestamps,
|
|
18
19
|
ensure_list,
|
|
19
20
|
)
|
|
@@ -110,7 +111,7 @@ def get_observation_histogram(**params) -> HistogramResponse:
|
|
|
110
111
|
'week of year' intervals, and :py:class:`~datetime.datetime` objects for all other intervals.
|
|
111
112
|
"""
|
|
112
113
|
response = get_v1('observations/histogram', **params)
|
|
113
|
-
return
|
|
114
|
+
return convert_observation_histogram(response.json())
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
@document_request_params(*docs._get_observations, docs._pagination, docs._only_id)
|
|
@@ -162,35 +163,34 @@ def get_observations(**params) -> JsonResponse:
|
|
|
162
163
|
|
|
163
164
|
|
|
164
165
|
@document_request_params(*docs._get_observations, docs._pagination)
|
|
165
|
-
def
|
|
166
|
-
"""Get
|
|
167
|
-
|
|
168
|
-
**Leaf taxa** are the leaves of the taxonomic tree, e.g., species, subspecies, variety, etc.
|
|
166
|
+
def get_observation_identifiers(**params) -> JsonResponse:
|
|
167
|
+
"""Get identifiers of observations matching the search criteria and the count of
|
|
168
|
+
observations they have identified. By default, results are sorted by ID count in descending.
|
|
169
169
|
|
|
170
170
|
.. rubric:: Notes
|
|
171
171
|
|
|
172
|
-
* API reference: :v1:`GET /observations/
|
|
172
|
+
* API reference: :v1:`GET /observations/identifiers <Observations/get_observations_identifiers>`
|
|
173
|
+
* This endpoint will only return up to 500 results.
|
|
173
174
|
|
|
174
175
|
Example:
|
|
175
|
-
>>> response =
|
|
176
|
+
>>> response = get_observation_identifiers(place_id=72645)
|
|
176
177
|
>>> pprint(response)
|
|
177
|
-
[
|
|
178
|
-
[
|
|
179
|
-
[
|
|
180
|
-
...
|
|
178
|
+
[409010 ] jdoe42 (Jane Doe)
|
|
179
|
+
[691216 ] jbrown252 (James Brown)
|
|
180
|
+
[3959037 ] tnsparkleberry
|
|
181
181
|
|
|
182
182
|
.. admonition:: Example Response
|
|
183
183
|
:class: toggle
|
|
184
184
|
|
|
185
|
-
.. literalinclude:: ../sample_data/
|
|
185
|
+
.. literalinclude:: ../sample_data/get_observation_identifiers_ex_results.json
|
|
186
|
+
:language: JSON
|
|
186
187
|
|
|
187
188
|
Returns:
|
|
188
|
-
Response dict
|
|
189
|
+
Response dict of identifiers
|
|
189
190
|
"""
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return get_v1('observations/species_counts', **params).json()
|
|
191
|
+
params.setdefault('per_page', 500)
|
|
192
|
+
response = get_v1('observations/identifiers', **params)
|
|
193
|
+
return response.json()
|
|
194
194
|
|
|
195
195
|
|
|
196
196
|
@document_request_params(*docs._get_observations, docs._pagination)
|
|
@@ -228,34 +228,63 @@ def get_observation_observers(**params) -> JsonResponse:
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
@document_request_params(*docs._get_observations, docs._pagination)
|
|
231
|
-
def
|
|
232
|
-
"""Get
|
|
233
|
-
|
|
231
|
+
def get_observation_species_counts(**params) -> JsonResponse:
|
|
232
|
+
"""Get all species (or other 'leaf taxa') associated with observations matching the search
|
|
233
|
+
criteria, and the count of observations they are associated with.
|
|
234
|
+
**Leaf taxa** are the leaves of the taxonomic tree, e.g., species, subspecies, variety, etc.
|
|
234
235
|
|
|
235
236
|
.. rubric:: Notes
|
|
236
237
|
|
|
237
|
-
* API reference: :v1:`GET /observations/
|
|
238
|
-
* This endpoint will only return up to 500 results.
|
|
238
|
+
* API reference: :v1:`GET /observations/species_counts <Observations/get_observations_species_counts>`
|
|
239
239
|
|
|
240
240
|
Example:
|
|
241
|
-
>>> response =
|
|
241
|
+
>>> response = get_observation_species_counts(user_login='my_username', quality_grade='research')
|
|
242
242
|
>>> pprint(response)
|
|
243
|
-
[
|
|
244
|
-
[
|
|
245
|
-
[
|
|
243
|
+
[62060] Species: Palomena prasina (Green Shield Bug): 10
|
|
244
|
+
[84804] Species: Graphosoma italicum (European Striped Shield Bug): 8
|
|
245
|
+
[55727] Species: Cymbalaria muralis (Ivy-leaved toadflax): 3
|
|
246
|
+
...
|
|
246
247
|
|
|
247
248
|
.. admonition:: Example Response
|
|
248
249
|
:class: toggle
|
|
249
250
|
|
|
250
|
-
.. literalinclude:: ../sample_data/
|
|
251
|
-
:language: JSON
|
|
251
|
+
.. literalinclude:: ../sample_data/get_observation_species_counts.py
|
|
252
252
|
|
|
253
253
|
Returns:
|
|
254
|
-
Response dict
|
|
254
|
+
Response dict containing taxon records with counts
|
|
255
255
|
"""
|
|
256
|
-
params.
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
if params.get('page') == 'all':
|
|
257
|
+
return paginate_all(get_v1, 'observations/species_counts', **params)
|
|
258
|
+
else:
|
|
259
|
+
return get_v1('observations/species_counts', **params).json()
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
@document_request_params(*docs._get_observations)
|
|
263
|
+
def get_observation_popular_field_values(**params) -> JsonResponse:
|
|
264
|
+
"""Get controlled terms values and a monthly histogram of observations matching the search
|
|
265
|
+
|
|
266
|
+
.. rubric:: Notes
|
|
267
|
+
|
|
268
|
+
* API reference: :v1:`GET /observations/popular_field_values <Observations/get_observations_popular_field_values>`
|
|
269
|
+
|
|
270
|
+
Example:
|
|
271
|
+
>>> response = get_observation_popular_field_values(
|
|
272
|
+
... species_name='Danaus plexippus', place_id=24,
|
|
273
|
+
... )
|
|
274
|
+
|
|
275
|
+
.. admonition:: Example Response
|
|
276
|
+
:class: toggle
|
|
277
|
+
|
|
278
|
+
.. literalinclude:: ../sample_data/get_observation_popular_field_values.py
|
|
279
|
+
|
|
280
|
+
Returns:
|
|
281
|
+
Response dict. Each record contains a ``count``, a ``month_of_year`` histogram, a
|
|
282
|
+
``controlled_attribute``, and a ``controlled_value``.
|
|
283
|
+
"""
|
|
284
|
+
response_json = get_v1('observations/popular_field_values', **params).json()
|
|
285
|
+
for r in response_json['results']:
|
|
286
|
+
r['month_of_year'] = convert_histogram(r['month_of_year'], interval='month_of_year')
|
|
287
|
+
return response_json
|
|
259
288
|
|
|
260
289
|
|
|
261
290
|
def get_observation_taxonomy(user_id: IntOrStr = None, **params) -> JsonResponse:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyinaturalist"
|
|
3
|
-
version = "0.17.0.
|
|
3
|
+
version = "0.17.0.dev4"
|
|
4
4
|
description = "iNaturalist API client for python"
|
|
5
5
|
authors = ["Nicolas Noé <nicolas@niconoe.eu>", "Jordan Cook <Jordan.Cook@pioneer.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -34,7 +34,7 @@ platformdirs = ">=2.5"
|
|
|
34
34
|
python-dateutil = ">=2.0"
|
|
35
35
|
python-forge = ">=18.6"
|
|
36
36
|
requests = ">=2.22"
|
|
37
|
-
requests-cache = "
|
|
37
|
+
requests-cache = ">=1.0.0a0"
|
|
38
38
|
requests-ratelimiter = ">=0.3.1"
|
|
39
39
|
rich = ">=10.9"
|
|
40
40
|
|
|
@@ -54,15 +54,14 @@ sphinx-panels = {optional=true, version="^0.6.0"}
|
|
|
54
54
|
sphinxcontrib-apidoc = {optional=true, version="^0.3"}
|
|
55
55
|
|
|
56
56
|
[tool.poetry.dev-dependencies]
|
|
57
|
-
coverage = "
|
|
58
|
-
mypy = "^0.910"
|
|
57
|
+
coverage = ">=6.3"
|
|
59
58
|
nox = "^2021.10.1"
|
|
60
59
|
nox-poetry = "^0.9.0"
|
|
61
|
-
pre-commit = "^2.
|
|
60
|
+
pre-commit = "^2.19"
|
|
62
61
|
pretty-errors = "^1.2.23"
|
|
63
62
|
pytest = "^7.0"
|
|
64
63
|
pytest-asyncio = "^0.18.1"
|
|
65
|
-
pytest-cov = ">=
|
|
64
|
+
pytest-cov = ">=3.0"
|
|
66
65
|
pytest-xdist = ">=2.2"
|
|
67
66
|
requests-mock = "^1.8"
|
|
68
67
|
sphinx-autobuild = ">=2021.3.14"
|
|
@@ -19,7 +19,7 @@ install_requires = \
|
|
|
19
19
|
'platformdirs>=2.5',
|
|
20
20
|
'python-dateutil>=2.0',
|
|
21
21
|
'python-forge>=18.6',
|
|
22
|
-
'requests-cache
|
|
22
|
+
'requests-cache>=1.0.0a0',
|
|
23
23
|
'requests-ratelimiter>=0.3.1',
|
|
24
24
|
'requests>=2.22',
|
|
25
25
|
'rich>=10.9']
|
|
@@ -40,7 +40,7 @@ extras_require = \
|
|
|
40
40
|
|
|
41
41
|
setup_kwargs = {
|
|
42
42
|
'name': 'pyinaturalist',
|
|
43
|
-
'version': '0.17.
|
|
43
|
+
'version': '0.17.0dev4',
|
|
44
44
|
'description': 'iNaturalist API client for python',
|
|
45
45
|
'long_description': "# pyinaturalist\n\n[](https://github.com/niconoe/pyinaturalist/actions)\n[](https://codecov.io/gh/niconoe/pyinaturalist)\n[](https://pyinaturalist.readthedocs.io)\n\n[](https://pypi.org/project/pyinaturalist)\n[](https://anaconda.org/conda-forge/pyinaturalist)\n[](https://pypi.org/project/pyinaturalist)\n\n[](https://mybinder.org/v2/gh/niconoe/pyinaturalist/main?urlpath=lab/tree/examples)\n[](https://open.vscode.dev/niconoe/pyinaturalist)\n\n<br/>\n\n[](https://pyinaturalist.readthedocs.io)\n\n# Introduction\n[**iNaturalist**](https://www.inaturalist.org) is a community science platform that helps people\nget involved in the natural world by observing and identifying the living things around them.\nCollectively, the community produces a rich source of global biodiversity data that can be valuable\nto anyone from hobbyists to scientists.\n\n**pyinaturalist** is a client for the [iNaturalist API](https://api.inaturalist.org/v1) that makes\nthese data easily accessible in the python programming language.\n\n- [Features](#features)\n- [Quickstart](#quickstart)\n- [Next Steps](#next-steps)\n- [Feedback](#feedback)\n- [Related Projects](#related-projects)\n\n## Features\n* ➡️ **Easier requests:** Simplified request formats, easy pagination, and complete request\n parameter type annotations for better IDE integration\n* ⬅️ **Convenient responses:** Type conversions to the things you would expect in python, and an\n optional object-oriented inteface for response data\n* 🔒 **Security:** Keyring integration for secure credential storage\n* 📗 **Docs:** Example requests, responses, scripts, and Jupyter notebooks to help get you started\n* 💚 **Responsible use:** Follows the\n [API Recommended Practices](https://www.inaturalist.org/pages/api+recommended+practices),\n by default, so you can be nice to the iNaturalist servers and not worry about rate-limiting errors\n* 🧪 **Testing:** A dry-run testing mode to preview your requests before potentially modifying data\n\n### Supported Endpoints\nMany of the most relevant API endpoints are supported, including:\n* 📝 Annotations and observation fields\n* 🆔 Identifications\n* 💬 Messages\n* 👀 Observations (multiple formats)\n* 📷 Observation photos + sounds\n* 📊 Observation observers, identifiers, histograms, life lists, and species counts\n* 📍 Places\n* 👥 Projects\n* 🐦Species\n* 👤 Users\n\n## Quickstart\nHere are usage examples for some of the most commonly used features.\n\nFirst, install with pip:\n```bash\npip install pyinaturalist\n```\n\nThen, import the main API functions:\n```python\nfrom pyinaturalist import *\n```\n\n### Search observations\nLet's start by searching for all your own observations. There are\n[numerous fields you can search on](https://pyinaturalist.readthedocs.io/en/stable/modules/pyinaturalist.v1.observations.html#pyinaturalist.v1.observations.create_observation), but we'll just use `user_id` for now:\n```python\n>>> observations = get_observations(user_id='my_username')\n```\n\nThe full response will be in JSON format, but we can just print out a few basic details:\n```python\n>>> for obs in observations['results']:\n>>> pprint(obs)\n[78242978] Species: Agelastica alni (Alder Leaf Beetle) observed by niconoe on 2021-05-10 18:45:38+01:00 at 1428 Braine-l'Alleud, Belgique\n[78218860] Genus: Bradybatus observed by niconoe on 2021-05-10 15:22:49+01:00 at 1428 Braine-l'Alleud, Belgique\n...\n```\n\nYou can also get\n[observation counts by species](https://pyinaturalist.readthedocs.io/en/stable/modules/pyinaturalist.v1.observations.html#pyinaturalist.v1.observations.get_observation_species_counts).\nOn iNaturalist.org, this information can be found on the 'Species' tab of search results.\nFor example, to get the counts of all your own research-grade observations:\n```python\n>>> counts = get_observation_species_counts(user_id='my_username', quality_grade='research')\n>>> pprint(counts)\n[48473 ]: Species: Ganoderma applanatum (Artist's bracket): 4\n[50310 ]: Species: Arisaema triphyllum (Jack-in-the-pulpit): 4\n[50817 ]: Genus: Auricularia (Wood ear fungi): 3\n[81599 ]: Species: Silphium perfoliatum (Cup plant): 3\n[120215 ]: Species: Bombus griseocollis (Brown-belted Bumble Bee): 2\n...\n```\n\nAnother useful format is the\n[observation histogram](https://pyinaturalist.readthedocs.io/en/stable/modules/pyinaturalist.v1.observations.html#pyinaturalist.v1.observations.get_observation_histogram),\nwhich shows the number of observations over a given interval. The default is `month_of_year`:\n```python\n>>> histogram = get_observation_histogram(user_id='my_username')\n>>> print(histogram)\n{\n 1: 8, # January\n 2: 1, # February\n 3: 19, # March\n ..., # etc.\n}\n```\n\n### Create and update observations\nTo create or modify observations, you will first need to log in.\nThis requires creating an [iNaturalist app](https://www.inaturalist.org/oauth/applications/new),\nwhich will be used to get an access token.\n```python\ntoken = get_access_token(\n username='my_username',\n password='my_password',\n app_id='my_app_id',\n app_secret='my_app_secret',\n)\n```\nSee\n[Authentication](https://pyinaturalist.readthedocs.io/en/latest/user_guide.html#authentication)\nfor additional authentication options, including environment variables, keyrings, and password managers.\n\nNow we can [create a new observation](https://pyinaturalist.readthedocs.io/en/stable/modules/pyinaturalist.v1.observations.html#pyinaturalist.v1.observations.create_observation):\n```python\nfrom datetime import datetime\n\nresponse = create_observation(\n taxon_id=54327, # Vespa Crabro\n observed_on_string=datetime.now(),\n time_zone='Brussels',\n description='This is a free text comment for the observation',\n tag_list='wasp, Belgium',\n latitude=50.647143,\n longitude=4.360216,\n positional_accuracy=50, # GPS accuracy in meters\n access_token=token,\n photos=['~/observations/wasp1.jpg', '~/observations/wasp2.jpg'],\n)\n\n# Save the new observation ID\nnew_observation_id = response[0]['id']\n```\n\nWe can then [update the observation](https://pyinaturalist.readthedocs.io/en/stable/modules/pyinaturalist.v1.observations.html#pyinaturalist.v1.observations.update_observation) information, photos, or sounds:\n```python\nupdate_observation(\n 17932425,\n access_token=token,\n description='updated description !',\n photos='~/observations/wasp_nest.jpg',\n sounds='~/observations/wasp_nest.mp3',\n)\n```\n\n### Search species\nLet's say you partially remember either a genus or family name that started with **'vespi'**-something.\nThe [taxa endpoint](https://pyinaturalist.readthedocs.io/en/stable/modules/pyinaturalist.v1.taxa.html#pyinaturalist.v1.taxa.get_taxa)\ncan be used to search by name, rank, and several other criteria\n```python\n>>> response = get_taxa(q='vespi', rank=['genus', 'family'])\n```\n\nAs with observations, there is a lot of information in the response, but we'll print just a few basic details:\n```python\n>>> pprint(response)\n[52747] Family: Vespidae (Hornets, Paper Wasps, Potter Wasps, and Allies)\n[92786] Genus: Vespicula\n[84737] Genus: Vespina\n...\n```\n\n## Next Steps\nFor more information, see:\n\n* [User Guide](https://pyinaturalist.readthedocs.io/en/latest/user_guide.html):\n introduction and general features that apply to most endpoints\n* [Endpoint Summary](https://pyinaturalist.readthedocs.io/en/latest/endpoints.html):\n a complete list of endpoints wrapped by pyinaturalist\n* [Examples](https://pyinaturalist.readthedocs.io/en/stable/examples.html):\n data visualizations and other examples of things to do with iNaturalist data\n* [Reference](https://pyinaturalist.readthedocs.io/en/latest/reference.html): Detailed API documentation\n* [Contributing Guide](https://pyinaturalist.readthedocs.io/en/stable/contributing.html):\n development details for anyone interested in contributing to pyinaturalist\n* [History](https://github.com/niconoe/pyinaturalist/blob/dev/HISTORY.md):\n details on past and current releases\n* [Issues](https://github.com/niconoe/pyinaturalist/issues): planned & proposed features\n\n## Feedback\nIf you have any problems, suggestions, or questions about pyinaturalist, please let us know!\nJust [create an issue](https://github.com/niconoe/pyinaturalist/issues/new/choose).\nAlso, **PRs are welcome!**\n\n**Note:** pyinaturalist is developed by members of the iNaturalist community, and is not endorsed by\niNaturalist.org or the California Academy of Sciences. If you have non-python-specific questions\nabout iNaturalist, the [iNaturalist Community Forum](https://forum.inaturalist.org/) is the best\nplace to start.\n\n## Related Projects\nOther python projects related to iNaturalist:\n\n* [Dronefly](https://github.com/synrg/dronefly): A Discord bot with iNaturalist integration, used by the iNaturalist Discord server.\n* [pyinaturalist-convert](https://github.com/JWCook/pyinaturalist-convert): Tools to convert observation data to and from multiple formats\n* [pyinaturalist-open-data](https://github.com/JWCook/pyinaturalist-open-data): Tools for working with [iNaturalist open data](https://registry.opendata.aws/inaturalist-open-data/)\n* [pyinaturalist-notebook](https://github.com/JWCook/pyinaturalist-notebook): Jupyter notebook Docker image for pyinaturalist\n",
|
|
46
46
|
'author': 'Nicolas Noé',
|
|
@@ -111,6 +111,20 @@ def test_life_list(requests_mock):
|
|
|
111
111
|
assert results[0].descendant_obs_count == results.get_count(1) == 3023
|
|
112
112
|
|
|
113
113
|
|
|
114
|
+
def test_popular_fields(requests_mock):
|
|
115
|
+
requests_mock.get(
|
|
116
|
+
f'{API_V1_BASE_URL}/observations/popular_field_values',
|
|
117
|
+
json=SAMPLE_DATA['get_observation_popular_field_values'],
|
|
118
|
+
status_code=200,
|
|
119
|
+
)
|
|
120
|
+
client = iNatClient()
|
|
121
|
+
results = client.observations.popular_fields(species_name='Danaus plexippus', place_id=24)
|
|
122
|
+
assert results[0].count == 231
|
|
123
|
+
assert results[0].histogram[10] == 29
|
|
124
|
+
assert results[0].term.id == 1
|
|
125
|
+
assert results[0].value.label == 'Adult'
|
|
126
|
+
|
|
127
|
+
|
|
114
128
|
def test_species_counts(requests_mock):
|
|
115
129
|
requests_mock.get(
|
|
116
130
|
f'{API_V1_BASE_URL}/observations/species_counts',
|