Users¶
Summary¶
Classes
Functions
|
Get your own user profile |
|
Get a user by ID |
|
Given a query string, return users with names or logins starting with the search term |
Module Contents¶
- pyinaturalist.v1.users.get_current_user(access_token=None, **params)¶
Get your own user profile
Notes
API reference: GET /users/me
Example
>>> response = get_current_user(access_token=access_token) >>> pprint(response) [1234] my_username
- pyinaturalist.v1.users.get_user_by_id(user_id, **params)¶
Get a user by ID
Notes
API reference: GET /users/{id}
- Parameters:
user_id (
Union
[int
,str
]) – Get the user with this ID. Only a single ID is allowed per request.
Example
>>> response = get_user_by_id(123456) >>> pprint(response) [1234] my_username
from datetime import datetime from dateutil.tz import tzutc { 'id': 1, 'login': 'kueda', 'spam': False, 'suspended': False, 'created_at': datetime(2008, 3, 20, 21, 15, 42, tzinfo=tzutc()), 'login_autocomplete': 'kueda', 'login_exact': 'kueda', 'name': 'Ken-ichi Ueda', 'name_autocomplete': 'Ken-ichi Ueda', 'orcid': 'https://orcid.org/0000-0003-0145-6846', 'icon': 'https://static.inaturalist.org/attachments/users/icons/1/thumb.jpg?1475527316', 'observations_count': 40947, 'identifications_count': 95624, 'journal_posts_count': 86, 'activity_count': 136657, 'species_count': 8831, 'universal_search_rank': 40947, 'roles': ['admin', 'curator'], 'site_id': 1, 'icon_url': 'https://static.inaturalist.org/attachments/users/icons/1/medium.jpg?1475527316', }
- pyinaturalist.v1.users.get_users_autocomplete(q, **params)¶
Given a query string, return users with names or logins starting with the search term
Notes
API reference: GET /users/autocomplete
Pagination is supported; default page size is 6, and max is 100.
- Parameters:
project_id (
Optional
[int
]) – Only show users who are members of this projectper_page (
Optional
[int
]) – Number of results to return in a page. The maximum value is generally 200, unless otherwise notedcount_only (
Optional
[bool
]) – Only return a count of results; alias forper_page=0
reverse (
Optional
[bool
]) – Reverse the order of results; alias fororder='descending'
dry_run (
Optional
[bool
]) – Just log the request instead of sending a real requestsession (
Optional
[Session
]) – An existing Session object to use instead of creating a new one
Example
>>> response = get_users_autocomplete(q='my_userna') >>> pprint(response) [1234] my_username [12345] my_username_2
from datetime import datetime from dateutil.tz import tzutc { 'total_results': 3, 'page': 1, 'per_page': 3, 'results': [ { 'id': 886482, 'login': 'niconoe', 'spam': False, 'suspended': False, 'created_at': datetime(2018, 4, 23, 17, 11, 14, tzinfo=tzutc()), 'login_autocomplete': 'niconoe', 'login_exact': 'niconoe', 'name': 'Nicolas Noé', 'name_autocomplete': 'Nicolas Noé', 'orcid': 'https://orcid.org/0000-0002-9503-4750', 'icon': 'https://static.inaturalist.org/attachments/users/icons/886482/thumb.jpg?1529671435', 'observations_count': 928, 'identifications_count': 118, 'journal_posts_count': 0, 'activity_count': 1046, 'species_count': 396, 'universal_search_rank': 928, 'roles': [], 'site_id': 1, 'icon_url': 'https://static.inaturalist.org/attachments/users/icons/886482/medium.jpg?1529671435', }, { 'id': 2909130, 'login': 'niconoerbo', 'spam': False, 'suspended': False, 'created_at': datetime(2020, 5, 5, 6, 28, 32, tzinfo=tzutc()), 'login_autocomplete': 'niconoerbo', 'login_exact': 'niconoerbo', 'name': None, 'name_autocomplete': None, 'orcid': None, 'icon': None, 'observations_count': 6, 'identifications_count': 0, 'journal_posts_count': 0, 'activity_count': 6, 'universal_search_rank': 6, 'roles': [], 'site_id': 1, 'icon_url': None, }, { 'id': 3358478, 'login': 'nicono', 'spam': False, 'suspended': False, 'created_at': datetime(2020, 7, 20, 18, 7, 44, tzinfo=tzutc()), 'login_autocomplete': 'nicono', 'login_exact': 'nicono', 'name': None, 'name_autocomplete': None, 'orcid': None, 'icon': None, 'observations_count': 0, 'identifications_count': 0, 'journal_posts_count': 0, 'activity_count': 0, 'universal_search_rank': 0, 'roles': [], 'site_id': 1, 'icon_url': None, }, ], }