Hi
I am trying to add repositories using the REST API and Python:
rbpath = 'http://reviewboard.rtx.loc/api/repositories/'
scmmgrpath = 'https://repo.rtx.net/hg/'
rbrepo = {
'name' : str(repo),
'tool ': 'Mercurial',
'path' : scmmgrpath + str(repo),
}
r = requests.post(rbpath, files=rbrepo, auth=HTTPBasicAuth('admin',
'xxxx'))
Resulting HTTP requests and response:
POST /api/repositories/ HTTP/1.1
Host: reviewboard.rtx.loc
User-Agent: python-requests/2.18.1
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 540
Content-Type: multipart/form-data; boundary=29fd7488bc224bffa7f6f10a2d224478
Authorization: Basic YWRtaW46cmI5MzAz
--29fd7488bc224bffa7f6f10a2d224478
Content-Disposition: form-data; name="name"; filename="name"
Components/rptest/Comp1
--29fd7488bc224bffa7f6f10a2d224478
Content-Disposition: form-data; name="tool "; filename="tool "
Mercurial
--29fd7488bc224bffa7f6f10a2d224478
Content-Disposition: form-data; name="path"; filename="path"
--29fd7488bc224bffa7f6f10a2d224478--
HTTP/1.1 400 BAD REQUEST
Date: Thu, 06 Jul 2017 11:51:50 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 198
Content-Language: en
X-Content-Type-Options: nosniff
Expires: Thu, 06 Jul 2017 11:51:50 GMT
Vary: Accept,Cookie,Accept-Language
Last-Modified: Thu, 06 Jul 2017 11:51:50 GMT
Cache-Control: max-age=0
X-Frame-Options: SAMEORIGIN
Set-Cookie: rbsessionid=0260ffin91cnxo5yq5kweiiyfji3r34g; expires=Fri,
06-Jul-2018 11:51:50 GMT; httponly; Max-Age=31536000; Path=/
Connection: close
Content-Type: text/plain
{"fields": {"path": ["This field is required"], "tool": ["This field is
required"], "name": ["This field is required"]}, "stat": "fail", "err":
{"msg": "One or more fields had errors", "code": 105}}
Any idea why this is failing?
I think the encoding looks quite much like rbt's requests (biggest
difference is the "filename=.." part, not quite sure how to get rid of that
using requests libarary).
Or are there simpler ways to remotely configure repos?
Thanks,
Morten
--
Supercharge your Review Board with Power Pack:
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons:
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.