pyinaturalist 0.17.0.dev1__tar.gz → 0.17.0.dev3__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.0dev1 → pyinaturalist-0.17.0dev3}/HISTORY.md +8 -3
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/PKG-INFO +5 -5
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/README.md +2 -2
- pyinaturalist-0.17.0dev3/docs/images/open-in-vscode.svg +1 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/user_guide.md +8 -1
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/observation_photo_metadata.py +2 -1
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/sample_data.py +3 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/__init__.py +2 -1
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/auth.py +7 -5
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/client.py +11 -3
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/constants.py +6 -3
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/controllers/__init__.py +1 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/controllers/observations.py +1 -1
- pyinaturalist-0.17.0dev3/pyinaturalist/controllers/places.py +37 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/controllers/projects.py +22 -2
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/formatters.py +41 -40
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/__init__.py +4 -8
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/base.py +34 -2
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/lazy_property.py +0 -5
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/observation.py +21 -6
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/photo.py +15 -2
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/place.py +1 -1
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/taxon.py +4 -2
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/paginator.py +71 -15
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/session.py +50 -8
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/observations.py +1 -1
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/places.py +17 -26
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/projects.py +18 -6
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyproject.toml +8 -8
- pyinaturalist-0.17.0dev3/setup.py +59 -0
- pyinaturalist-0.17.0dev3/test/controllers/test_place_controller.py +73 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/controllers/test_project_controller.py +16 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations_node_page1.json +1 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_formatters.py +50 -40
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_models.py +37 -1
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_session.py +34 -6
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_places.py +5 -6
- pyinaturalist-0.17.0dev1/setup.py +0 -59
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/.readthedocs.yml +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/CONTRIBUTING.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/CONTRIBUTORS.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/LICENSE +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docker-compose.yml +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_static/collapsible_container.css +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_static/collapsible_container.js +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_static/colors.css +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_static/favicon.ico +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_static/pyinaturalist_logo.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_static/python-logo-green.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_static/table.css +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_templates/autosummary/module.rst_t +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_templates/autosummary_core/class.rst +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_templates/header.html +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_templates/localtoc.html +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_templates/module.rst_t +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/_templates/package.rst_t +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/automodapi.rst +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/code_of_conduct.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/conf.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/contributing.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/contributors.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/endpoints.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/examples.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/history.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-new-application-complete.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-new-application.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-identifiers.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-observers.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-page-annotated.odg +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-page-annotated.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-page.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-search-bar.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-search-filters.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-observation-species-counts.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-taxon-autocomplete.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-taxon-page.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/inat-user-login.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/password_manager_keying.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pprint_table.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo.xcf +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo_hex.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo_hex.xcf +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo_med.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo_stacked.xcf +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo_white.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/pyinaturalist_logo_white.xcf +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/python-logo-green.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/images/python-logo-green.xcf +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/index.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/pyinaturalist.controllers.rst +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/pyinaturalist.models.rst +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/docs/reference.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/Data Visualizations - Matplotlib.ipynb +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/Data Visualizations - Regional Activity Report.ipynb +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/Data Visualizations - Regional Observation Stats.ipynb +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/Data Visualizations - Seaborn.ipynb +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/README.md +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/Tutorial_1_Observations.ipynb +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/Tutorial_2_Taxa.ipynb +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/Tutorial_3_Data_Visualizations.ipynb +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/__init__.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/combined_activity_stats.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/histogram_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/identifiers_by_month.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/observation_image_grid.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/observation_map.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/observations_by_date_and_time.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/observations_by_month.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/observations_by_quality_grade.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/observations_by_year.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/observers_by_month.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/taxa_by_month.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/total_observations_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/images/total_taxa_by_iconic_taxon.png +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/observations_to_gpx.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/observations_to_tsp.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/sample_data/fips_to_inat_place_ids.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/sample_data/observation_fields.parquet +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/sample_data/observations.gpx +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/sample_data/observations.tsp +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/sample_data/photo_info.html +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/sample_data/us_county_fips_codes.csv +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/controllers/base.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/controllers/taxa.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/controllers/users.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/converters.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/docs/__init__.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/docs/docstrings.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/docs/emoji.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/docs/model_docs.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/docs/signatures.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/docs/templates.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/exceptions.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/comment.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/controlled_term.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/identification.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/life_list.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/message.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/observation_field.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/project.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/search.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/taxon_meta.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/models/user.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/node_api.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/py.typed +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/request_params.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/rest_api.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v0/__init__.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v0/observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v0/observations.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/__init__.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/controlled_terms.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/identifications.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/messages.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/posts.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/search.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/taxa.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v1/users.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/v2/__init__.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/__init__.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/conftest.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/controllers/test_observation_controller.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/controllers/test_taxon_controller.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/controllers/test_user_controller.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/docs/test_docstrings.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/docs/test_signatures.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/add_project_observation.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/create_observation_fail.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/create_observation_result.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/create_observation_v1.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_access_token.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_access_token_401.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_all_observation_identifiers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_all_observation_observers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_all_observation_species_counts_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_all_observation_species_counts_page1.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_all_observation_species_counts_page2.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_controlled_terms.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_controlled_terms_for_taxon.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_identifications.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_identifications.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_jwt.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_messages.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_nonexistent_observation.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_2.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_fields_page1.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_fields_page2.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_day.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_day.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_hour.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_hour.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_month.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_month.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_month_of_year.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_month_of_year.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_week.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_week.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_week_of_year.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_histogram_week_of_year.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_identifiers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_identifiers_node_page1.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_identifiers_node_page2.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_observers_ex_results.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_observers_node_page1.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_observers_node_page2.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_species_counts.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_species_counts.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_taxon_summary.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_taxon_summary_conserved.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_taxon_summary_listed.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_taxonomy.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_with_ofvs.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_with_quality_metrics.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observation_with_sounds.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations.atom +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations.csv +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations.dwc +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations.js +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations.kml +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations_node.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_observations_node_page2.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_places_autocomplete.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_places_autocomplete.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_places_by_id.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_places_by_id.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_places_nearby.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_places_nearby.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_posts_login.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_posts_project.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_projects.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_projects.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_projects_by_id.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_projects_by_id.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_projects_obs_fields.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_search.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_search.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_autocomplete.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_autocomplete.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_autocomplete_minified.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_by_id.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_by_id.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_by_id_conservation_statuses.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_map_layers.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_with_all_names.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_taxa_with_preferred_place.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_user_by_id.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_user_by_id.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_users_autocomplete.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/get_users_autocomplete.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/obs_image.jpg +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/obs_sound.wav +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/post_observation_photos.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/post_observation_photos_list.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/post_observation_sounds.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/post_observation_sounds_list.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/post_put_observation_field_value.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/put_projects.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/update_observation_result.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/upload_photos.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/upload_photos_and_sounds.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data/upload_sounds.json +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/sample_data.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_auth.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_client.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_compat.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_converters.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_paginator.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/test_request_params.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v0/test_observation_fields_v0.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v0/test_observations_v0.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_controlled_terms.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_identifications.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_messages.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_node_api.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_observation_fields.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_observations.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_posts.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_projects.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_search.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_taxa.py +0 -0
- {pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/test/v1/test_users.py +0 -0
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
### Modified Endpoints
|
|
13
13
|
* Updated `get_projects_by_id()` to allow string values (URL slugs) for `project_id`
|
|
14
14
|
* Updated `get_user_by_id()` to allow string values (usernames) for `user_id`
|
|
15
|
+
* Added support for setting timeout for individual API requests (with `timeout` parameter)
|
|
16
|
+
* Added support for setting cache timeout for individual API requests (with `expire_after` parameter)
|
|
17
|
+
* Added support for bypassing the cache for individual API requests (with `refresh` parameter)
|
|
15
18
|
|
|
16
19
|
### Authentication
|
|
17
20
|
* Added support for JWT authentication, which will now be used by default
|
|
@@ -21,9 +24,11 @@
|
|
|
21
24
|
|
|
22
25
|
### Other Changes
|
|
23
26
|
* Dropped support for python 3.6
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
* Updated rate limiting with a SQLite-based backend. This adds persistence for rate limit tracking
|
|
28
|
+
across multiple threads, processes, and/or application restarts. See
|
|
29
|
+
[pyrate-limiter docs](https://github.com/vutran1710/PyrateLimiter#sqlite) for more details.
|
|
30
|
+
* Add a `clear_cache()` function for clearing cached API responses
|
|
31
|
+
* Misc improvements for response pretty-printing
|
|
27
32
|
|
|
28
33
|
## 0.16.0 (2022-02-22)
|
|
29
34
|
[See all Issues & PRs for 0.16](https://github.com/niconoe/pyinaturalist/milestone/7?closed=1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyinaturalist
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.0dev3
|
|
4
4
|
Summary: iNaturalist API client for python
|
|
5
5
|
Home-page: https://github.com/niconoe/pyinaturalist
|
|
6
6
|
License: MIT
|
|
@@ -33,8 +33,8 @@ 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 (==0.10.0.
|
|
37
|
-
Requires-Dist: requests-ratelimiter (>=0.
|
|
36
|
+
Requires-Dist: requests-cache (==0.10.0.dev4)
|
|
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"
|
|
40
40
|
Requires-Dist: sphinx-autodoc-typehints (>=1.17,<2.0); extra == "docs"
|
|
@@ -58,7 +58,7 @@ Description-Content-Type: text/markdown
|
|
|
58
58
|
[](https://pypi.org/project/pyinaturalist)
|
|
59
59
|
|
|
60
60
|
[](https://mybinder.org/v2/gh/niconoe/pyinaturalist/main?urlpath=lab/tree/examples)
|
|
61
|
-
[](https://open.vscode.dev/niconoe/pyinaturalist)
|
|
62
62
|
|
|
63
63
|
<br/>
|
|
64
64
|
|
|
@@ -139,7 +139,7 @@ On iNaturalist.org, this information can be found on the 'Species' tab of search
|
|
|
139
139
|
For example, to get the counts of all your own research-grade observations:
|
|
140
140
|
```python
|
|
141
141
|
>>> counts = get_observation_species_counts(user_id='my_username', quality_grade='research')
|
|
142
|
-
>>> pprint(counts
|
|
142
|
+
>>> pprint(counts)
|
|
143
143
|
[48473 ]: Species: Ganoderma applanatum (Artist's bracket): 4
|
|
144
144
|
[50310 ]: Species: Arisaema triphyllum (Jack-in-the-pulpit): 4
|
|
145
145
|
[50817 ]: Genus: Auricularia (Wood ear fungi): 3
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://pypi.org/project/pyinaturalist)
|
|
10
10
|
|
|
11
11
|
[](https://mybinder.org/v2/gh/niconoe/pyinaturalist/main?urlpath=lab/tree/examples)
|
|
12
|
-
[](https://open.vscode.dev/niconoe/pyinaturalist)
|
|
13
13
|
|
|
14
14
|
<br/>
|
|
15
15
|
|
|
@@ -90,7 +90,7 @@ On iNaturalist.org, this information can be found on the 'Species' tab of search
|
|
|
90
90
|
For example, to get the counts of all your own research-grade observations:
|
|
91
91
|
```python
|
|
92
92
|
>>> counts = get_observation_species_counts(user_id='my_username', quality_grade='research')
|
|
93
|
-
>>> pprint(counts
|
|
93
|
+
>>> pprint(counts)
|
|
94
94
|
[48473 ]: Species: Ganoderma applanatum (Artist's bracket): 4
|
|
95
95
|
[50310 ]: Species: Arisaema triphyllum (Jack-in-the-pulpit): 4
|
|
96
96
|
[50817 ]: Genus: Auricularia (Wood ear fungi): 3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="185" height="20" role="img" aria-label="Open in Visual Studio Code"><title>Open in Visual Studio Code</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="185" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="24" height="20" fill="#2c2c32"/><rect x="24" width="161" height="20" fill="#007acc"/><rect width="185" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjMDA3YWNjIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+VmlzdWFsIFN0dWRpbyBDb2RlPC90aXRsZT48cGF0aCBkPSJNMjMuMTUgMi41ODdMMTguMjEuMjFhMS40OTQgMS40OTQgMCAwIDAtMS43MDUuMjlsLTkuNDYgOC42My00LjEyLTMuMTI4YS45OTkuOTk5IDAgMCAwLTEuMjc2LjA1N0wuMzI3IDcuMjYxQTEgMSAwIDAgMCAuMzI2IDguNzRMMy44OTkgMTIgLjMyNiAxNS4yNmExIDEgMCAwIDAgLjAwMSAxLjQ3OUwxLjY1IDE3Ljk0YS45OTkuOTk5IDAgMCAwIDEuMjc2LjA1N2w0LjEyLTMuMTI4IDkuNDYgOC42M2ExLjQ5MiAxLjQ5MiAwIDAgMCAxLjcwNC4yOWw0Ljk0Mi0yLjM3N0ExLjUgMS41IDAgMCAwIDI0IDIwLjA2VjMuOTM5YTEuNSAxLjUgMCAwIDAtLjg1LTEuMzUyem0tNS4xNDYgMTQuODYxTDEwLjgyNiAxMmw3LjE3OC01LjQ0OHYxMC44OTZ6Ii8+PC9zdmc+"/><text aria-hidden="true" x="1035" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="1510">Open in Visual Studio Code</text><text x="1035" y="140" transform="scale(.1)" fill="#fff" textLength="1510">Open in Visual Studio Code</text></g></svg>
|
|
@@ -360,11 +360,18 @@ To store the cache somewhere other than the default cache directory:
|
|
|
360
360
|
>>> session = ClientSession(cache_name='~/data/api_requests.db')
|
|
361
361
|
```
|
|
362
362
|
|
|
363
|
-
To
|
|
363
|
+
To manually clear the cache:
|
|
364
364
|
```python
|
|
365
365
|
>>> session.cache.clear()
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
+
Or as a shortcut, without a session object:
|
|
369
|
+
```python
|
|
370
|
+
from pyinaturalist import clear_cache
|
|
371
|
+
|
|
372
|
+
clear_cache()
|
|
373
|
+
```
|
|
374
|
+
|
|
368
375
|
## Rate Limiting
|
|
369
376
|
Rate limiting is applied to all requests so they stay within the rates specified by iNaturalist's
|
|
370
377
|
[API Recommended Practices](https://www.inaturalist.org/pages/api+recommended+practices).
|
{pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/examples/observation_photo_metadata.py
RENAMED
|
@@ -11,7 +11,8 @@ Also note that photo metadata is only visible to logged in users, so an access t
|
|
|
11
11
|
For more details on authentication, see:
|
|
12
12
|
|
|
13
13
|
* https://www.inaturalist.org/pages/api+reference#auth
|
|
14
|
-
* https://pyinaturalist.readthedocs.io/en/
|
|
14
|
+
* https://pyinaturalist.readthedocs.io/en/stable/user_guide.html#authentication
|
|
15
|
+
|
|
15
16
|
|
|
16
17
|
Extra dependencies:
|
|
17
18
|
``pip install beautifulsoup4``
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
"""Sample response data of every type to experiment with"""
|
|
4
4
|
import sys
|
|
5
5
|
|
|
6
|
+
from rich import print
|
|
7
|
+
|
|
6
8
|
from pyinaturalist import PROJECT_DIR, format_table, pprint
|
|
7
9
|
from pyinaturalist.models import *
|
|
8
10
|
|
|
@@ -56,3 +58,4 @@ tables = [
|
|
|
56
58
|
if __name__ == '__main__':
|
|
57
59
|
for table in tables:
|
|
58
60
|
pprint(table)
|
|
61
|
+
print(observation)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# flake8: noqa: F401, F403
|
|
2
|
+
# isort: skip_file
|
|
2
3
|
from logging import getLogger
|
|
3
4
|
|
|
4
5
|
logger = getLogger('pyinaturalist')
|
|
@@ -13,7 +14,7 @@ try:
|
|
|
13
14
|
from pyinaturalist.models import *
|
|
14
15
|
from pyinaturalist.paginator import Paginator, IDPaginator
|
|
15
16
|
from pyinaturalist.request_params import get_interval_ranges
|
|
16
|
-
from pyinaturalist.session import ClientSession
|
|
17
|
+
from pyinaturalist.session import ClientSession, clear_cache
|
|
17
18
|
from pyinaturalist.v0 import *
|
|
18
19
|
from pyinaturalist.v1 import *
|
|
19
20
|
from pyinaturalist.v2 import *
|
|
@@ -19,6 +19,7 @@ def get_access_token(
|
|
|
19
19
|
app_id: str = None,
|
|
20
20
|
app_secret: str = None,
|
|
21
21
|
jwt: bool = True,
|
|
22
|
+
refresh: bool = False,
|
|
22
23
|
) -> str:
|
|
23
24
|
"""Get an access token using the user's iNaturalist username and password, using the
|
|
24
25
|
Resource Owner Password Credentials Flow. Requires registering an iNaturalist app.
|
|
@@ -61,6 +62,7 @@ def get_access_token(
|
|
|
61
62
|
app_id: OAuth2 application ID
|
|
62
63
|
app_secret: OAuth2 application secret
|
|
63
64
|
jwt: Return a JSON Web Token; otherwise return an OAuth2 access token.
|
|
65
|
+
refresh: Do not use any cached tokens, even if they are not expired
|
|
64
66
|
|
|
65
67
|
Raises:
|
|
66
68
|
:py:exc:`requests.HTTPError`: (401) if credentials are invalid
|
|
@@ -68,7 +70,7 @@ def get_access_token(
|
|
|
68
70
|
# First check if we have a previously cached JWT
|
|
69
71
|
session = get_local_session()
|
|
70
72
|
response = _get_jwt(session, only_if_cached=True)
|
|
71
|
-
if response.ok:
|
|
73
|
+
if response.ok and not refresh:
|
|
72
74
|
logger.info('Using cached access token')
|
|
73
75
|
return response.json()['api_token']
|
|
74
76
|
|
|
@@ -84,10 +86,10 @@ def get_access_token(
|
|
|
84
86
|
# If any fields were missing, then check the keyring
|
|
85
87
|
if not all(payload.values()):
|
|
86
88
|
payload.update(get_keyring_credentials())
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
if all(payload.values()):
|
|
90
|
+
logger.info('Retrieved credentials from keyring')
|
|
91
|
+
else:
|
|
92
|
+
raise AuthenticationError('Not all authentication parameters were provided')
|
|
91
93
|
|
|
92
94
|
# Get OAuth access token
|
|
93
95
|
response = session.post(f'{API_V0_BASE_URL}/oauth/token', json=payload)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from logging import getLogger
|
|
2
|
-
from typing import Any, Callable, Dict
|
|
2
|
+
from typing import Any, Callable, Dict, Type
|
|
3
3
|
|
|
4
4
|
from requests import Session
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@ from pyinaturalist.auth import get_access_token
|
|
|
7
7
|
from pyinaturalist.constants import JsonResponse
|
|
8
8
|
from pyinaturalist.controllers import (
|
|
9
9
|
ObservationController,
|
|
10
|
+
PlaceController,
|
|
10
11
|
ProjectController,
|
|
11
12
|
TaxonController,
|
|
12
13
|
UserController,
|
|
@@ -104,6 +105,7 @@ class iNatClient:
|
|
|
104
105
|
# Controllers
|
|
105
106
|
# TODO: Improve Sphinx docs generated for these attributes
|
|
106
107
|
self.observations = ObservationController(self) #: Interface for observation requests
|
|
108
|
+
self.places = PlaceController(self) #: Interface for project requests
|
|
107
109
|
self.projects = ProjectController(self) #: Interface for project requests
|
|
108
110
|
self.taxa = TaxonController(self) #: Interface for taxon requests
|
|
109
111
|
self.users = UserController(self) #: Interface for user requests
|
|
@@ -140,7 +142,12 @@ class iNatClient:
|
|
|
140
142
|
return request_function(**kwargs)
|
|
141
143
|
|
|
142
144
|
def paginate(
|
|
143
|
-
self,
|
|
145
|
+
self,
|
|
146
|
+
request_function: Callable,
|
|
147
|
+
model: T,
|
|
148
|
+
auth: bool = False,
|
|
149
|
+
cls: Type[Paginator] = Paginator,
|
|
150
|
+
**kwargs,
|
|
144
151
|
) -> Paginator[T]:
|
|
145
152
|
"""Create a paginator for a request, with client settings applied
|
|
146
153
|
|
|
@@ -148,7 +155,8 @@ class iNatClient:
|
|
|
148
155
|
request_function: The API request function to call, which should return a JSON response
|
|
149
156
|
model: Model class used for the response
|
|
150
157
|
auth: Indicates that the request requires authentication
|
|
158
|
+
cls: Alternative Paginator class to use
|
|
151
159
|
params: Original request parameters
|
|
152
160
|
"""
|
|
153
161
|
kwargs = self._update_kwargs(request_function, auth, **kwargs)
|
|
154
|
-
return
|
|
162
|
+
return cls(request_function, model, **kwargs)
|
|
@@ -16,6 +16,7 @@ INAT_BASE_URL = API_V0_BASE_URL
|
|
|
16
16
|
INAT_REPO = 'https://raw.githubusercontent.com/inaturalist/inaturalist/main'
|
|
17
17
|
ICONIC_TAXA_BASE_URL = f'{INAT_REPO}/app/assets/images/iconic_taxa'
|
|
18
18
|
PHOTO_BASE_URL = 'https://static.inaturalist.org/photos'
|
|
19
|
+
PHOTO_CC_BASE_URL = 'https://inaturalist-open-data.s3.amazonaws.com/photos'
|
|
19
20
|
PHOTO_INFO_BASE_URL = 'https://www.inaturalist.org/photos'
|
|
20
21
|
|
|
21
22
|
# Prefix used for keyring entries
|
|
@@ -49,12 +50,14 @@ SAMPLE_DATA_DIR = join(PROJECT_DIR, 'test', 'sample_data')
|
|
|
49
50
|
|
|
50
51
|
# Cache settings
|
|
51
52
|
CACHE_EXPIRATION = {
|
|
52
|
-
'api.inaturalist.org
|
|
53
|
-
'api.inaturalist.org/v*/
|
|
54
|
-
'api.inaturalist.org/v*/
|
|
53
|
+
'api.inaturalist.org/*autocomplete': timedelta(days=30),
|
|
54
|
+
'api.inaturalist.org/v*/controlled_terms*': timedelta(days=7),
|
|
55
|
+
'api.inaturalist.org/v*/places*': timedelta(days=7),
|
|
56
|
+
'api.inaturalist.org/v*/taxa*': timedelta(days=7),
|
|
55
57
|
'*': timedelta(minutes=30),
|
|
56
58
|
}
|
|
57
59
|
CACHE_FILE = join(CACHE_DIR, 'api_requests.db')
|
|
60
|
+
RATELIMIT_FILE = join(CACHE_DIR, 'api_ratelimit.db')
|
|
58
61
|
TOKEN_EXPIRATION = timedelta(hours=1)
|
|
59
62
|
JWT_EXPIRATION = timedelta(days=1)
|
|
60
63
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# flake8: noqa: F401
|
|
3
3
|
from pyinaturalist.controllers.base import BaseController
|
|
4
4
|
from pyinaturalist.controllers.observations import ObservationController
|
|
5
|
+
from pyinaturalist.controllers.places import PlaceController
|
|
5
6
|
from pyinaturalist.controllers.projects import ProjectController
|
|
6
7
|
from pyinaturalist.controllers.taxa import TaxonController
|
|
7
8
|
from pyinaturalist.controllers.users import UserController
|
{pyinaturalist-0.17.0dev1 → pyinaturalist-0.17.0dev3}/pyinaturalist/controllers/observations.py
RENAMED
|
@@ -31,7 +31,7 @@ class ObservationController(BaseController):
|
|
|
31
31
|
|
|
32
32
|
@document_controller_params(get_observations)
|
|
33
33
|
def search(self, **params) -> Paginator[Observation]:
|
|
34
|
-
return self.client.paginate(get_observations, Observation, **params)
|
|
34
|
+
return self.client.paginate(get_observations, Observation, method='id', **params)
|
|
35
35
|
|
|
36
36
|
# TODO: Does this need a model with utility functions, or is {datetime: count} sufficient?
|
|
37
37
|
@document_controller_params(get_observation_histogram)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from pyinaturalist.constants import IntOrStr
|
|
2
|
+
from pyinaturalist.controllers import BaseController
|
|
3
|
+
from pyinaturalist.docs import document_controller_params
|
|
4
|
+
from pyinaturalist.models import Place
|
|
5
|
+
from pyinaturalist.paginator import AutocompletePaginator, Paginator
|
|
6
|
+
from pyinaturalist.v1 import get_places_autocomplete, get_places_by_id, get_places_nearby
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PlaceController(BaseController):
|
|
10
|
+
""":fa:`map-marker-alt,style=fas` Controller for Place requests"""
|
|
11
|
+
|
|
12
|
+
def from_id(self, *place_ids: IntOrStr, **params) -> Paginator[Place]:
|
|
13
|
+
"""Get places by ID
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
place_ids: One or more place IDs
|
|
17
|
+
"""
|
|
18
|
+
return self.client.paginate(get_places_by_id, Place, place_id=place_ids, **params)
|
|
19
|
+
|
|
20
|
+
@document_controller_params(get_places_autocomplete)
|
|
21
|
+
def autocomplete(self, q: str = None, **params) -> Paginator[Place]:
|
|
22
|
+
return self.client.paginate(
|
|
23
|
+
get_places_autocomplete,
|
|
24
|
+
Place,
|
|
25
|
+
cls=AutocompletePaginator,
|
|
26
|
+
q=q,
|
|
27
|
+
per_page=20,
|
|
28
|
+
**params,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
@document_controller_params(get_places_nearby)
|
|
32
|
+
def nearby(
|
|
33
|
+
self, nelat: float, nelng: float, swlat: float, swlng: float, **params
|
|
34
|
+
) -> Paginator[Place]:
|
|
35
|
+
return self.client.paginate(
|
|
36
|
+
get_places_nearby, Place, nelat=nelat, nelng=nelng, swlat=swlat, swlng=swlng, **params
|
|
37
|
+
)
|
|
@@ -3,7 +3,14 @@ from pyinaturalist.controllers import BaseController
|
|
|
3
3
|
from pyinaturalist.docs import document_controller_params
|
|
4
4
|
from pyinaturalist.models import Project
|
|
5
5
|
from pyinaturalist.paginator import Paginator
|
|
6
|
-
from pyinaturalist.v1 import
|
|
6
|
+
from pyinaturalist.v1 import (
|
|
7
|
+
add_project_observation,
|
|
8
|
+
add_project_users,
|
|
9
|
+
delete_project_users,
|
|
10
|
+
get_projects,
|
|
11
|
+
get_projects_by_id,
|
|
12
|
+
update_project,
|
|
13
|
+
)
|
|
7
14
|
|
|
8
15
|
|
|
9
16
|
class ProjectController(BaseController):
|
|
@@ -40,4 +47,17 @@ class ProjectController(BaseController):
|
|
|
40
47
|
responses.append(response)
|
|
41
48
|
return responses
|
|
42
49
|
|
|
43
|
-
|
|
50
|
+
@document_controller_params(update_project)
|
|
51
|
+
def update(self, project_id: IntOrStr, **params) -> Project:
|
|
52
|
+
response = self.client.request(update_project, project_id, **params)
|
|
53
|
+
return Project.from_json(response)
|
|
54
|
+
|
|
55
|
+
@document_controller_params(add_project_users)
|
|
56
|
+
def add_users(self, project_id: IntOrStr, *user_ids: int, **params) -> Project:
|
|
57
|
+
response = self.client.request(add_project_users, project_id, user_ids, **params)
|
|
58
|
+
return Project.from_json(response)
|
|
59
|
+
|
|
60
|
+
@document_controller_params(delete_project_users)
|
|
61
|
+
def delete_users(self, project_id: IntOrStr, *user_ids: int, **params) -> Project:
|
|
62
|
+
response = self.client.request(delete_project_users, project_id, user_ids, **params)
|
|
63
|
+
return Project.from_json(response)
|
|
@@ -9,13 +9,12 @@ These functions will accept any of the following:
|
|
|
9
9
|
"""
|
|
10
10
|
import json
|
|
11
11
|
from copy import deepcopy
|
|
12
|
-
from datetime import date, datetime
|
|
12
|
+
from datetime import date, datetime, timedelta
|
|
13
13
|
from functools import partial
|
|
14
14
|
from logging import basicConfig, getLogger
|
|
15
|
-
from typing import
|
|
15
|
+
from typing import List, Mapping, Type
|
|
16
16
|
|
|
17
|
-
from
|
|
18
|
-
from requests import PreparedRequest
|
|
17
|
+
from requests import PreparedRequest, Response
|
|
19
18
|
|
|
20
19
|
from pyinaturalist.constants import DATETIME_SHORT_FORMAT, ResponseOrResults, ResponseResult
|
|
21
20
|
from pyinaturalist.converters import ensure_list
|
|
@@ -42,15 +41,16 @@ from pyinaturalist.models import (
|
|
|
42
41
|
TaxonCount,
|
|
43
42
|
TaxonSummary,
|
|
44
43
|
User,
|
|
45
|
-
get_lazy_attrs,
|
|
46
44
|
)
|
|
47
45
|
from pyinaturalist.paginator import Paginator
|
|
48
46
|
|
|
49
47
|
|
|
50
48
|
def enable_logging(level: str = 'INFO'):
|
|
51
|
-
"""Configure logging to standard output with prettier tracebacks and terminal
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
"""Configure logging to standard output with prettier tracebacks, formatting, and terminal
|
|
50
|
+
colors (if supported).
|
|
51
|
+
|
|
52
|
+
If you prefer, logging can be configured with the stdlib ``logging`` module instead; this just
|
|
53
|
+
provides some convenient defaults.
|
|
54
54
|
|
|
55
55
|
Args:
|
|
56
56
|
level: Logging level to use
|
|
@@ -200,14 +200,41 @@ def format_table(values: ResponseOrObjects):
|
|
|
200
200
|
|
|
201
201
|
def format_request(request: PreparedRequest, dry_run: bool = False) -> str:
|
|
202
202
|
"""Format HTTP request info"""
|
|
203
|
-
|
|
203
|
+
headers = _format_headers(request.headers)
|
|
204
|
+
body = _format_body(request.body)
|
|
205
|
+
dry_run_str = ' (DRY RUN) ' if dry_run else ''
|
|
206
|
+
return f'Request:{dry_run_str}\n{request.method} {request.url}\n{headers}\n{body}'
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def format_response(response: Response) -> str:
|
|
210
|
+
"""Format HTTP response info, including whether it came from the cache"""
|
|
211
|
+
headers = _format_headers(response.headers)
|
|
212
|
+
error_msg = f' {response.text}' if not response.ok else ''
|
|
213
|
+
|
|
214
|
+
def _expires_str():
|
|
215
|
+
if response.expires:
|
|
216
|
+
expires_delta = response.expires - datetime.utcnow()
|
|
217
|
+
expires_delta -= timedelta(microseconds=expires_delta.microseconds)
|
|
218
|
+
return f'expires in {expires_delta}'
|
|
219
|
+
else:
|
|
220
|
+
return 'never expires'
|
|
221
|
+
|
|
222
|
+
cached = f'cached; {_expires_str()}' if getattr(response, 'from_cache', False) else 'not cached'
|
|
223
|
+
return f'Response ({cached}):\n{response.status_code} {response.reason}{error_msg}\n{headers}'
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _format_headers(headers: Mapping[str, str]) -> str:
|
|
227
|
+
ignore_headers = [
|
|
228
|
+
'Access-Control-Allow-Headers',
|
|
229
|
+
'Access-Control-Allow-Methods',
|
|
230
|
+
'Access-Control-Allow-Origin',
|
|
231
|
+
'X-Content-Type-Options',
|
|
232
|
+
]
|
|
233
|
+
headers_dict = {k: v for k, v in headers.items() if k not in ignore_headers}
|
|
204
234
|
if 'Authorization' in headers_dict:
|
|
205
235
|
headers_dict['Authorization'] = '[REDACTED]'
|
|
206
236
|
|
|
207
|
-
|
|
208
|
-
body = _format_body(request.body)
|
|
209
|
-
dry_run_str = '(DRY RUN) ' if dry_run else ''
|
|
210
|
-
return f'{dry_run_str}{request.method} {request.url}\n{headers}\n{body}'
|
|
237
|
+
return '\n'.join([f'{k}: {v}' for k, v in headers_dict.items()])
|
|
211
238
|
|
|
212
239
|
|
|
213
240
|
def _format_body(body):
|
|
@@ -271,36 +298,10 @@ format_species_counts = partial(_format_model_objects, cls=TaxonCount)
|
|
|
271
298
|
format_taxa = partial(_format_model_objects, cls=Taxon)
|
|
272
299
|
format_users = partial(_format_model_objects, cls=User)
|
|
273
300
|
|
|
274
|
-
|
|
275
|
-
def get_model_fields(obj: Any) -> Iterable[Attribute]:
|
|
276
|
-
"""Modification for rich's pretty-printer (specifically, ``rich.pretty._get_attr_fields``).
|
|
277
|
-
|
|
278
|
-
Adds placeholder attributes for lazy-loaded model properties so they get included in the output.
|
|
279
|
-
This is particularly useful for previewing in Jupyter or another REPL. These nested objects are
|
|
280
|
-
shown in condensed format so the preview is more readable. Otherwise, some objects]
|
|
281
|
-
(especially observations) can turn into a huge wall of text several pages long.
|
|
282
|
-
|
|
283
|
-
Does not change behavior for anything except :py:class:`.BaseModel` subclasses.
|
|
284
|
-
"""
|
|
285
|
-
|
|
286
|
-
def condense_nested_models(obj):
|
|
287
|
-
tab = ' '
|
|
288
|
-
if obj and isinstance(obj, list):
|
|
289
|
-
condensed_objs = f',\n{tab}{tab}'.join([str(o) for o in obj])
|
|
290
|
-
return f'[\n{tab}{tab}{condensed_objs}\n{tab}]'
|
|
291
|
-
return str(obj)
|
|
292
|
-
|
|
293
|
-
attrs = list(obj.__attrs_attrs__)
|
|
294
|
-
if isinstance(obj, BaseModel):
|
|
295
|
-
attrs += get_lazy_attrs(obj, repr=condense_nested_models)
|
|
296
|
-
return attrs
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
# If rich is installed, update its pretty-printer to include model properties
|
|
301
|
+
# If rich is installed, install pretty-printer
|
|
300
302
|
try:
|
|
301
303
|
from rich import pretty, print
|
|
302
304
|
|
|
303
|
-
pretty._get_attr_fields = get_model_fields
|
|
304
305
|
pretty.install()
|
|
305
306
|
except ImportError:
|
|
306
307
|
pass
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
See :ref:`user_guide:models` section for usage details.
|
|
3
3
|
"""
|
|
4
4
|
# flake8: noqa: F401
|
|
5
|
+
# isort: skip_file
|
|
5
6
|
from datetime import datetime, timezone
|
|
6
7
|
from typing import Callable, Dict, Iterable, Optional, Union
|
|
7
8
|
|
|
@@ -11,12 +12,7 @@ from attr import define, validators
|
|
|
11
12
|
from pyinaturalist.constants import JsonResponse, ResponseOrResults
|
|
12
13
|
from pyinaturalist.converters import convert_lat_long, try_datetime
|
|
13
14
|
from pyinaturalist.models.base import BaseModel, BaseModelCollection, T, load_json
|
|
14
|
-
from pyinaturalist.models.lazy_property import
|
|
15
|
-
LazyProperty,
|
|
16
|
-
add_lazy_attrs,
|
|
17
|
-
get_lazy_attrs,
|
|
18
|
-
get_lazy_properties,
|
|
19
|
-
)
|
|
15
|
+
from pyinaturalist.models.lazy_property import LazyProperty, add_lazy_attrs, get_lazy_properties
|
|
20
16
|
|
|
21
17
|
|
|
22
18
|
# Aliases and minor helper functions used by model classes
|
|
@@ -41,12 +37,12 @@ def is_in(options: Iterable):
|
|
|
41
37
|
return validators.in_(list(options) + [None])
|
|
42
38
|
|
|
43
39
|
|
|
44
|
-
def coordinate_pair(**kwargs):
|
|
40
|
+
def coordinate_pair(doc: str = None, **kwargs):
|
|
45
41
|
"""Field containing a pair of coordiantes"""
|
|
46
42
|
return field(
|
|
47
43
|
default=None,
|
|
48
44
|
converter=convert_lat_long,
|
|
49
|
-
doc='Location in ``(latitude, logitude)`` decimal degrees',
|
|
45
|
+
doc=doc or 'Location in ``(latitude, logitude)`` decimal degrees',
|
|
50
46
|
**kwargs,
|
|
51
47
|
)
|
|
52
48
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"""Base class and utilities for data models"""
|
|
2
2
|
import json
|
|
3
3
|
from collections import UserList
|
|
4
|
+
from datetime import datetime
|
|
4
5
|
from logging import getLogger
|
|
5
6
|
from os.path import expanduser
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from typing import Dict, Generic, List, Type, TypeVar
|
|
8
9
|
|
|
9
|
-
from attr import asdict, define, field, fields_dict
|
|
10
|
+
from attr import Factory, asdict, define, field, fields_dict
|
|
10
11
|
|
|
11
12
|
from pyinaturalist.constants import (
|
|
12
13
|
AnyFile,
|
|
@@ -68,8 +69,39 @@ class BaseModel:
|
|
|
68
69
|
"""Convert this object back to JSON (dict) format"""
|
|
69
70
|
return asdict(self)
|
|
70
71
|
|
|
72
|
+
def __rich_repr__(self):
|
|
73
|
+
"""Custom output to use when pretty-printed with rich. Compared to default rich behavior for
|
|
74
|
+
attrs classes, this does the following:
|
|
75
|
+
|
|
76
|
+
* Inform rich about all default values, including factories, so they will be excluded from
|
|
77
|
+
output
|
|
78
|
+
* Stringify datetime objects
|
|
79
|
+
* Add lazy-loaded attributes to the output
|
|
80
|
+
* Use condensed (str) representations of lazy-loaded attributes
|
|
81
|
+
* Does not currently handle positional-only args (since we don't currently have any)
|
|
82
|
+
|
|
83
|
+
This makes output much more readable, particularly within Jupyter or a REPL. Otherwise, some
|
|
84
|
+
objects (especially observations) can turn into a huge wall of text several pages long.
|
|
85
|
+
"""
|
|
86
|
+
from pyinaturalist.models import get_lazy_properties
|
|
87
|
+
|
|
88
|
+
# Handle regular public attributes
|
|
89
|
+
public_attrs = [a for a in self.__attrs_attrs__ if not a.name.startswith('_')]
|
|
90
|
+
for a in public_attrs:
|
|
91
|
+
default = a.default.factory() if isinstance(a.default, Factory) else a.default
|
|
92
|
+
value = getattr(self, a.name)
|
|
93
|
+
value = str(value) if isinstance(value, datetime) else value
|
|
94
|
+
yield a.name, value, default
|
|
95
|
+
|
|
96
|
+
# Handle LazyProperties
|
|
97
|
+
for name, prop in get_lazy_properties(type(self)).items():
|
|
98
|
+
value = prop.__get__(self, type(self))
|
|
99
|
+
if isinstance(value, list):
|
|
100
|
+
yield name, [str(v) for v in value], []
|
|
101
|
+
else:
|
|
102
|
+
yield name, str(value) if value is not None else None, None
|
|
103
|
+
|
|
71
104
|
|
|
72
|
-
# TODO: Better workaround for mypy not accepting subclasses in overridden attributes and methods
|
|
73
105
|
@define(auto_attribs=False, order=False, slots=False)
|
|
74
106
|
class BaseModelCollection(BaseModel, UserList, Generic[T]):
|
|
75
107
|
"""Base class for data model collections. These will behave the same as lists but enable some
|
|
@@ -105,11 +105,6 @@ def add_lazy_attrs(cls, fields):
|
|
|
105
105
|
return list(fields) + [p.get_lazy_attr() for p in lazy_properties]
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
def get_lazy_attrs(obj, **kwargs) -> List[Attribute]:
|
|
109
|
-
"""Get placeholder attributes for lazy-loaded model properties"""
|
|
110
|
-
return [make_attribute(p, **kwargs) for p in get_lazy_properties(type(obj))]
|
|
111
|
-
|
|
112
|
-
|
|
113
108
|
def get_lazy_properties(cls: Type[BaseModel]) -> Dict[str, LazyProperty]:
|
|
114
109
|
return {k: v for k, v in cls.__dict__.items() if isinstance(v, LazyProperty)}
|
|
115
110
|
|
|
@@ -91,9 +91,10 @@ class Observation(BaseModel):
|
|
|
91
91
|
owners_identification_from_vision: bool = field(
|
|
92
92
|
default=None, doc="Indicates if the owner's ID was selected from computer vision results"
|
|
93
93
|
)
|
|
94
|
-
|
|
95
94
|
place_guess: str = field(default=None, doc='Place name determined from observation coordinates')
|
|
96
|
-
place_ids: List[int] = field(
|
|
95
|
+
place_ids: List[int] = field(
|
|
96
|
+
factory=list, doc='Place IDs associated with the observation coordinates'
|
|
97
|
+
)
|
|
97
98
|
positional_accuracy: int = field(
|
|
98
99
|
default=None, doc='GPS accuracy in meters (real accuracy, if obscured)'
|
|
99
100
|
)
|
|
@@ -101,6 +102,15 @@ class Observation(BaseModel):
|
|
|
101
102
|
factory=dict,
|
|
102
103
|
doc='Any user observation preferences (related to community IDs, coordinate access, etc.)',
|
|
103
104
|
)
|
|
105
|
+
private_location: Coordinates = coordinate_pair(
|
|
106
|
+
doc=':fa:`lock` Private location in ``(latitude, logitude)`` decimal degrees'
|
|
107
|
+
)
|
|
108
|
+
private_place_ids: List[int] = field(
|
|
109
|
+
factory=list, doc=':fa:`lock` Place IDs associated with the private observation coordinates'
|
|
110
|
+
)
|
|
111
|
+
private_place_guess: str = field(
|
|
112
|
+
default=None, doc=':fa:`lock` Place name determined from private observation coordinates'
|
|
113
|
+
)
|
|
104
114
|
project_ids: List[int] = field(factory=list, doc='All associated project IDs')
|
|
105
115
|
project_ids_with_curator_id: List[int] = field(
|
|
106
116
|
factory=list, doc='Project IDs with a curator identification for this observation'
|
|
@@ -187,12 +197,17 @@ class Observation(BaseModel):
|
|
|
187
197
|
# Convert observation timestamps prior to __attrs_init__
|
|
188
198
|
def __init__(
|
|
189
199
|
self,
|
|
190
|
-
created_at_details: Dict = None,
|
|
191
|
-
observed_on_string: str = None,
|
|
192
|
-
observed_time_zone: str = None,
|
|
193
|
-
time_zone_offset: str = None,
|
|
200
|
+
# created_at_details: Dict = None,
|
|
201
|
+
# observed_on_string: str = None,
|
|
202
|
+
# observed_time_zone: str = None,
|
|
203
|
+
# time_zone_offset: str = None,
|
|
194
204
|
**kwargs,
|
|
195
205
|
):
|
|
206
|
+
created_at_details = kwargs.pop('created_at_details', None)
|
|
207
|
+
observed_on_string = kwargs.pop('observed_on_string', None)
|
|
208
|
+
observed_time_zone = kwargs.pop('observed_time_zone', None)
|
|
209
|
+
time_zone_offset = kwargs.pop('time_zone_offset', None)
|
|
210
|
+
|
|
196
211
|
tz_offset = time_zone_offset
|
|
197
212
|
tz_name = observed_time_zone
|
|
198
213
|
created_date = (created_at_details or {}).get('date')
|