Code Monkey home page Code Monkey logo

party's Introduction

PARTY

Python client for the Artifactory API

Usage

Key Points

  • Configuration is pre-loaded from party_config.py, but can be overridden at runtime
  • A new class must first be instantiated
  • Any properties returned from using a "find" or "get" method are assigned to the class instance
  • Properties are NOT appended. To add multiple properties to a class, get them all in one call.

Some example code:

import party

artifact = party.Party()

artifact.artifactory_url = "http://myserver.com/api"  # <= Runtime config change

Additionally, passing a config parameter to Party() will work

PARTY_CONFIG = {
    'artifactory_url': 'https://myserver.com/api',
    'username': 'api',
    'password': 'password',
}

artifact = party.Party(config=PARTY_CONFIG)

Find Artifact by Name

myFile = "my-file.rpm"
result = artifact.find(myFile)

Find Artifact By Properties

file_props = {
    "build.number": 999,
    "rpm.version": "1.0.0.999"
}
result = artifact.find_by_properties(file_props)

Find Artifact by Pattern

result = artifact.find_by_pattern("erlang*R15B*.rpm")

Get Specific Artifact Properties

specific_properties = [ "build.number", "rpm.version" ]
result = artifact.get_properties(artifact, specific_properties)

Set Properties on an Artifact

new_properties = {
    "myKey": "myValue"
}
result = artifact.set_properties(artifact, new_properties)

CONFIGURING PARTY

Party class instances load in the values from party_config.py. However, those values can be overridden directly in the file, or at runtime using:

artifact = party.Party()
artifact.CONFIG_KEY = "new value"

The following is a list of config keys (CONFIG_KEY above) and descriptions of their purposes:

artifactory_url - Base URL to your Artifactory instance.
    search_prop - Artifactory API endpoint used for the property search.
    search_name - Artifactory API endpoint to access quick search.
   search_repos - Artifactory API endpoint to search for repositories.
       username - Username credential to use to connect to the Artifactory instance.
       password - Base64 encoded password credential used to connect to the Artifactory instance.
        headers - JSON (Python dict) of headers to send in the Artifactory queries.

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.