pycontribs / jira Goto Github PK
View Code? Open in Web Editor NEWPython Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
Home Page: https://jira.readthedocs.io
License: BSD 2-Clause "Simplified" License
Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
Home Page: https://jira.readthedocs.io
License: BSD 2-Clause "Simplified" License
OAuth authentication is deprecated by atlassian.
Is there any way to use JWT with jira-python?
Hi,
Just noticed after random update we get only 50 issues max when using the following function in client.py around line 1400:
def search_issues(self, jql_str, startAt=0, maxResults=50, validate_query=True, fields=None, expand=None, json_result=None):
so this is always false :
if maxResults is None or not maxResults:
maxResults = maxi
infinite = True
Changed maxResult in the function's parameters and its okay
def search_issues(self, jql_str, startAt=0, maxResults=None, validate_query=True, fields=None, expand=None, json_result=None):
Hope this helps
Hi,
the fact that there is another repo https://bitbucket.org/bspeakmon/jira-python/overview which seems the origin of this repo, plus there is even a separate PyPi package for version 0.31 (called python-jira) built out of that repo is really confusing!
Why don't you mentioned in the README that you forked that project? Why don't you (or bspeakmon) remove the outdated package from PyPi? Why didn't you just contributed to the existing repo?
Thorsten
I'm looking for the changelog for each of the releases but cannot find it. Do you have a place where this is located?
Also, how can we tell when there is a major API change between versions. It looks like just the minor number is being bumped but there are significant differences between 0.16 and 0.38 causing problems with dependency code. It would be nice if the API changes were denoted in the verson string.
Thanks.
The PyPI page for jira contains only a wheel file:
https://pypi.python.org/pypi/jira/
But easy_install and buildout don't know how to install this distribution type. Some packages still use these systems (easy_install may be considered legacy, but it is still widely popular, and buildout is still in use).
Thanks.
I think this is due to the ongoing transfer of the project from one site to another, but figured I'd bring it up...
So, https://jira-python.readthedocs.org/en/latest/
And http://jira.readthedocs.org/en/latest/
List different version numbers (and different URLs for the source), but use the same package name for pip (pip install jira).. Of course, one of the two is wrong (the older jira-python if I had to guess?)
HTH
Certain installs of python 2.7 do not have
from six.moves import configparser
when it fails to import Python 3's
import configparser
module.
I see that it supports Python 2.7 and Python 3. Can this check which version of Python is loaded and from there determine
Python 2.* import ConfigParser
Python 3: import configparser
Thanks
transition_issue requires the transition id, but we should allow people to use their names even if Atlassian API does not allow this (we can convert the name to ID inside our library).
Hi!
I'm having trouble issuing an update call for updating summary, description or applying lablels.
Running with virtualenv on RHEL 6.4.
>>> issue.update(summary="I'm different!", description='Changed the summary to be different.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/virtualenv/py2.6-my-virtualenv-2.0.1.25/lib/python2.6/site-packages/jira/resources.py", line 331, in update
super(Issue, self).update(fields=None, async=async, jira=jira, **data)
TypeError: update() got multiple values for keyword argument 'fields'
>>> issue.update(labels=['AAA', 'BBB'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/virtualenv/py2.6-my-virtualenv-2.0.1.25/lib/python2.6/site-packages/jira/resources.py", line 331, in update
super(Issue, self).update(fields=None, async=async, jira=jira, **data)
TypeError: update() got multiple values for keyword argument 'fields'
I have customfield_10020
but not customfield_10099
. On create, I can set customfield_10020
and I get a JIRAError
attempting to set customfield_10099
. This is the behavior I would expect.
>>> from jira.client import JIRA
>>> jira = JIRA(options={'server':'http://my-jira-host/'}, basic_auth=('username','password'))
>>> jira.create_issue(project={'key': 'ADRD'}, summary='foo', description='bar', issuetype={'name':'Task'}, customfield_10099=3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/lhn/.virtualenvs/sonatype-artifact-analysis/lib/python2.7/site-packages/jira/client.py", line 596, in create_issue
raise_on_error(r)
File "/Users/lhn/.virtualenvs/sonatype-artifact-analysis/lib/python2.7/site-packages/jira/exceptions.py", line 49, in raise_on_error
raise JIRAError(r.status_code, error, r.url)
jira.exceptions.JIRAError: HTTP 400: "Field 'customfield_10099' cannot be set. It is not on the appropriate screen, or unknown."
http://pipeline-jira/rest/api/2/issue
>>> issue = jira.create_issue(project={'key': 'ADRD'}, summary='foo', description='bar', issuetype={'name':'Task'}, customfield_10020=3)
>>>
However, on issue.update, it behaves as if an update of the non-existent customfield_10099
succeeded. I would have expected a JIRAError
here too.
>>> issue.update(fields={'customfield_10020':4})
>>> issue.update(fields={'customfield_10099':4})
>>>
If I trace through with the debugger I see a 400
(with the goofy error message discussed in #1) come back from the server at https://github.com/pycontribs/jira/blob/0.33/jira/resources.py#L120, but it is never raised as a JIRAError
.
Looks like this is an indentation error introduced in 5d08efe. I'll go see about making a pull request.
Hello,
starting with the version 0.36 a new 'MultipartEncoder' method has been introduced in the add_attachment() function and since that all attachments seem to be treated as plan-text files.
Because of that one can't open such a ZIP files directly from JIRA any longer - you'll see the contents of the binary ZIP file.
It worked properly till version 0.35.
Could you please fix that?
Thank you!
PS i found one "quick and dirty" solution - uninstalling "requests-toolbelt" package, but it will be automatically installed next time you want to upgrade the "jira" package.
With kind regards,
Max
All right, I wouldn't be surprised if there's something I'm doing wrong here, but I can't spot it, so I wonder if anyone can enlighten me...
I'm getting error 400 ("The value 'project_id' does not exist for the field 'project'") when querying via search_issues, but the same query work in jirashell.
I've anonymized the name of our atlassian instance, user id and password below of course, but I am able to log in with those credentials to the atlassian instance, so that shouldn't be the problem.
(as of this morning, with jira 0.39)
via jirashell:
jirashell -s https://[our_instance].atlassian.net -u [uid] -p [psw]
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/frontend.py:30: UserWarning: The top-level frontend
package has been deprecated. All its subpackages have been moved to the top IPython
level.
warn("The top-level frontend
package has been deprecated. "
<JIRA Shell 0.39 (https://[our_instance].atlassian.net)>
*** JIRA shell active; client is in 'jira'. Press Ctrl-D to exit.
In [1]: projects = jira.projects()
In [2]: keys = sorted([project.key for project in projects])
In [3]: print ','.join(keys)
MI
In [4]: issues = jira.search_issues('project=MI')
In [5]: print len(issues)
42
On the other hand, I have a python script serving a web page.
This script uses my JIRAClient wrapper:
import sys
from jira.client import JIRA
class JIRAClient:
def init(self):
jiraOpts = {
'server': 'https://[our_instance].atlassian.net',
'basic_auth': ('uid', 'pwd')
}
self.jira = JIRA(jiraOpts)
def GetIssues(self):
qry = 'project=MI'
return self.jira.search_issues(qry)
This leads to the error:
File "/Users/frankr/Documents/Mobi/SyncService_trunk/tools/MIIT/JIRAClient.py", line 38, in GetIssues
return self.jira.search_issues(qry)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jira/client.py", line 1433, in search_issues
resource = self._get_json('search', params=search_params)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jira/client.py", line 1853, in _get_json
r = self._session.get(url, params=params)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jira/resilientsession.py", line 78, in get
return self.__verb('GET', url, *_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jira/resilientsession.py", line 74, in __verb
raise_on_error(r, verb=verb, *_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jira/utils.py", line 120, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
JIRAError: JiraError HTTP 400
text: The value 'MI' does not exist for the field 'project'.
url: https://[our_instance].atlassian.net/rest/api/2/search?jql=project%3DMI&validateQuery=True&startAt=0&maxResults=50
Additional info:
qry='project="MI"' produces the same results
self.jira.search_issues(qry, validate_query=False) produces no error but returns an empty list
I am using jira-python behind a corporate firewall. There now seems to be a check in the initialisation code that requires an external http connection. Is this check really needed? Can it be optionally suppressed?This is the stack trace:
File "C:\Users\bdalton\AppData\Roaming\Python\Python27\site-packages\jira\client.py", line 217, in init
self.check_update()
File "C:\Users\bdalton\AppData\Roaming\Python\Python27\site-packages\jira\client.py", line 222, in check_update
data = requests.get("http://pypi.python.org/pypi/jira/json").json()
File "C:\Users\bdalton\AppData\Roaming\Python\Python27\site-packages\requests\api.py", line 65, in get
return request('get', url, *_kwargs)
File "C:\Users\bdalton\AppData\Roaming\Python\Python27\site-packages\requests\api.py", line 49, in request
response = session.request(method=method, url=url, *_kwargs)
File "C:\Users\bdalton\AppData\Roaming\Python\Python27\site-packages\requests\sessions.py", line 461, in request
resp = self.send(prep, *_send_kwargs)
File "C:\Users\bdalton\AppData\Roaming\Python\Python27\site-packages\requests\sessions.py", line 573, in send
r = adapter.send(request, *_kwargs)
File "C:\Users\bdalton\AppData\Roaming\Python\Python27\site-packages\requests\adapters.py", line 415, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(10060, 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to
respond'))
The PyPI page for jira contains only a wheel file:
https://pypi.python.org/pypi/jira/
But easy_install and buildout don't know how to install this distribution type. Some packages still use these systems (easy_install may be considered legacy, but it is still widely popular, and buildout is still in use).
Thanks.
>>> from jira import JIRA
>>> jira = JIRA('https://jira.atlassian.com')
>>> issue = jira.issue('JRA-9')
>>> issue.permalink()
u'https://jira.atlassian.com/browse/JRA-9 - None'
This is due to Resource.__getattr__
not raising an AttributeError when being asked for the 'child' attribute.
See pull request #21 for a potential fix.
i am working on my web application where it integrates jira, confluence, fisheye-crucible.
when i submit my username and password i am able to return the object using
jclient=JIRA(server,basic_auth=(username,password)
I don't like to create jclient object for every request , when the user using for different operations.
so i like to save the object in user session in django.
when i try to serialize the jclient object for further use it is not serializing and gets the following errors with different serializer's.
with json:
<jira.client.JIRA object at 0x109e681d0> is not JSON serializable
with pickle:
can't pickle weakref objects with pickle module
with dill:
ctypes objects containing pointers cannot be pickled
How can i used this app in my web application where i create a single JIRA object through out the user session in django.
ordereddict
is always being declared as an install requirement, but it should only do so if Python version is <= 2.6.
This causes issues with conda builds/packages, where orderedict
is not availablein Python 2.7 (as it shouldn't).
I believe that a patch similiar to this could work:
--- setup.py 2015-04-03 12:32:37.000000000 +0000
+++ setup_new.py 2015-05-13 14:01:35.886777103 +0000
@@ -132,6 +132,13 @@
raise RuntimeError(
"Current version of the package is equal or lower than the already published ones (PyPi). Increse version to be able to pass prerelease stage.")
+INSTALL_REQUIRES=['requests>=2.6.0',
+ 'requests_oauthlib>=0.3.3',
+ 'tlslite>=0.4.4',
+ 'six>=1.9.0',
+ 'requests_toolbelt']
+if sys.version_info[:2] <= (2,6):
+ INSTALL_REQUIRES.append('ordereddict')
setup(
name=NAME,
@@ -141,12 +148,7 @@
include_package_data=True,
- install_requires=['requests>=2.6.0',
- 'requests_oauthlib>=0.3.3',
- 'tlslite>=0.4.4',
- 'six>=1.9.0',
- 'requests_toolbelt',
- 'ordereddict'],
+ install_requires=INSTALL_REQUIRES,
setup_requires=[],
tests_require=['pytest', 'tlslite>=0.4.4', 'requests>=2.6.0',
'setuptools', 'pep8', 'autopep8', 'sphinx', 'six>=1.9.0'],
Right now only JIRA links are returned.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I have JIRA 0.39 installed and have the latest six and HTMLParser installed. However, I still got the following error message when my script is packed with cx_Freeze.
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in
exec code in m.dict
File "FreeMind.py", line 3, in
File "C:\Python27\lib\site-packages\jira__init__.py", line 5, in
from .config import get_jira
File "C:\Python27\lib\site-packages\jira\config.py", line 17, in
from jira.client import JIRA
File "C:\Python27\lib\site-packages\jira\client.py", line 33, in
from six.moves import html_parser
File "C:\Python27\lib\site-packages\six.py", line 199, in load_module
mod = mod._resolve()
File "C:\Python27\lib\site-packages\six.py", line 113, in _resolve
return _import_module(self.mod)
File "C:\Python27\lib\site-packages\six.py", line 80, in _import_module
import(name)
ImportError: No module named HTMLParser
When trying to add labels to an issue - either during creation or afterwards.
from jira.client import JIRA
jira = JIRA('https://jira.atlassian.com')
issue = jira.issue('JRA-107')
issue.update(labels=['bla', 'blubb'])
OR
issue.fields.labels.append(u'bla')
issue.update(fields={'labels': issue.fields.labels})
Both examples were taken from the documentation.
JIRAError: JiraError HTTP 400
text: Field 'labels' cannot be set. It is not on the appropriate screen, or unknown.
But (after manually adding labels on the Web):
print issue.fields.labels
[u'bla', u'blubb']
So the field is there.
jira-0.37 with Python 2.6.9 on OSX
Hi. This repository is missing several version tags, including one for the latest version, 0.47. Can you please add tags for the correct revisions, and make sure future versions have tags too? It's an important practice. Thanks.
Not having the releases available as tags makes it unnecessary difficult to match specific release to a state of the repo.
When calling delete_project on a project which is known to exist in a local jira instance, the API returns as if the project has been deleted but navigating to the projects page in jira reveals the project to still be there.
System:
Example test case:
class TestJiraClient(unittest.TestCase):
jiraclient = JIRA(options={'server': 'http://jira.local'}, basic_auth=('jira_admin', 'mypassword'))
...
def test_create_and_delete_project(self):
project_id = ''.join(random.choice(string.ascii_uppercase) for _ in range(3))
project = self.jiraclient.create_project(project_id, 'This is a test project with ID ' + project_id, 'jira_admin')
assert project != False
self.jiraclient.delete_project(project['projectKey'])
with self.assertRaises(JIRAError):
self.jiraclient.find_project(project['projectKey'])
Tracing through jira/client.py
I get the following:
http://jira.local/secure/admin/DeleteProject.jspa
{u'confirm': u'true', u'pid': u'10202', u'Delete': u'Delete'}
<Response [200]>
Printing the value of r.text
reveals the response is coming back from the Administrator Access page.
The fix for this would be, if using basic_auth, to change the destination page to /secure/admin/WebSudoAuthenticate.jspa
, set the payload to:
{
'webSudoPassword': self._session.auth[1],
'confirm': 'true',
'Delete': 'Delete',
'pid': pid,
'webSudoDestination': '/secure/admin/DeleteProject.jspa',
'webSudoIsPost': 'true'
}
then once this has succeeded, re-post the delete action.
def delete_project(self, pid):
...
uri = '/secure/admin/DeleteProject.jspa'
url = self._options['server'] + uri
payload = {'pid': pid, 'Delete': 'Delete', 'confirm': 'true'}
r = self._gain_sudo_session(payload, uri)
if r.status_code != 200:
return False
...
def _gain_sudo_session(self, options, uri):
url = self._options['server'] + '/secure/admin/WebSudoAuthenticate.jspa'
payload = {
'webSudoPassword': self._session.auth[1],
'webSudoDestination': destination,
'webSudoIsPost': 'true'
}
payload.update(options)
return self._session.post(
url,
headers=CaseInsensitiveDict({
'content-type': 'application/x-www-form-urlencoded'
}),
data=payload
)
Hi guys,
Sorry for my english.
I've played with the package and found that it behaves a little bit strange, for instance:
In [4]: issue = jira.issue('CDAS-782')
In [5]: issue2 = jira.issue('CDAS-782')
In [6]: issue == issue2
Out[6]: False
In [7]: issues = jira.search_issues('key in (CDAS-782, CDAS-783)')
In [8]: issues
Out[8]: [<JIRA Issue: key=u'CDAS-783', id=u'65593'>,
<JIRA Issue: key=u'CDAS-782', id=u'65523'>]
In [9]: issue in issues
Out[9]: False
That probably might be fixed by implementing of __eq__
method for Issue
class, or even for Resource
class if that makes sense. Something like the following should be enough:
def __eq__(self, other):
return self.id == other.id
The second thing I'd like to raise with you is using of an ordered set as base class for ResultList
class as boards and issues are going to be unique across a project. If I understand you decided to use a class inherited from list
as it's necessary to keep order of issues returned by server 'cause it's important if we make JQL request that ends with ORDER BY any_field [ASC|DESC]
.
But lists are not supposed to have unique objects so if we need to keep order and keep uniqueness we should use ordered set instead. In addition it would be great to have some set's benefits (I mean algebra of sets).
It was just a superficial glance and I would appreciate if you share your thoughts.
Thanks,
Roman
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Exception AttributeError: "'NoneType' object has no attribute 'magic_close'" in <function at 0x1a290c8> ignored
Exception TypeError: "'NoneType' object is not callable" in <bound method JIRA.del of <jira.client.JIRA object at 0z1a16a10>> ignored
Exception AttributeError: "'NoneType' object has no attribute 'warn'" in <function cleanup at 0x1a19d70> ignored
Problem is the del method
if session is not None:
session.close()
and the _try_magic() method call
The jira-python api and the Jira Rest API cannot deactivate a user directly, look at theses links:
https://jira.atlassian.com/browse/JRA-37294
https://answers.atlassian.com/questions/292406/how-to-change-a-user-activity-status-by-rest-api
But this is a usefull feature for me, that want to create a script to manage users in jira. There is any way to perform this action? I tried the following but without success:
user = jira.user(username)
user.update({"active":"false"})
This raise the following exception:
File "/home/fabio/git-repositories/jira-scripts/jira-scripts-env/local/lib/python2.7/site-packages/jira/utils.py", line 120, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.utils.JIRAError: JiraError HTTP 400
text: error.no.value.found.to.be.changed
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
if oauth:
self._create_oauth_session(oauth)
elif basic_auth:
oauth is never None because jirashell.process_config always creates an object, which means that the basic_auth section is now unreachable, as the else section after it.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
In your code base, there's a reference (in a warning) to https://bitbucket.org/bspeakmon/jira-python/issue/46. The issues on the Bitbucket repo are closed, though, or at least they can no longer be accessed (Access denied).
The old issues should be made available somewhere for reference.
In [14]: j.applicationlinks()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-14-02b0456602b9> in <module>()
----> 1 j.applicationlinks()
/home/jantman/CMG/git/jira2v1/lib/python2.7/site-packages/jira-0.47-py2.7.egg/jira/client.pyc in applicationlinks(self, cached)
348 r = self._session.get(url)
349
--> 350 o = json_loads(r)
351 if 'list' in o:
352 self._applicationlinks = o['list']
/home/jantman/CMG/git/jira2v1/lib/python2.7/site-packages/jira-0.47-py2.7.egg/jira/utils.pyc in json_loads(r)
78 raise_on_error(r)
79 if len(r.text): # r.status_code != 204:
---> 80 return json.loads(r.text)
81 else:
82 # json.loads() fails with empy bodies
/usr/lib64/python2.7/json/__init__.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
336 parse_int is None and parse_float is None and
337 parse_constant is None and object_pairs_hook is None and not kw):
--> 338 return _default_decoder.decode(s)
339 if cls is None:
340 cls = JSONDecoder
/usr/lib64/python2.7/json/decoder.pyc in decode(self, s, _w)
364
365 """
--> 366 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
367 end = _w(s, end).end()
368 if end != len(s):
/usr/lib64/python2.7/json/decoder.pyc in raw_decode(self, s, idx)
382 obj, end = self.scan_once(s, idx)
383 except StopIteration:
--> 384 raise ValueError("No JSON object could be decoded")
385 return obj, end
ValueError: No JSON object could be decoded
Furthermore, this makes it to add a remote link (web link) if no Application Links are configured:
In [13]: j.add_remote_link('AUTO-1084', {'url':'http://www.jasonantman.com', 'title':'testing'})
/home/jantman/CMG/git/jira2v1/lib/python2.7/site-packages/jira-0.47-py2.7.egg/jira/client.py:859: Warning: broken: see https://bitbucket.org/bspeakmon/jira-python/issue/46 and https://jira.atlassian.com/browse/JRA-38551
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-13-bf85abacee94> in <module>()
----> 1 j.add_remote_link('AUTO-1084', {'url':'http://www.jasonantman.com', 'title':'testing'})
/home/jantman/CMG/git/jira2v1/lib/python2.7/site-packages/jira-0.47-py2.7.egg/jira/client.pyc in add_remote_link(self, issue, destination, globalId, application, relationship)
889
890 # check if the link comes from one of the configured application links
--> 891 for x in self.applicationlinks():
892 if x['application']['displayUrl'] == self._options['server']:
893 data['globalId'] = "appId=%s&issueId=%s" % (
/home/jantman/CMG/git/jira2v1/lib/python2.7/site-packages/jira-0.47-py2.7.egg/jira/client.pyc in applicationlinks(self, cached)
348 r = self._session.get(url)
349
--> 350 o = json_loads(r)
351 if 'list' in o:
352 self._applicationlinks = o['list']
/home/jantman/CMG/git/jira2v1/lib/python2.7/site-packages/jira-0.47-py2.7.egg/jira/utils.pyc in json_loads(r)
78 raise_on_error(r)
79 if len(r.text): # r.status_code != 204:
---> 80 return json.loads(r.text)
81 else:
82 # json.loads() fails with empy bodies
/usr/lib64/python2.7/json/__init__.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
336 parse_int is None and parse_float is None and
337 parse_constant is None and object_pairs_hook is None and not kw):
--> 338 return _default_decoder.decode(s)
339 if cls is None:
340 cls = JSONDecoder
/usr/lib64/python2.7/json/decoder.pyc in decode(self, s, _w)
364
365 """
--> 366 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
367 end = _w(s, end).end()
368 if end != len(s):
/usr/lib64/python2.7/json/decoder.pyc in raw_decode(self, s, idx)
382 obj, end = self.scan_once(s, idx)
383 except StopIteration:
--> 384 raise ValueError("No JSON object could be decoded")
385 return obj, end
ValueError: No JSON object could be decoded
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Not sure if it is the intended behavior or am I missing something, but whenever I add a worklog via the API, I get logged out in my browser after a few minutes -- despite the fact that the "remember me" option is checked.
Example call:
daroczig@********:/opt/hamster-bridge$ bin/python
Python 2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from jira import JIRA
>>> jira = JIRA('https://*********.atlassian.net', basic_auth=('*********', '*********'))
>>> jira.add_worklog('*****-21', '6m')
<JIRA Worklog: id=u'10454'>
Based on the JIRA docs, first I thought that the API calls are not re-using the session -- but that shouldn't be an issue with the Jira python library.
Any ideas on how can I debug this?
After revisting Issue #99 from the old bitbucket.org repository found at https://bitbucket.org/bspeakmon/jira-python/issue/99/add_user-is-not-working-with-ondemand, I've also discovered that this does not work with the server version either.
I have created a unit test that recreates this issue and will be issuing a pull request shortly.
Right now, when a worklog entry is created, you need to pass the time as a string (2d 3h 5m), but the JIRA API supports receiving a timeSpentSeconds value, which is easier to generate from an application if you're doing math to calculate the timeSpent
I ran into issues caused by the bug that was fixed in #57 today. It would be awesome to have this fixed in the version on PyPI. It looks like there has been a bunch of other changes since 0.43 as well.
There is a syntax error in jira.client.JIRA.create_version(). Below is the code.
if releaseDate is not None:
data['releaseDate'] = releaseDate
if startDate is not None:
data['startDate'] = releaseDate
The line change should be
data['startDate'] = startDate
I'm running the following snippet:
from jira.client import JIRA
jira = JIRA('https://jira.atlassian.com')
issue = jira.issue('JRA-9')
version = jira.project_versions(jira.project("JRA"))[0]
print version.id
issue.update(fixVersions=[{"id":version.id}])
fixVersions
is set on the issue
10130
Traceback (most recent call last):
File "foo.py", line 10, in <module>
issue.update(fixVersions=[{"id":version.id}])
File "/Library/Python/2.7/site-packages/jira/resources.py", line 331, in update
super(Issue, self).update(fields=None, async=async, jira=jira, **data)
TypeError: update() got multiple values for keyword argument 'fields'
I'm running OSX 10.10.1
$~ pip show jira
---
Name: jira
Version: 0.35
Location: /Library/Python/2.7/site-packages
Requires: tlslite, six, requests-oauthlib, requests
$ ~ python --version
Python 2.7.6
had to add the 'X-Atlassian-Token': 'nocheck' in the headers on for add_attachment def.
new_issue_dict = {
... 'project': {'key': 'SBOP'},
... 'summary': 'FixStorage Error on test01 / au03test01',
... 'description': 'test 1 2 3 4 5',
... 'issuetype': {'name': 'Inquiry'},
... 'priority': {'name': 'Critical'},
... 'components': {'name': 'Troubleshooting'},
... }
new_issue = jira.create_issue(fields=new_issue_dict)
Traceback (most recent call last):
File "", line 1, in
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/client.py", line 694, in create_issue
r = self._session.post(url, data=json.dumps(data))
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/resilientsession.py", line 81, in post
return self.__verb('POST', url, *_kwargs)
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/resilientsession.py", line 74, in __verb
raise_on_error(r, verb=verb, *_kwargs)
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/utils.py", line 120, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.utils.JIRAError: JiraError HTTP 400
text: data was not an array
url: https://jira.dev.smbc.nasdaqomx.com/jira/rest/api/2/issuenew_issue = jira.create_issue(project='SBOP', summary='FixStorage Error on test01 / au03test01', description='test 1 2 3', issuetype={'name': 'Inquiry'}, priority={'name': 'Critical'}, components={'name': 'Storage'})
Traceback (most recent call last):
File "", line 1, in
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/client.py", line 694, in create_issue
r = self._session.post(url, data=json.dumps(data))
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/resilientsession.py", line 81, in post
return self.__verb('POST', url, *_kwargs)
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/resilientsession.py", line 74, in __verb
raise_on_error(r, verb=verb, *_kwargs)
File "/home/timyip/pythonenv/lib/python3.3/site-packages/jira/utils.py", line 120, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.utils.JIRAError: JiraError HTTP 400
text: data was not an array
url: https://jira.dev.smbc.nasdaqomx.com/jira/rest/api/2/issue
Any idea?
Using jira 0.39
It would be great if you could provide a changelog for the versions of jira. Maybe I just couldn't find it. If thats the case, than sorry for bothering. But maybe you could add a link to it in the documentation or here at git. Thank you.
Hi. This repository contains tags for all the released versions of the package, but not for v0.40 and v0.41. Can you please add tags for the correct revisions? I don't know which commit matches what version. Thanks.
Hey there!
I have a project -- jirafs -- that relies upon interacting with a JIRA instance using pycontribs/jira. I've wanted to have more-solid integration tests for quite a while now, and I've been looking around to see if I could find a JIRA instance to use for integration testing, but they're a little bit hard to come by.
Just a moment ago, I happened across the fact that you have an instance that you use specifically for that purpose -- I wonder if I could convince you into providing me access to a project on https://pycontribs.atlassian.net/ for doing my own integration testing of jirafs?
Cheers!
Good day
Is it possible to get all the issues within a Sprint, including all the metadata (reporter,status, assignee etc)?
At the moment all you can get is the complete or incomplete issues in a sprint?
Is there way to do this?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
โฆ meaning the short summary above the file list in the main repo view, that is actually indexed for searches in GitHub (the readme is not).
I have not been able to get something like this to work.
issuses = jira.search_issues('project = "PROJECT" AND issuetype = "Some Issue Type"', maxResults=False)
with open('pickles.dat", 'w') as pickles:
pickle.dump(issues, pickles, pickle.HIGHEST_PROTOCOL)
issues2 = pickle.load(open('pickles.dat', 'r'))
The load fails with
AttributeError: <class 'jira.resources.Issue'> object has no attribute '_options'
Am I doing something wrong? Or do these objects not work with pickle?
I don't know exactly what it is, but pickle a Sprint object and load it with pickle doesen't work.
Don't have enough time at the moment to dig deeper into it.
Here is an example code for reproducing:
class Board(object):
"""
my representation of jira board
"""
def __init__(self, board_id, state='FUTURE'):
self.board_id = board_id
self.connection = JIRA(
options={'server': ... },
basic_auth=(username, password),
)
self.sprints = self.__get_sprints(board_id, state)
def __get_sprints(self, board_id, state):
"""
Returns all future sprints for the given board...
"""
sprints = []
try:
for sprint in self.connection.sprints(id=board_id):
if sprint.state in [state]:
sprints.append(sprint)
except JIRAError, e:
pass
return sprints
board = Board(1234)
import cPickle as pickle
pickle.loads(pickle.dumps(board))
RESULT:
Traceback:
File ".../lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
pickle2.loads(pickle2.dumps(board))
self._parse_raw(raw_pickled)
dict2resource(raw, self, self._options, self._session)
raise AttributeError("%r object has no attribute %r" % (self.**class**, item))
Exception Type: AttributeError at /planning/sprint/15
Exception Value: <class 'jira.resources.Sprint'> object has no attribute '_options'
i.update(assignee={'name':'foo'})
...
JIRAError: HTTP 400: "one of 'fields' or 'update' required"
http://jiraserver/jira/rest/api/2/issue/497258
i.update(fields={'assignee':{'name':'foo'}})
...
JIRAError: HTTP 400: "one of 'fields' or 'update' required"
http://jiraserver/jira/rest/api/2/issue/497258
i.update(fields={'fields':{'assignee':{'name':'foo'}}})
...
# works
JIRA server in this case is running 6.3.x. As far as I can tell, this syntax structure has been required ever since the issue PUT REST API was added.
from jira.client import JIRA
jira = JIRA(options={'server': JIRA_URL})
issue = jira.issue('SB-15')
issue.fields.labels.append("this should not work")
issue.update(fields={"labels": issue.fields.labels})
This should fail but as it exists now will exit with 0. Making the same call via the REST API produces an expected HTTP Error 400.
Hi,
I am trying to update certain fields on an issue, but I am getting the following error:
python> issue.update(description='some text')
ERROR:root:[u"Field 'description' cannot be set. It is not on the appropriate screen, or unknown."]
*** JIRAError: HTTP 400: "Field 'description' cannot be set. It is not on the appropriate screen, or unknown."
But looking at the issue fields, description field is quite a valid field (jira default field...):
python>issue.fields.description
'old description'
thanks for your help,
When using the add_user method to create a new user, one of the keyword arguments is 'fullname'. Regardless of what you put here, the "Full Name" in JIRA is always the username. Example:
result = jira.add_user(username='your_mama',
email='[email protected]',
password="mypassword",
fullname="Your Mama",
sendEmail=False,
active=True
)
After running this, when you look on the JIRA instance, the "Full Name" is not set to "Your Mama" but rather 'your_mama'.
Seen with v. jira-0.47
Note: resubmitting this (originally issue #70) but it was closed without explanation.
When using the add_user method to create a new user, one of the keyword arguments is 'fullname'. Regardless of what you put here, the "Full Name" in JIRA is always the username. Example:
result = jira.add_user(username='your_mama',
email='[email protected]',
password="mypassword",
fullname="Your Mama",
sendEmail=False,
active=True
)
After running this, when you look on the JIRA instance, the "Full Name" is not set to "Your Mama" but rather 'your_mama'.
Seen with v. jira-0.47
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.