Comments (8)
Can't reproduce this error, everything works perfectly for me, here's the code:
>>> issue = redmine.issue.new()
>>> issue.project_id = 'some_project'
>>> issue.subject = 'test'
>>> issue.uploads = [{'path': '/some/path/to/file/test.zip'}]
>>> issue.save()
True
Also, you error message is a little bit strange, why do you have this print response['upload']['token']
in File "/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/__init_.py", line 49
.
There is no such code in the package, looks like you've added it yourself while debugging. Please try uninstalling python-redmine and then reinstalling it again. Also please try installing the previous python-redmine version (0.7.2) and see if it works for you because I changed some code for file uploads in the latest version.
If the error is still there I need more details from you to reproduce this:
- Your exact code which causes the error
- Your Python version
- Your Redmine version
from python-redmine.
I removed the version i had (and yes, i was trying to trouble shoot the issue myself). I now have a freash copy from easy_install (0.8.0). I reran my code and got my original error which is:
Traceback (most recent call last):
File "./kedmine.py", line 137, in
main()
File "./kedmine.py", line 125, in main
res = issue.save()
File "/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/resources.py", line 227, in save
for item, value in self.manager.create(**self._changes):
File "/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/managers.py", line 158, in create
fields['uploads'][index]['token'] = self.redmine.upload(upload.get('path', ''))
File "/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/init.py", line 50, in upload
return response['upload']['token']
TypeError: 'NoneType' object has no attribute 'getitem'
I am running python 2.7.5 and my code is as follows (some items renamed to protect the innocent). It shouldn't matter, but I am coding on mac OSX 10
issue = redmine.issue.new()
issue.project_id = 'XXXX'
issue.assigned_to_id = m_id
issue.watcher_user_ids = [62, 10]
issue.subject = args.subject
issue.description = args.description
issue.status_id = 1
issue.priority_id = 2
issue.tracker_id = 15
issue.uploads = [{'path': '/hard/coded/path/for/testing.zip'}]
res = issue.save()
from python-redmine.
OK, it seems that the response
returned None, that means that something is wrong. You didn't tell me what Redmine version do you use. Also please show me the print of the response.status_code
and response.content
from response
variable which is in
/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/__init_.py
in line 77 (response = getattr(requests, method)(url, **kwargs)
)
from python-redmine.
Max,
Sorry, im using the 0.8.0 that gets installed when you do an easy_install.
it seems that the json is too large looking at the below error. Which is
weird because the file is only 360KB and uploads fine manually. A work
around might be for me to create a ticket with .save and then upload it
with my file, but that seems unneeded.
200
{"user":{"custom_fields":[{"value":"pastels_on_dark","name":"Ultraviolet
Theme","id":12}],"created_on":"2014/03/10 13:03:51
-0700","lastname":"LAST","mail":"ME@DOMAIN","firstname":"Jaime","id":XX,"last_login_on":"2014/03/31
09:25:17 -0700"}}
413
<title>413 Request Entity Too Large</title>Request Entity Too Large
The requested resource
/uploads.json
does not allow request data with POST requests, or the amount of data
provided in
the request exceeds the capacity limit.
Apache/2.2.15 (CentOS) Server at project.DOMAIN.com Port 443
On Mon, Mar 31, 2014 at 11:44 AM, Max Tepkeev [email protected]:
OK, it seems that the response returned None, that means that something
is wrong. You didn't tell me what Redmine version do you use. Also please
show me the print of the response.status_code and response.content from
response variable which is in/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/_init.py
in line 77 (response = getattr(requests, method)(url, **kwargs))
Reply to this email directly or view it on GitHubhttps://github.com//issues/25#issuecomment-39104057
.
from python-redmine.
Hi!
0.8.0 is the version of Python Redmine, and not the Redmine itself. I was asking your Redmine version because your problem is not related to Python Redmine but either to the Redmine itself or to the web server hosting your Redmine application (seems to be Apache in your case).
Keep in mind that file uploads via REST API are available only for Redmine 1.4.0+
Also, there is a LimitRequestBody directive in Apache which controls this limits. If you have nginx in front of Apache there is a client_max_body_size directive which also controls the request body limits.
I'm afraid that's all I can do for you because the problem doesn't seem to be related with Python Redmine. You have to upgrade your Redmine if it's < 1.4.0 and play with Redmine/Apache/Nginx settings to make uploads work.
I'm not closing this issue in case you'll have any more questions about this problem. Also if you'll find a solution please post it here for others. Thanks.
from python-redmine.
It appears to be the Redmine version. I'm just going to write some code to
upload the file via a POST outside of the API. Might a suggest a version
check, or handling the error so it doesn't just crash?
On Tue, Apr 1, 2014 at 3:46 AM, Max Tepkeev [email protected]:
Hi!
0.8.0 is the version of Python Redmine, and not the Redmine itself. I was
asking your Redmine version because your problem is not related to Python
Redmine but either to the Redmine itself or to the web server hosting your
Redmine application (seems to be Apache in your case).Keep in mind that file uploads via REST API are available only for Redmine
1.4.0+Also, there is a LimitRequestBodyhttp://httpd.apache.org/docs/2.2/mod/core.html#limitrequestbodydirective in Apache which controls this limits. If you have nginx in front
of Apache there is a client_max_body_sizehttp://wiki.nginx.org/HttpCoreModule#client_max_body_sizedirective which also controls the request body limits.I'm afraid that's all I can do for you because the problem doesn't seem to
be related with Python Redmine. You have to upgrade your Redmine if it's <
1.4.0 and play with Redmine/Apache/Nginx settings to make uploads work.I'm not closing this issue in case you'll have any more questions about
this problem. Also if you'll find a solution please post it here for
others. Thanks.Reply to this email directly or view it on GitHubhttps://github.com//issues/25#issuecomment-39178748
.
from python-redmine.
0.8.0 can't be the Redmine version, because REST API become available only from Redmine 1.0+. You can find your Redmine version at http://your-redmine-url/admin/info
There is a version check in Python Redmine but you have to specify your Redmine version explicitly in
redmine = Redmine('http://demo.redmine.org', version='2.3.3')
because there is currently no way to get the Redmine version through it's api.
from python-redmine.
I added additional error checks which are available as of v0.8.1
from python-redmine.
Related Issues (20)
- tags from task HOT 2
- check the existence of a task HOT 1
- Copy project HOT 2
- Is it possible to integrate a "geojson" parameter in issue creation? HOT 2
- KeyError: 'time_entry' HOT 3
- Cant Set priority_id HOT 5
- When adding a user to a group that they are already a member of get "User is invalid" HOT 2
- How to: Create Issue onbehalf of another user HOT 4
- Bug: User does not return status HOT 3
- Bug: Users.all() does not return all users HOT 4
- When querying resources, why is there a default_includes HOT 2
- Leaks API key on exception HOT 2
- Filter by application subject HOT 2
- BytesIO is not JSON serializable HOT 4
- ResourceNotFoundError: Requested resource doesn't exist HOT 2
- Get Request - ResourceNotFoundError: Requested resource doesn't exist HOT 2
- filter error HOT 2
- ???????? for Russian text HOT 6
- adding custom fields to project HOT 2
- Get member users from project_membership HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-redmine.