Code Monkey home page Code Monkey logo

jira's People

Contributors

abizzinotto avatar achimh3011 avatar adehad avatar asqui avatar bakkeby avatar bogdan-marchis avatar bspeakmon avatar danny-cheung avatar dbaxa avatar dbravender avatar dchevell avatar dependabot[bot] avatar dugjason avatar expobrain avatar fikander avatar filmackay avatar hdost avatar jonromero avatar jwodder avatar lechat avatar markeganfuller avatar mattwtstudley avatar merazola avatar pbabinca avatar pre-commit-ci[bot] avatar rynkk avatar simplicityguy avatar ssbarnea avatar studioj avatar vassius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jira's Issues

JWT authentication

OAuth authentication is deprecated by atlassian.
Is there any way to use JWT with jira-python?

maxResults = 50 in search_issues

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

Confusuion because two repos exists which are basically the same

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

Do you have changelog from each release?

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.

update() got multiple values for keyword argument 'fields'

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'

issue.update fails silently

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.

add_attachment() adds ZIP files as 'text/plain', so they can't be open in JIRA afterwards (problem started in v0.36)

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

search_issues yields error 400 (The value does not exist for the field 'project')

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

0.37 doesn't work from behind a firewall

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'))

issue.permalink() appends ' - None' to the link

>>> 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.

<jira.client.JIRA object at 0x109e681d0> is not JSON serializable or can't pickle weakref objects with pickle module

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.

Bad install_requires for 'ordereddict' when using Python > 2.6

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'],

Show "ImportError: No module named HTMLParser" when python scripts are packed with cx_Freeze

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.

  • It works fine when JIRA related code is removed.
  • It works fined during debugging (source code level).
    Appreciate your comments on this.

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

Add Labels to Issue: Field 'labels' cannot be set. It is not on the appropriate screen, or unknown.

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

missing v0.47 tag

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.

delete_project doesn't actually do anything.

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:

  • python: 2.7 running on Linux mint 17.1.
  • python-jira: 0.47
  • Jira: 6.4.4

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
        )

Comparison of issues and ordered set for ResultList rather than list

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 on close

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

Support to deactivate a user

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.

basic auth broken in jirashell

        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.

applicationlinks() throws ValueError if none configured

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.

logout in browser when adding worklog

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?

startDate in create_version() is using releasedDate attribute

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

update() got multiple values for keyword argument 'fields'

Issue

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}])

Expected behaviour

fixVersions is set on the issue

Actual behaviour:

 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'

Configuration

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

Cannot create new issue

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/issue

new_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

providing a changelog

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.

missing v0.41 tag

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.

Integration testing on https://pycontribs.atlassian.net/

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!

Provide a repo description

โ€ฆ 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).

Can pickle be used successful on jira v0.41 issue objects?

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?

pickle dumps and loads doesen't work correctly

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

  1.                 response = wrapped_callback(request, _callback_args, *_callback_kwargs)
    
    File ".../planning/sprints/views.py" in planning
  2.             pickle2.loads(pickle2.dumps(board))
    
    File ".../lib/python2.7/site-packages/jira/resources.py" in setstate
  3.     self._parse_raw(raw_pickled)
    
    File ".../lib/python2.7/site-packages/jira/resources.py" in _parse_raw
  4.     dict2resource(raw, self, self._options, self._session)
    
    File ".../lib/python2.7/site-packages/jira/resources.py" in getattr
  5.             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'

issue.update doesn't work without hackery

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.

Applying/updating malformed label does not produce exception

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.

issue.update() is failing: Field 'description' cannot be set. It is not on the appropriate screen, or unknown.

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,

fullname kwarg not honored in jira.add_user

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

fullname kwarg not honored in jira.add_user

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.