Jenkins Python API: get QueueItem by ID
<p>Invoking a job in Jenkins via <a href="https://pypi.python.org/pypi/jenkinsapi/0.2.31" rel="nofollow">jenkinsapi</a> returns a <code>jenkinsapi.queue.QueueItem</code> object that represents queued build.</p>

<p>How can I get <code>QueueItem</code> object of an already queued build, given <code>queue_id</code>? I have tried:</p>

<pre><code>j = Jenkins(...)
queue = j.get_queue()
queue_item = queue[queue_id]
</code></pre>

<p>But that is valid only for about 6-10 seconds, after that <code>UnknownQueueItem</code> error is raised.</p>

<p>It seems you have to create <code>QueueItem</code> manually:</p>

<pre><code>j = Jenkins(...)
url = j.base_server_url() + "/queue/item/" + str(queue_id) + "/"
queue_item = jenkinsapi.queue.QueueItem(url, j);
</code></pre>

python jenkins jenkins-api