Giter Club home page Giter Club logo

pytravisci's Introduction

PyTravisCI - Just another Python API for Travis CI (API)

https://travis-ci.com/funilrys/PyTravisCI.svg?branch=master https://coveralls.io/repos/github/funilrys/PyTravisCI/badge.svg?branch=master
https://img.shields.io/badge/code%20style-black-000000.png https://img.shields.io/github/license/funilrys/PyTravisCI.png https://img.shields.io/pypi/v/PyTravisCI.png https://img.shields.io/github/issues/funilrys/PyTravisCI.png
https://pepy.tech/badge/PyTravisCI/week https://pepy.tech/badge/PyTravisCI/month https://pepy.tech/badge/PyTravisCI

Just another Python API for Travis CI (API). It has been meant to fit my needs but in hope that it will be useful to others.

In other words, PyTravisCI gives us a Python interface to interact with the the Travis API v3 or the Travis CI Infrastructure.

It can interact with repositories, jobs, build and almost everything the Travis CI API v3 has to offer.

It can also helps you with the encryption of information and files. Give the interface a variable name and its value and it will gives you what you are supposed to write into your .travis.yml configuration file. Same with the encryption of files and the linting of your configuration files.

Please keep in mind that:

  • this project was meant to be used as "an imported module" than something else.

  • this project has nothing to do with the ruby version of the Travis client and will never have similarities with it

    (except if someone develop a client on top this).

Hava a question ? Fill a new issue!

Have an issue ? Report it!

Have an improvement idea ? Submit a PR!

Every improvement and constructive discussions are welcome!

Documentation as the place to be!

Want to know more about PyTravisCI? We invite you to read the documentation.

Want a local copy? We get you covered!

Simply run the following and enjoy our documentation!

$ cd docs/
$ make html
$ chromium build/html/index.html # Chromium or whatever browser you use.

Why is there a lack of tests?

Well, I don't know what you may call "lack" but I wrote (105!) tests for what I think is important.

It was not my priority to write the tests for each resource types or communicators. But if you have time, your PR is welcome!

License

MIT License

Copyright (c) 2019, 2020, 2021, 2022 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

pytravisci's People

Contributors

funilrys avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pytravisci's Issues

A config dict passed to create_request seems to be sent incorrectly

Thank you for the amazing lib! I am facing an issue though,

If I send in this request:

repository.create_request(
        message="test env vars through API",
        branch="env-tests",
        config={"env": {"global": ["REGISTRY=PROD"]}},
    )

I get this response back:

"request": {
        "repository": {
            "id": xxxx,
            "owner_name": "xxxx",
            "name": "xxxx"
        },
        "user": {
            "id": xxxx
        },
        "id": xxxx,
        "message": "test env vars through API",
        "branch": "env-tests",
        "config": "env"

The "config": "env" seems to be truncated. It should be sent like this

"config": {
      "env": {
        "global": [
          "REGISTRY=PROD"
        ]
      }
    }

:( Any thoughts?

get_user function giving error

The get_user function is giving this error:

>>> me=travis.get_user()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/edth_23/.local/lib/python3.8/site-packages/PyTravisCI/travis_ci.py", line 414, in get_user
    return communicator.User(self.__requester).fetch(parameters=params)
  File "/home/edth_23/.local/lib/python3.8/site-packages/PyTravisCI/communicator/base.py", line 99, in wrapper
    response = func(self, **kwargs)  # pylint:disable=not-callable
  File "/home/edth_23/.local/lib/python3.8/site-packages/PyTravisCI/communicator/user.py", line 63, in fetch
    self.get_response(self.get_and_construct_endpoint(kwargs))
  File "/home/edth_23/.local/lib/python3.8/site-packages/PyTravisCI/communicator/base.py", line 233, in get_response
    return self.requester.get(endpoint)
  File "/home/edth_23/.local/lib/python3.8/site-packages/PyTravisCI/requester.py", line 87, in wrapper
    response = req.json()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

How to retrieve builds for a specific repository

I tried this: ๐Ÿ˜ง

        params = {'limit': '3',
                  'repository.slug': 'hasii2011/albow-python-3'
                  }

        builds: Builds = travisCI.get_builds(params=params)

but does not work; Just gives me three builds from hasii/PyUt.

presumably the three highest numbered builds ๐Ÿ˜ฉ

10:38:02.483 INFO TravisCmd: build.number='776' build.id=207515538 build.repository.name='PyUt'
10:38:02.484 INFO TravisCmd: build.number='775' build.id=207381577 build.repository.name='PyUt'
10:38:02.484 INFO TravisCmd: build.number='774' build.id=207360982 build.repository.name='PyUt'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.