Comments (5)
I wasn't able to reproduce your issue, so i wasn't able to understand your problem.
For testing purpose I usually use this demo server.
My last test on that was:
from rtkit.resource import RTResource
from rtkit.authenticators import CookieAuthenticator
from rtkit.errors import RTResourceError
from rtkit import set_logging
import logging
set_logging('debug')
logger = logging.getLogger('rtkit')
url = 'http://rt.easter-eggs.org/demos/stable/REST/1.0/'
resource = RTResource(url, 'john.foo', 'john.foo', CookieAuthenticator)
try:
params = {
'content' :{
'Action' : 'comment',
'Text' : 'Comment with attach',
'Attachment' : 'x.txt, 100x100.gif',
},
'attachment_1' : file('x.txt'),
'attachment_2' : file('100x100.gif'),
}
response = resource.post(path='ticket/270/comment', payload=params,)
for r in response.parsed:
for t in r:
logger.info(t)
except RTResourceError as e:
logger.error(e.response.status_int)
logger.error(e.response.status)
logger.error(e.response.parsed)
with this result:
[DEBUG] POST ticket/270/comment
[DEBUG] {'Content-Length': '838', 'Content-Type': 'multipart/form-data; boundary=xXXxXXyYYzzz', 'Accept': 'text/plain'}
[DEBUG] '--xXXxXXyYYzzz\r\nContent-Disposition: form-data; name="content"\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Length: 72\r\n\r\nAction: comment\nText: Comment with attach\nAttachment: x.txt, 100x100.gif\r\n--xXXxXXyYYzzz\r\nContent-Disposition: form-data; name="attachment_2"; filename="100x100.gif"\r\nContent-Type: image/gif\r\nContent-Length: 336\r\n\r\nGIF87ad\x00d\x00\xe3\x00\x00\xcc\xcc\xcc\x96\x96\x96\xb1\xb1\xb1\xa3\xa3\xa3\xc5\xc5\xc5\xbe\xbe\xbe\xb7\xb7\xb7\x9c\x9c\x9c\xaa\xaa\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,\x00\x00\x00\x00d\x00d\x00\x00\x04\xfe\x10\xc8I\xab\xbd8\xeb\xcd\xbb\xff`(\x8edi\x9eh\xaa\xael\xeb\xbep,\xcftm\xdfx\xae\xef|\xef\xff\xc0\xa0pH,\x1a\x8f\xc8\xa4r\xc9l:\x9f\xd0\xa8tJ\xadZ\xaf\xd8\xacv\xcb\xedz\xbf\xe0\xb0xL.\x9b\xcf\xe8\xb4z\xcdn\xbb\xdfp\xab 0)\x1c\x0e\x04\x89\x1d\xdf\x99\xd7\xefy\x00{\x81F\x03\x03t\x12\x07\x02\x08\x08\x89\x8b\x8d\x1b\x86\x88\x00\x8a\x8c\x8e\x96G\x04\x05\x88\x04\x01\x04\x06\x07\x00\x9d\x9f\xa1\x13\x01\x9e\xa7\x13\x9a\x9c\x9e\xa0\xa2\xad\xa5G\x9bzt\xb3\xb6\x93\xa2\x07\x03|u\x88\xb7\x82\xb5\xb8E\xb3\xc0\xc5\xbf\x14\x06\x01\x06\x15\xc4\xbf\xc7\xb2\xac\x9a\xa1\xa3v\x15\x08\x01\x90\xbd\x12\xd4\xd3\x9e\xd5H\xc9\x81\x95\x90\xe3\x14\x9d\xe1\xc8\x9e\x97\xe4\x8fI\xa7\xbe\x80z\xf1\xa6\x03\x00\x87\x14\xef\xf2\xbc\x83q\xfd\xfe\xff\x00\x03\n\x1cH\xb0\xa0\xc1\x83\x08\x13*\\\xc8\xb0\xa1\xc3\x87\x10#J\x9cH\xb1\xa2\xc5\x8b\x183j\xdc\xc8\xb1\xa3\xc7\x8f\x06 C\x8a\xbc\x10\x01\x00;\r\n--xXXxXXyYYzzz\r\nContent-Disposition: form-data; name="attachment_1"; filename="x.txt"\r\nContent-Type: text/plain\r\nContent-Length: 4\r\n\r\nbye\n\r\n--xXXxXXyYYzzz--\r\n'
[INFO] POST
[INFO] http://rt.easter-eggs.org/demos/stable/REST/1.0/ticket/270/comment
[DEBUG] HTTP_STATUS: 200 OK
[DEBUG] 'RT/4.0.5-116-g591e06a 200 Ok\n\n# Message recorded\n\n'
[DEBUG] RESOURCE_STATUS: 200 Ok
[INFO] [[]]
You could see the real result here
Be quick because they reset the db everyday
from python-rtkit.
Yeah, I was able to see the result. I will test using that gif and see if it still works. The file I am trying to attach is a gzipped binary grammar for Nuance.
from python-rtkit.
Any news?
from python-rtkit.
No, sorry. Other things have consumed my time at work recently. I will try to test sometime in the next couple days. Thanks for the reminder.
from python-rtkit.
Couldn't the binary file be mangled because it was being url_quoted? I recently had some trouble while sending a XML as an attachment (It was being escaped, so it ended up attaching a invalid XML to the ticket).
from python-rtkit.
Related Issues (20)
- trouble authenticating to RT server HOT 1
- Getting ValueError: need more than 1 value to unpack HOT 30
- Don't forget to tag your project HOT 1
- post payload truncated if it contains a semicolon
- urlencoded text in comment body HOT 2
- post payload truncated if it contains an and symbol HOT 4
- create ticket having RESOURCE_STATUS: 401 Credentials required HOT 18
- Unable to create new ticket HOT 5
- Provide a list for a custom field
- How can I see the tickets Assigned to my Group? HOT 6
- query doesn't support LIKE
- feature request (mixed auth) HOT 1
- Bypass SSL checking HOT 2
- ValueError: not enough values to unpack (expected 2, got 1)
- Vertical tabs in field values
- multipart/form-data HOT 3
- Edit API does not save custom fields with comma
- search all resolved tickets
- Comment API with attachment
- Plans for supporting REST API 2.0?
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-rtkit.