Closed allmywatts closed 6 years ago
Hi, I used the latest youtrack documentation as reference and the current implementation felt more natural to me. I also can't test your suggestion at the moment, but I will take a look tomorrow morning.
Hi Alex,
I updated update_issue
as you requested. PUT
method is unfortunately not allowed.
send: b'PUT /rest/issue/BOT-102 HTTP/1.1\r\nHost: youtrack.****.com\r\ncontent-type: application/x-www-form-urlencoded\r\naccept-encoding: gzip, deflate\r\nuser-agent: Python-httplib2/0.10.3 (gzip)\r\ncontent-length: 47\r\ncookie: YTJSESSIONID=****;Path=/;Secure;HttpOnly, jetbrains.charisma.main.security.PRINCIPAL=****;Path=/;Expires=Sat, 12-Jan-2019 13:36:45 GMT\r\ncache-control: no-cache\r\n\r\n'
send: b'description=Describe+something&summary=PyTest+3'
reply: 'HTTP/1.1 405 Method Not Allowed\r\n'
Traceback (most recent call last):
File "C:/Projects/venv/tupt/yt_test.py", line 26, in <module>
update_2("BOT-102", "PyTest 3", "Describe earth man")
File "C:/Projects/venv/tupt/yt_test.py", line 17, in update_2
header: Server header: Date header: Content-Type header: Content-Length header: X-XSS-Protection header: X-Frame-Options header: X-Content-Type-Options header: Referrer-Policy header: Cache-Control header: Access-Control-Expose-Headers response, content = conn.update_issue_2(issue_id, summary=summary, description=desc)
File "C:\Projects\venv\tupt\venv\lib\site-packages\youtrack\connection.py", line 180, in update_issue_2
content_type='application/x-www-form-urlencoded')
File "C:\Projects\venv\tupt\venv\lib\site-packages\youtrack\connection.py", line 41, in wrapped
raise e
File "C:\Projects\venv\tupt\venv\lib\site-packages\youtrack\connection.py", line 38, in wrapped
return f(self, *args, **kwargs)
File "C:\Projects\venv\tupt\venv\lib\site-packages\youtrack\connection.py", line 102, in _req
raise youtrack.YouTrackException(url, response, content)
youtrack.youtrack.YouTrackException: Error for [/issue/BOT-102]: 405: Method Not Allowed: Method Not Allowed
POST
is successful:
send: b'POST /rest/issue/BOT-102 HTTP/1.1\r\nHost: youtrack.****.com\r\ncontent-type: application/x-www-form-urlencoded\r\ncookie: YTJSESSIONID=****;Path=/;Secure;HttpOnly, jetbrains.charisma.main.security.PRINCIPAL=****;Path=/;Expires=Sat, 12-Jan-2019 13:38:16 GMT\r\ncache-control: no-cache\r\naccept-encoding: gzip, deflate\r\ncontent-length: 47\r\nuser-agent: Python-httplib2/0.10.3 (gzip)\r\n\r\n'
send: b'summary=PyTest+3&description=Describe+earth+man'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server header: Date header: Content-Type header: Transfer-Encoding header: X-XSS-Protection header: X-Frame-Options header: X-Content-Type-Options header: Referrer-Policy header: Cache-Control header: Access-Control-Expose-Headers Response: {'content-type': 'text/plain;charset=utf-8', 'date': 'Fri, 12 Jan 2018 13:38:16 GMT', 'referrer-policy': 'origin-when-cross-origin', 'transfer-encoding': 'chunked', 'cache-control': 'no-cache, no-store, no-transform, must-revalidate', 'server': 'nginx/1.12.2', 'x-frame-options': 'SAMEORIGIN', 'status': '200', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'access-control-expose-headers': 'Location'}
Content: b''
Let it be POST then :)
I'll accept this PR if others don't mind ;)
I am not sure if this method was missed or left out on purpose.