-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getAttachments only works for 2+ attachments #160
Comments
Please help submit a PR. Thanks for your contribution. |
Actually @ElBarto221 Would you please help take more tests on this change? We need to make sure the new change works. |
@dixudx Sure, what do you need me to test? Also, I just realized now that I got the getAttachments method to work, how do I get the actual attachment content? |
Btw, we are using EWM 7.0.1 with form-based authentication. |
Here's the stacktrace for OrderedDict - please note that the line numbers are shifted due to my debugging: AttributeError Traceback (most recent call last) File ~\Anaconda3\envs\rtc2jira\lib\site-packages\rtcclient\workitem.py:816, in Workitem.getAttachments(self) File ~\Anaconda3\envs\rtc2jira\lib\site-packages\rtcclient\client.py:1441, in RTCClient._get_paged_resources(self, resource_name, projectarea_id, workitem_id, customized_attr, page_size, archived, returned_properties, filter_rule) File ~\Anaconda3\envs\rtc2jira\lib\multiprocessing\pool.py:372, in Pool.starmap(self, func, iterable, chunksize) File ~\Anaconda3\envs\rtc2jira\lib\multiprocessing\pool.py:771, in ApplyResult.get(self, timeout) File ~\Anaconda3\envs\rtc2jira\lib\multiprocessing\pool.py:125, in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception) File ~\Anaconda3\envs\rtc2jira\lib\multiprocessing\pool.py:51, in starmapstar(args) File ~\Anaconda3\envs\rtc2jira\lib\site-packages\rtcclient\client.py:1505, in RTCClient._handle_resource_entry(self, resource_name, entry, projectarea_url, archived, filter_rule) AttributeError: 'str' object has no attribute 'get |
>>> import pprint
# print the field alias
>>> pprint.pprint(myattachment.field_alias, width=1) You will see all the attribute list, where you can find the content. |
I tried this
but it only gives me the URL. How can I then download the actual attachment content? If I try
it results in ExpatError Traceback (most recent call last) File ~\Anaconda3\envs\rtc2jira\lib\site-packages\xmltodict.py:378, in parse(xml_input, encoding, expat, process_namespaces, namespace_separator, disable_entities, process_comments, **kwargs) ExpatError: not well-formed (invalid token): line 17, column 78 During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) File ~\Anaconda3\envs\rtc2jira\lib\site-packages\rtcclient\utils.py:38, in token_expire_handler..wrapper(*args, **kwargs) File ~\Anaconda3\envs\rtc2jira\lib\site-packages\rtcclient\client.py:111, in RTCClient.relogin(self) TypeError: 'tuple' object is not callable |
If so, please use #fixme: if isinstance(entries, OrderedDict):
if isinstance(entries, dict): |
@ElBarto221 I found this was due to the dependency
Please stick to older 0.12.0 version. |
This has been fixed in #164. Close it. |
Trying to fetch the attachments from a workitem with only one attachment results in
AttributeError: 'str' object has no attribute 'get'
Root cause seems to be this code line:
rtcclient/rtcclient/client.py
Line 1378 in dbec1cc
If I change this to
if isinstance(entries, dict)
it works.
The text was updated successfully, but these errors were encountered: