gaqzi / py-gocd Goto Github PK
View Code? Open in Web Editor NEWA Python API for interacting with Go Continuous Delivery
License: MIT License
A Python API for interacting with Go Continuous Delivery
License: MIT License
Related API calls:
http://api.go.cd/current/#get-artifact-file
The API call itself is rather simple, however I don't know the best place in py-gocd to add this feature.
If you call pipeline.pause()
, but the request fails because your current user is not authorized for such request, the current behavior is to return a a request object that contains the error response.
Wouldn't it make more sense to raise an Exception in this case?
Please provide a new CI since snap-ci is no more. Or publish the snap-ci configuration so one can work on a PR for a travis CI setup.
i have a script using gocd python module to connect to goserver and get pipeline status, it was working fine on GOCD 16.x but when i upgraded to 18.3 it always throwing 401 with correct credentials. can you help me on this.
from gocd import Server
server_connection = Server("http://localhost:8153", user = "abc", password = "Enp1")
a = server_connection.pipeline("Test1")
b = a.history()
print b.status_code
Support for package API:
https://api.gocd.org/current/#packages
I am using server.post to create a new pipeline bit i am getting error HTTP Error 422: Unprocessable Entity
any help on this
Thanks in advance
Was followoning example stapes pipeline.history returns an Exception
python3.6
gocd version 17.3.0
> from gocd import Server
>
> server = Server('https://gocd.XXX.com', user='XXX', password='XXX')
> pipeline = server.pipeline('test-pipe')
>
> response = pipeline.history()
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/natalieserebryakova/gitVevo/pipeline_convertor_v1/convertor.py", line 6, in <module>
response = pipeline.history()
File "/Users/natalieserebryakova/.virtualenvs/pipe/lib/python3.6/site-packages/gocd/api/pipeline.py", line 42, in history
return self._get('/history/{offset:d}'.format(offset=offset or 0))
File "/Users/natalieserebryakova/.virtualenvs/pipe/lib/python3.6/site-packages/gocd/api/endpoint.py", line 51, in _get
return self._request(path, ok_status=ok_status, headers=headers)
File "/Users/natalieserebryakova/.virtualenvs/pipe/lib/python3.6/site-packages/gocd/api/endpoint.py", line 64, in _request
method=method,
File "/Users/natalieserebryakova/.virtualenvs/pipe/lib/python3.6/site-packages/gocd/server.py", line 155, in request
response = urlopen(self._request(path, data=data, headers=headers, method=method))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>
I am getting this exception, as though the headers are not being retrieved from the api. Another issue has been raise that speaks to 401 errors. The reason is that bool(response) is always False.
File "gocdAdmin.py", line 58, in
pipeGroups = getPipelines()
File "gocdAdmin.py", line 17, in getPipelines
data = gocdMan.pipelineGroups()
File "./lib/gocdManage.py", line 39, in pipelineGroups
return response.is_ok, response.body
File "/Library/Python/2.7/site-packages/gocd/api/response.py", line 97, in payload
if self.is_json:
File "/Library/Python/2.7/site-packages/gocd/api/response.py", line 67, in is_json
return (self.content_type.startswith('application/json') or
AttributeError: 'bool' object has no attribute 'startswith'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.