### Install yandex_tracker_client Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Install the library using pip. ```bash pip install yandex_tracker_client ``` -------------------------------- ### Get All Issue Transitions Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Retrieve a list of all available transitions for an issue and print each one. ```python transitions = issue.transitions.get_all() for transition in transitions: print transition ``` -------------------------------- ### Get List of Queues Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Retrieve a list of all queues and take the first three. ```python queues = client.queues.get_all()[:3] ``` -------------------------------- ### Get Issue Details Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Retrieve an issue by its key and print its deadline and update timestamp. ```python issue = client.issues['MYQUEUE-42'] print issue.deadline, issue.updatedAt ``` -------------------------------- ### Get Queue Information Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Retrieve information about a specific queue by its key. ```python queue = client.queues['MYQUEUE'] ``` -------------------------------- ### Manage Issues: Get, Create, Update, Delete Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Perform CRUD operations on issues using the `client.issues` collection. Handles fetching by key, creation with various fields, partial updates, and deletion. Includes safe fetching with `NotFound` exception handling. ```python from yandex_tracker_client.exceptions import NotFound # Fetch a single issue by key issue = client.issues['MYQUEUE-42'] print(issue.key, issue.summary, issue.status.display, issue.deadline) # Safe fetch with 404 handling try: issue = client.issues['MYQUEUE-99999'] except NotFound: print('Issue not found') # Create an issue new_issue = client.issues.create( queue='MYQUEUE', summary='Fix login timeout bug', type={'name': 'Bug'}, priority='critical', description='Users are logged out after 5 minutes of inactivity.', assignee='john.doe', tags=['auth', 'urgent'], ) print(new_issue.key) # → 'MYQUEUE-43' # Update fields on an existing issue issue = client.issues['MYQUEUE-42'] issue.update( summary='Fix login timeout bug (updated)', priority='minor', followers={'add': ['jane.doe', 'bob.smith']}, ) # Delete an issue client.issues['MYQUEUE-43'].delete() ``` -------------------------------- ### Issues - Get, Create, Update, Delete Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Manage issues using the `client.issues` collection. Supports fetching by key, creating new issues with various fields, updating existing issues, and deleting issues. ```APIDOC ## Issues — Get, Create, Update, Delete `client.issues` is the primary collection for issue management. Supports key-based lookup, creation with any Tracker field, partial updates via PATCH, and deletion. All fields on a returned `Resource` are accessible as Python attributes. ```python from yandex_tracker_client.exceptions import NotFound # Fetch a single issue by key issue = client.issues['MYQUEUE-42'] print(issue.key, issue.summary, issue.status.display, issue.deadline) # Safe fetch with 404 handling try: issue = client.issues['MYQUEUE-99999'] except NotFound: print('Issue not found') # Create an issue new_issue = client.issues.create( queue='MYQUEUE', summary='Fix login timeout bug', type={'name': 'Bug'}, priority='critical', description='Users are logged out after 5 minutes of inactivity.', assignee='john.doe', tags=['auth', 'urgent'], ) print(new_issue.key) # → 'MYQUEUE-43' # Update fields on an existing issue issue = client.issues['MYQUEUE-42'] issue.update( summary='Fix login timeout bug (updated)', priority='minor', followers={'add': ['jane.doe', 'bob.smith']}, ) # Delete an issue client.issues['MYQUEUE-43'].delete() ``` ``` -------------------------------- ### Get Queue from Issue Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Access the queue object associated with a specific issue. ```python queue = client.issues['MYQUEUE-42'].queue ``` -------------------------------- ### Initialize Tracker Client with Token Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Initialize the client with your API token and organization ID. ```python from yandex_tracker_client import TrackerClient client = TrackerClient(token=, org_id=) ``` -------------------------------- ### Initialize Tracker Client with IAM Token Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Initialize the client for Yandex Cloud organizations using an IAM token and cloud organization ID. ```python from yandex_tracker_client import TrackerClient client = TrackerClient(iam_token=, cloud_org_id=) ``` -------------------------------- ### Initialize TrackerClient Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Instantiate TrackerClient with OAuth or IAM tokens. Supports custom connection options like retries and timeouts. ```python from yandex_tracker_client import TrackerClient from yandex_tracker_client.exceptions import TrackerClientError # Standard Yandex organization (OAuth token) client = TrackerClient(token='y0_AgAAAA...', org_id='1234567') # Yandex Cloud organization (IAM token) client_cloud = TrackerClient( iam_token='t1.9euelZq...', cloud_org_id='bpfxxxxxxxxx' ) # Custom connection options: retries with exponential backoff client_robust = TrackerClient( token='y0_AgAAAA...', org_id='1234567', timeout=30, retries=5, retries_initial_delay=1, retries_delay_multiplier=2, retries_delay_upper_limit=30, ) # Inspect authenticated user me = client.myself print(me.login, me.display) # → 'john.doe' 'John Doe' ``` -------------------------------- ### Execute Transition with Comment and Resolution Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Execute a 'close' transition for an issue, including a comment and resolution. ```python issue = client.issues['MYQUEUE-42'] transition = issue.transitions['close'] transition.execute(comment='Fixed', resolution='fixed') ``` -------------------------------- ### Client Initialization Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Initialize the TrackerClient with OAuth or IAM tokens for authentication. Supports custom connection options like timeouts and retries. ```APIDOC ## Client Initialization `TrackerClient` is the entry point. It establishes an authenticated HTTP session against `https://api.tracker.yandex.net`. Accepts OAuth tokens for personal/service accounts or IAM tokens for Yandex Cloud organizations. Supports configurable retries, timeouts, and custom base URLs. ```python from yandex_tracker_client import TrackerClient from yandex_tracker_client.exceptions import TrackerClientError # Standard Yandex organization (OAuth token) client = TrackerClient(token='y0_AgAAAA...', org_id='1234567') # Yandex Cloud organization (IAM token) client_cloud = TrackerClient( iam_token='t1.9euelZq...', cloud_org_id='bpfxxxxxxxxx' ) # Custom connection options: retries with exponential backoff client_robust = TrackerClient( token='y0_AgAAAA...', org_id='1234567', timeout=30, retries=5, retries_initial_delay=1, retries_delay_multiplier=2, retries_delay_upper_limit=30, ) # Inspect authenticated user me = client.myself print(me.login, me.display) # → 'john.doe' 'John Doe' ``` ``` -------------------------------- ### Run Tests Script Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Executes the test suite using a shell script. This is a command-line operation. ```bash ./run_tests.sh ``` -------------------------------- ### Create Issue Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Create a new issue in a specified queue with summary, type, and description. ```python client.issues.create( queue='MYQUEUE', summary='API Test Issue', type={'name': 'Bug'}, description='test description' ) ``` -------------------------------- ### Entity API (Projects, Portfolios, Goals) Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Interact with projects, portfolios, and goals as entities, supporting comments, checklist items, attachments, links, and event history. ```APIDOC ## Entity API (Projects, Portfolios, Goals) The newer Entities API (`client.project`, `client.portfolio`, `client.goal`) supports projects-as-entities with comments, checklist items, attachments, links, and event history. ### Search for projects ```python projects = client.project.find( filter={'status': 'inProgress'}, order_by='updatedAt', order_asc=False, per_page=20, ) for proj in projects: print(proj.shortId, proj.entityType) ``` ### Get a specific project entity ```python project = client.project[123] ``` ### Add a comment to a project ```python project.comments.create(text='Milestone 2 approved by stakeholders.') ``` ### Add a checklist item ```python project.checklist_items.create( text='Conduct security review', assignee='security.lead', deadline='2024-06-30', ) ``` ### Add a link between entities ```python project.links.create(relationship='relates', entity='portfolio/45') ``` ### Bulk update multiple projects ```python client.project.bulk_update( meta_entities=[{'id': 123}, {'id': 124}], values={'status': 'inProgress'}, ) ``` ### Retrieve event history ```python history = project.get_event_history(per_page=50) ``` ``` -------------------------------- ### Manage Issue Transitions Source: https://context7.com/yandex/yandex_tracker_client/llms.txt List available workflow transitions for an issue and execute them. Transitions can optionally include comments and resolution details. ```python issue = client.issues['MYQUEUE-42'] # List all available transitions for t in issue.transitions.get_all(): print(t.id, '->', t.to.display) # → 'close' -> 'Closed' # → 'need_info' -> 'Need Info' # Simple transition issue.transitions['close'].execute() # Transition with comment and resolution issue.transitions['close'].execute( comment='Root cause identified and fix deployed to production.', resolution='fixed', ) ``` -------------------------------- ### Bulk Transition Issues Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Transitions multiple issues to a new status. Requires a list of issue keys, the target status, and optional field updates. ```python bulkchange = client.bulkchange.transition( ['MYQUEUE-42', 'MYQUEUE-43'], 'need_info', priority='minor') bulkchange.wait() ``` -------------------------------- ### Access Boards and Sprints Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Retrieve information about agile boards, their columns, and associated sprints. Access individual boards and sprints using their IDs. ```python board = client.boards[42] print(board.name, board.query) ``` ```python for b in client.boards.get_all(): print(b.id, b.name) ``` ```python for col in board.columns.get_all(): print(col.name, [s.display for s in col.statuses]) ``` ```python for sprint in board.sprints.get_all(): print(sprint.name, sprint.status, sprint.startDate, sprint.endDate) ``` ```python sprint = client.sprints[101] ``` -------------------------------- ### Interact with Entity API (Projects, Portfolios, Goals) Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Utilize the Entities API for managing projects, portfolios, and goals, including searching, adding comments, checklist items, links, and performing bulk updates. Retrieve event history for entities. ```python projects = client.project.find( filter={'status': 'inProgress'}, order_by='updatedAt', order_asc=False, per_page=20, ) for proj in projects: print(proj.shortId, proj.entityType) ``` ```python project = client.project[123] ``` ```python project.comments.create(text='Milestone 2 approved by stakeholders.') ``` ```python project.checklist_items.create( text='Conduct security review', assignee='security.lead', deadline='2024-06-30', ) ``` ```python project.links.create(relationship='relates', entity='portfolio/45') ``` ```python client.project.bulk_update( meta_entities=[{'id': 123}, {'id': 124}], values={'status': 'inProgress'}, ) ``` ```python history = project.get_event_history(per_page=50) ``` -------------------------------- ### Execute Issue Transition Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Execute a 'close' transition for an issue. ```python issue = client.issues['MYQUEUE-42'] issue.transitions['close'].execute() ``` -------------------------------- ### Retrieve and Inspect Queues Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Access queue metadata, components, versions, issue types, and more via `client.queues`. You can also check permissions and access queue-specific fields. ```python # Get a single queue queue = client.queues['MYQUEUE'] print(queue.name, queue.lead.display, queue.defaultPriority.display) # List all queues for q in client.queues.get_all(): print(q.key, q.name) # Queue sub-resources components = queue.components versions = queue.versions issue_types = queue.issuetypes triggers = queue.triggers macros = queue.macros # Queue from an issue queue = client.issues['MYQUEUE-42'].queue # Check a permission result = queue.check_permissions('write') # Access local (queue-specific) fields for field in queue.local_fields: print(field.key, field.name) ``` -------------------------------- ### Search Issues with Filter Parameters Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Search for issues using a dictionary for filtering, specifying order, and pagination. ```python issues = client.issues.find( filter={'queue': 'MYQUEUE', 'assignee': 'me()', 'created': {'from': '2019-03-02'}}, order=['update','-status', '+priority'], per_page=15 ) print [issue.key for issue in issues] ``` -------------------------------- ### Download Issue Attachments Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Download all attachments for a given issue to a specified directory. ```python [attachment.download_to('some/path') for attachments in client.get_attachments('MYQUEUE-42')] ``` -------------------------------- ### Manage Worklog Entries Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Log, list, update, and delete time-tracking records using `client.worklog` or `issue.worklog`. Durations should be specified using ISO 8601 format. ```python # Log time on an issue issue = client.issues['MYQUEUE-42'] entry = issue.worklog.create( start='2024-05-01T10:00:00+03:00', duration='PT2H30M', # ISO 8601 duration: 2 hours 30 minutes comment='Investigated authentication timeout root cause.', ) print(entry.id, entry.duration) ``` -------------------------------- ### Perform Custom Actions on Entities Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Execute arbitrary POST/PATCH requests for sub-resources not exposed by named methods, such as archiving, restoring, or moving entities. Clone issues or create subtasks with specific inheritance options. ```python version = client.versions[60031] version.perform_action('_archive', 'post', ignore_empty_body=True) ``` ```python issue = client.issues['MYQUEUE-42'] issue.move_to('ARCHIVE') ``` ```python cloned = issue.clone_to( queues=['BACKLOG'], clone_all_fields=True, link_with_original=True, ) ``` ```python subtask = issue.create_subtask( summary='Write unit tests for session manager fix', assignee='qa.engineer', inherit=True, ) ``` -------------------------------- ### Manage Issue Links Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Use `issue.links` to manage relationships between issues and `issue.remotelinks` for external resource links. Links can be created, listed, and deleted. ```python issue = client.issues['MYQUEUE-42'] # List links for link in issue.links: print(link.type.inward, '->', link.object.key) # Create an internal link issue.links.create(issue='TEST-99', relationship='relates') issue.links.create(issue='MYQUEUE-40', relationship='depends on') # Delete a link by ID issue.links[67890].delete() # Add a remote link (e.g., to an external CI job) issue.remotelinks.create( origin='ru.yandex.lunapark', key='build-12345', relationship='tested by', ) ``` -------------------------------- ### Queues Management Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Retrieve queue metadata and access related sub-resources like components, versions, and issue types. ```APIDOC ## Queues Management Retrieves queue metadata and exposes sub-resources including components, versions, issue types, triggers, macros, workflows, and access controls. ### Usage ```python # Get a single queue queue = client.queues['MYQUEUE'] print(queue.name, queue.lead.display, queue.defaultPriority.display) # List all queues for q in client.queues.get_all(): print(q.key, q.name) # Queue sub-resources components = queue.components versions = queue.versions issue_types = queue.issuetypes triggers = queue.triggers macros = queue.macros # Queue from an issue queue = client.issues['MYQUEUE-42'].queue # Check a permission result = queue.check_permissions('write') # Access local (queue-specific) fields for field in queue.local_fields: print(field.key, field.name) ``` ``` -------------------------------- ### Search Issues by Query String Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Find issues using a Yandex Tracker query string. The query can be copied from the tracker interface. ```python issues = client.issues.find('Queue: MYQUEUE Assignee: me()') #You can copy this query from ui tracker interface print [issue.key for issue in issues] ``` -------------------------------- ### Perform Custom Actions Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Execute arbitrary sub-resource POST/PATCH calls for actions not directly exposed by named methods. ```APIDOC ## Perform Custom Actions `perform_action()` allows arbitrary sub-resource POST/PATCH calls not directly exposed by named methods — useful for endpoints like `/_archive`, `/_restore`, or `/_move`. ### Archive a version ```python version = client.versions[60031] version.perform_action('_archive', 'post', ignore_empty_body=True) ``` ### Move an issue to a different queue via action ```python issue = client.issues['MYQUEUE-42'] issue.move_to('ARCHIVE') ``` ### Clone an issue to another queue ```python cloned = issue.clone_to( queues=['BACKLOG'], clone_all_fields=True, link_with_original=True, ) ``` ### Create a subtask inheriting parent's tags, components, and fixVersions ```python subtask = issue.create_subtask( summary='Write unit tests for session manager fix', assignee='qa.engineer', inherit=True, ) ``` ``` -------------------------------- ### Boards and Sprints Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Access and manage agile boards, their columns, and associated sprints. ```APIDOC ## Boards and Sprints `client.boards` and `client.sprints` give access to agile boards, their columns, and associated sprints. ### Get a board ```python board = client.boards[42] print(board.name, board.query) ``` ### List all boards ```python for b in client.boards.get_all(): print(b.id, b.name) ``` ### List columns on a board ```python for col in board.columns.get_all(): print(col.name, [s.display for s in col.statuses]) ``` ### List sprints on a board ```python for sprint in board.sprints.get_all(): print(sprint.name, sprint.status, sprint.startDate, sprint.endDate) ``` ### Get a sprint directly ```python sprint = client.sprints[101] ``` ``` -------------------------------- ### Issue Transitions Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Manage workflow transitions for an issue. List available transitions, execute simple transitions, or execute transitions with comments and resolutions. ```APIDOC ## Issue Transitions `issue.transitions` lists available workflow transitions for an issue and `transition.execute()` fires the transition, optionally attaching a comment and resolution. ```python issue = client.issues['MYQUEUE-42'] # List all available transitions for t in issue.transitions.get_all(): print(t.id, '->', t.to.display) # → 'close' -> 'Closed' # → 'need_info' -> 'Need Info' # Simple transition issue.transitions['close'].execute() # Transition with comment and resolution issue.transitions['close'].execute( comment='Root cause identified and fix deployed to production.', resolution='fixed', ) ``` ``` -------------------------------- ### Handle NotFound Exception Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Safely handle cases where an issue is not found by catching the NotFound exception. ```python from yandex_tracker_client.exceptions import NotFound try: issue = client.issues['MYQUEUE-42'] except NotFound: pass ``` -------------------------------- ### Search and Filter Issues Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Find issues using free-text queries or structured filters. Supports ordering, pagination, and counting results without fetching all issues. The `find` method returns an iterable that handles pagination transparently. ```python # Free-text Tracker query (copy-paste from UI) issues = client.issues.find('Queue: MYQUEUE Assignee: me() Status: open') for issue in issues: print(issue.key, issue.summary) # Structured filter with ordering and pagination issues = client.issues.find( filter={ 'queue': 'MYQUEUE', 'assignee': 'john.doe', 'created': {'from': '2024-01-01'}, 'status': ['open', 'inProgress'], }, order=['-updatedAt', '+priority'], per_page=50, ) keys = [i.key for i in issues] # Count matching issues without fetching them count = client.issues.find( filter={'queue': 'MYQUEUE', 'type': 'bug'}, count_only=True, ) print(count) # → 17 ``` -------------------------------- ### Bulk Operations Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Perform bulk updates, transitions, or queue moves on multiple issues simultaneously. ```APIDOC ## Bulk Operations Applies field updates, transitions, or queue moves to a list of issues in a single API call. `wait()` polls until the operation completes and returns the final status. ### Usage ```python # Bulk field update — reassign and re-tag multiple issues bulkchange = client.bulkchange.update( ['MYQUEUE-42', 'MYQUEUE-43', 'MYQUEUE-44'], assignee='jane.doe', priority='minor', tags={'add': ['triaged'], 'remove': ['needs-triage']}, ) result = bulkchange.wait() print(result.status) # → 'COMPLETE' # Bulk transition bulkchange = client.bulkchange.transition( ['MYQUEUE-45', 'MYQUEUE-46'], transition='need_info', comment='Waiting for additional info from reporter.', ) bulkchange.wait() # Bulk move to another queue bulkchange = client.bulkchange.move( ['MYQUEUE-47', 'MYQUEUE-48'], queue='ARCHIVE', move_all_fields=True, ) bulkchange.wait() # Practical example: send employee on vacation def reassign_issues(from_login, to_login): issues = client.issues.find(filter={'queue': 'MYQUEUE', 'assignee': from_login}) bc = client.bulkchange.update(issues, assignee=to_login) bc = bc.wait() if bc.status == 'COMPLETE': for issue in issues: issue.comments.create(f'Reassigned to {to_login} during vacation.') return bc.status ``` ``` -------------------------------- ### List Issue Comments Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Retrieve and display the first three comments for a specific issue. ```python issue = client.issues['MYQUEUE-42'] comments = list(issue.comments.get_all())[:3] ``` -------------------------------- ### Bulk Move Issues Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Moves multiple issues to a different queue. Requires a list of issue keys and the target queue name. ```python bulkchange = client.bulkchange.move(['MYQUEUE-42', 'MYQUEUE-43'], 'TEST') bulkchange.wait() ``` -------------------------------- ### Perform Custom Action on an Object Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Executes a custom action on an object, such as archiving a version. Use `ignore_empty_body=True` if the endpoint does not accept an empty body. ```python version = client.versions[60031] version.perform_action('_archive', 'post', ignore_empty_body=True) ``` -------------------------------- ### List Issue Links Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Access the links associated with a specific issue. ```python issue = client.issues['MYQUEUE-42'] links = issue.links ``` -------------------------------- ### Add a Remote Link to an Issue Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Creates a remote link for an issue, useful for connecting to external systems. Requires origin, key, and relationship. ```python issue = client.issues['MYQUEUE-42'] link = issue.remotelinks.create(origin="ru.yandex.lunapark", key="MYQUEUE-42", relationship="relates") ``` -------------------------------- ### Upload Attachment to Issue Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Create and upload a new attachment to a specific issue. ```python issue = client.issues['MYQUEUE-42'] issue.attachments.create('path/to/file') ``` -------------------------------- ### Manage Issue Comments Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Use `issue.comments` to list, create, update, and delete comments on an issue. Comments can include text and optional file attachments. ```python issue = client.issues['MYQUEUE-42'] # List first 10 comments for comment in list(issue.comments.get_all())[:10]: print(comment.createdBy.display, ':', comment.text) # Add a plain comment comment = issue.comments.create(text='Investigation underway — reproducing locally.') # Add a comment with file attachments comment = issue.comments.create( text='Attached stack trace and heap dump.', attachments=['logs/stacktrace.txt', 'dumps/heap.hprof'], ) # Edit an existing comment comment = issue.comments[12345] comment.update(text='Updated findings: the issue is in the session manager.') # Delete a comment issue.comments[12345].delete() ``` -------------------------------- ### Add Comment with Attachments Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Create a new comment for an issue, including specified file attachments. ```python issue = client.issues['MYQUEUE-42'] comment = issue.comments.create(text='Test comment', attachments=['path/to/file1', 'path/to/file2']) ``` -------------------------------- ### Attachments Management Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Manage binary files attached to an issue, including uploading, downloading, and deleting. ```APIDOC ## Attachments Management Manages binary files on an issue. Files can be uploaded by path or file object, downloaded to a directory, or deleted by ID or name. ### Usage ```python issue = client.issues['MYQUEUE-42'] # List attachments for attach in issue.attachments: print(attach.name, attach.size, attach.mimetype) # Upload a file issue.attachments.create('reports/screenshot.png') # Upload from an open file object with open('data/export.csv', 'rb') as f: issue.attachments.create(f) # Download all attachments to a local directory import os os.makedirs('downloads', exist_ok=True) for attach in issue.attachments: attach.download_to('downloads') # Delete specific attachments by name to_delete = {'old_report.pdf', 'draft.docx'} for attach in issue.attachments: if attach.name in to_delete: attach.delete() ``` ``` -------------------------------- ### Bulk Update Issues Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Performs a bulk update on multiple issues, setting specified fields. The operation is asynchronous; use `.wait()` to ensure completion. ```python bulkchange = client.bulkchange.update( ['MYQUEUE-42', 'MYQUEUE-43', 'MYQUEUE-44'], priority='minor', tags={'add': ['minored']}) print bulkchange.status bulkchange = bulkchange.wait() print bulkchange.status ``` -------------------------------- ### Worklog Management Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Manage time-tracking records on issues, including creating, updating, and deleting entries. ```APIDOC ## Worklog Management Manages time-tracking records. Entries can be listed, created per issue, updated, and deleted. ### Usage ```python # Log time on an issue issue = client.issues['MYQUEUE-42'] entry = issue.worklog.create( start='2024-05-01T10:00:00+03:00', duration='PT2H30M', # ISO 8601 duration: 2 hours 30 minutes comment='Investigated authentication timeout root cause.', ) print(entry.id, entry.duration) ``` ``` -------------------------------- ### Perform Bulk Operations on Issues Source: https://context7.com/yandex/yandex_tracker_client/llms.txt The `client.bulkchange` object enables applying field updates, transitions, or queue moves to multiple issues simultaneously. Use `wait()` to poll for operation completion. ```python # Bulk field update — reassign and re-tag multiple issues bulkchange = client.bulkchange.update( ['MYQUEUE-42', 'MYQUEUE-43', 'MYQUEUE-44'], assignee='jane.doe', priority='minor', tags={'add': ['triaged'], 'remove': ['needs-triage']}, ) result = bulkchange.wait() print(result.status) # → 'COMPLETE' # Bulk transition bulkchange = client.bulkchange.transition( ['MYQUEUE-45', 'MYQUEUE-46'], transition='need_info', comment='Waiting for additional info from reporter.', ) bulkchange.wait() # Bulk move to another queue bulkchange = client.bulkchange.move( ['MYQUEUE-47', 'MYQUEUE-48'], queue='ARCHIVE', move_all_fields=True, ) bulkchange.wait() # Practical example: send employee on vacation def reassign_issues(from_login, to_login): issues = client.issues.find(filter={'queue': 'MYQUEUE', 'assignee': from_login}) bc = client.bulkchange.update(issues, assignee=to_login) bc = bc.wait() if bc.status == 'COMPLETE': for issue in issues: issue.comments.create(f'Reassigned to {to_login} during vacation.') return bc.status ``` -------------------------------- ### Issue Links Management Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Create, list, and delete typed relationships between issues and links to external resources. ```APIDOC ## Issue Links Management Creates, lists, and deletes typed relationships between issues. `issue.remotelinks` creates links to external resources (e.g., CI systems). ### Usage ```python issue = client.issues['MYQUEUE-42'] # List links for link in issue.links: print(link.type.inward, '->', link.object.key) # Create an internal link issue.links.create(issue='TEST-99', relationship='relates') issue.links.create(issue='MYQUEUE-40', relationship='depends on') # Delete a link by ID issue.links[67890].delete() # Add a remote link (e.g., to an external CI job) issue.remotelinks.create( origin='ru.yandex.lunapark', key='build-12345', relationship='tested by', ) ``` ``` -------------------------------- ### Manage Issue Attachments Source: https://context7.com/yandex/yandex_tracker_client/llms.txt The `issue.attachments` resource allows uploading files by path or file object, downloading them, and deleting them by ID or name. Ensure the target directory exists before downloading. ```python issue = client.issues['MYQUEUE-42'] # List attachments for attach in issue.attachments: print(attach.name, attach.size, attach.mimetype) # Upload a file issue.attachments.create('reports/screenshot.png') # Upload from an open file object with open('data/export.csv', 'rb') as f: issue.attachments.create(f) # Download all attachments to a local directory import os os.makedirs('downloads', exist_ok=True) for attach in issue.attachments: attach.download_to('downloads') # Delete specific attachments by name to_delete = {'old_report.pdf', 'draft.docx'} for attach in issue.attachments: if attach.name in to_delete: attach.delete() ``` -------------------------------- ### Issues - Search and Filter Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Search and filter issues using `issues.find()`. Supports free-text queries, structured filters, ordering, and pagination. Can also return only the count of matching issues. ```APIDOC ## Issues — Search and Filter `issues.find()` POSTs to `/_search` and supports free-text Tracker query language, structured filter dicts, multi-field ordering, and pagination. Returns an iterable that transparently fetches subsequent pages. ```python # Free-text Tracker query (copy-paste from UI) issues = client.issues.find('Queue: MYQUEUE Assignee: me() Status: open') for issue in issues: print(issue.key, issue.summary) # Structured filter with ordering and pagination issues = client.issues.find( filter={ 'queue': 'MYQUEUE', 'assignee': 'john.doe', 'created': {'from': '2024-01-01'}, 'status': ['open', 'inProgress'], }, order=['-updatedAt', '+priority'], per_page=50, ) keys = [i.key for i in issues] # Count matching issues without fetching them count = client.issues.find( filter={'queue': 'MYQUEUE', 'type': 'bug'}, count_only=True, ) print(count) # → 17 ``` ``` -------------------------------- ### Exception Handling Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Handle various Yandex Tracker client errors using specific exception types. ```APIDOC ## Exception Handling All client errors inherit from `TrackerError`. HTTP error codes are mapped to typed exceptions allowing fine-grained `except` clauses. ```python from yandex_tracker_client.exceptions import ( NotFound, Forbidden, BadRequest, Conflict, OutOfRetries, TrackerRequestError ) try: issue = client.issues['INVALID-0'] except NotFound: print('Issue does not exist') except Forbidden: print('No read permission for this queue') except BadRequest as e: print('Bad request:', e.error_messages) except Conflict as e: print('Version conflict:', e.status_code) except OutOfRetries as e: print('Server unavailable after all retries:', e) except TrackerRequestError as e: # Network-level failure (DNS, timeout, etc.) print('Connection error:', e) ``` ``` -------------------------------- ### Manage Worklog Entries Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Perform operations on worklog entries for an issue, including listing, updating, and deleting. Find worklogs across the organization by specifying a date range. ```python for entry in issue.worklog.get_all(): print(entry.createdBy.display, entry.duration, entry.comment) ``` ```python entry.update(duration='PT3H', comment='Revised estimate after re-check.') ``` ```python entry.delete() ``` ```python logs = client.worklog.find(createdAt={'from': '2024-05-01', 'to': '2024-05-31'}) ``` -------------------------------- ### List Issue Attachments Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Access the attachments associated with a specific issue. ```python attachments = client.issues['MYQUEUE-42'].attachments ``` -------------------------------- ### Add Comment to Issue Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Create a new comment with text for a specific issue. ```python issue = client.issues['MYQUEUE-42'] comment = issue.comments.create(text='Test Comment') ``` -------------------------------- ### Add Link to Issue Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Create a new link between the current issue and another issue, specifying the relationship. ```python issue = client.issues['MYQUEUE-42'] link = issue.links.create(issue='TEST-42', relationship='relates') ``` -------------------------------- ### Create Related Issues for a New Feature Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Initiates a new feature creation process by creating a main task, and optionally related design tasks, followers, and testers based on feature type. Links issues and updates fields as needed. ```python def start_new_feature_creation_process(feature): feature_type = get_feature_type(feature) manager = get_manager_by_type(feature_type) # manager = 'manager_login' main_issue = client.issues.create( queue='MAINQUEUE', assignee=manager, summary='New feature request: {}'.format(feature), type={'name': 'Task'}, description='New feature request arrived' ) if feature_type.need_design: design_issue = client.issues.create( queue='DESIGN', summary='Feature "{}" design'.format(feature), type={'name': 'Task'}, description='Need design for new feature, main task: {}'.format(main_issue.id) ) main_issue.links.create(issue=design_issue.id, relationship='relates') if feature_type.add_followers: followers = get_followers(feature_type) # followers = ['my_login', 'someoneelse_login'] main_issue.update(followers={'add': followers}) if feature_type.need_testing: tester = get_random_tester() # tester = 'tester_login' main_issue.update(qa=tester) log.info('Successfully start new feature creation process') return main_issue.id ``` -------------------------------- ### Update Issue Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Update an existing issue's summary and priority. ```python issue = client.issues['MYQUEUE-42'] issue.update(summary='East or west, Yandex Tracker is the best', priority='minor') ``` -------------------------------- ### Worklog Management Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Operations for managing worklog entries associated with issues, including listing, updating, deleting, and finding worklogs. ```APIDOC ## Worklog Management ### List worklog entries for an issue ```python for entry in issue.worklog.get_all(): print(entry.createdBy.display, entry.duration, entry.comment) ``` ### Update a worklog entry ```python entry.update(duration='PT3H', comment='Revised estimate after re-check.') ``` ### Delete a worklog entry ```python entry.delete() ``` ### Find worklogs across the organization by date range ```python logs = client.worklog.find(createdAt={'from': '2024-05-01', 'to': '2024-05-31'}) ``` ``` -------------------------------- ### Change Assignee in Multiple Tickets Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Finds issues assigned to a specific user and reassigns them to another user in a bulk operation. Includes creating a comment on each ticket. ```python from yandex_tracker_client import TrackerClient client = TrackerClient(token=, org_id=) def sent_employee_to_vacation(assignee, replace_with): """ :param assignee: login in Yandex Tracker :type assignee: ``str`` :param replace_with: login in Yandex Tracker :type replace_with: ``str`` :return: is operation was successful :rtype: ``bool`` """ issues_to_transfer = client.issues.find(filter={'queue': 'MYQUEUE', 'assignee': assignee}) bulk_change = client.bulkchange.update(issues_to_transfer, assignee=replace_with) bulk_change.wait() if bulk_change.status == 'COMPLETED': log.info('Successfully change assignee in bulkchange {}'.format(bulk_change.id)) for issue in issues_to_transfer: issue.comments.create('Your ticket will be processed by another employee - {}'.format(replace_with)) successful = True else: log.error('Bulkchange operation {} failed'.format(bulk_change.id)) successful = False return successful ``` -------------------------------- ### Handle Yandex Tracker Exceptions Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Catch specific exceptions that inherit from TrackerError for fine-grained error handling. Handle network-level failures with TrackerRequestError. ```python from yandex_tracker_client.exceptions import ( NotFound, Forbidden, BadRequest, Conflict, OutOfRetries, TrackerRequestError ) try: issue = client.issues['INVALID-0'] except NotFound: print('Issue does not exist') except Forbidden: print('No read permission for this queue') except BadRequest as e: print('Bad request:', e.error_messages) except Conflict as e: print('Version conflict:', e.status_code) except OutOfRetries as e: print('Server unavailable after all retries:', e) except TrackerRequestError as e: # Network-level failure (DNS, timeout, etc.) print('Connection error:', e) ``` -------------------------------- ### Comments Management Source: https://context7.com/yandex/yandex_tracker_client/llms.txt Manage comments on an issue, including listing, creating, updating, and deleting. ```APIDOC ## Comments Management Manages the comment thread on an issue. Supports listing, creating with optional file attachments, updating, and deleting individual comments. ### Usage ```python issue = client.issues['MYQUEUE-42'] # List first 10 comments for comment in list(issue.comments.get_all())[:10]: print(comment.createdBy.display, ':', comment.text) # Add a plain comment comment = issue.comments.create(text='Investigation underway — reproducing locally.') # Add a comment with file attachments comment = issue.comments.create( text='Attached stack trace and heap dump.', attachments=['logs/stacktrace.txt', 'dumps/heap.hprof'], ) # Edit an existing comment comment = issue.comments[12345] comment.update(text='Updated findings: the issue is in the session manager.') # Delete a comment issue.comments[12345].delete() ``` ``` -------------------------------- ### Delete an Issue Link Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Deletes a specific link associated with an issue. Ensure you have the correct issue key and link ID. ```python issue = client.issues['MYQUEUE-42'] link = issue.links[42] link.delete() ``` -------------------------------- ### Delete Attachment by Name Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Delete attachments from an issue by their names. ```python ATTACHMENTS_TO_DELETE = {'to_delete.txt', 'smth.jpeg'} issue = client.issues['MYQUEUE-42'] for attach in issue.attachments: if attach.name in ATTACHMENTS_TO_DELETE: attach.delete() ``` -------------------------------- ### Update Issue Comment Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Update the text of an existing comment using its ID. ```python issue = client.issues['MYQUEUE-42'] comment = issue.comments[42] comment.update(text='New Text') ``` -------------------------------- ### Delete Attachment by ID Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Delete a specific attachment from an issue using its ID. ```python issue.attachments[42].delete() ``` -------------------------------- ### Delete Issue Comment Source: https://github.com/yandex/yandex_tracker_client/blob/master/README.rst Delete a specific comment from an issue using its ID. ```python issue = client.issues['MYQUEUE-42'] comment = issue.comments[42] comment.delete() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.