Skip to main content

wrapper over kavahq.com API

Project description

Installation

pip install kavahq-api

Usage

import kavahq
import keyring
import getpass

SERVICE = 'kavahq-api'
username = 'imposeren'
password = keyring.get_password(SERVICE, username)
if password is None:
    password = getpass.getpass()
    keyring.set_password(SERVICE, username, password)

api = kavahq.KavaApi(username=username, password=password, company_name='42 Coffee Cups')

# almost all attributes of Api return instances of ApiObject which do not query results until they are required:
projects_api = api.projects  # no requests made
first_project_api = projects_api.children[0]  # project list api called but project details are not
first_project_estimate_api = first_project_api.estimate  # zero apis called
first_project_api.estimate['avg_time_per_cp']  # estimates api called and result is returned

# you can also get all results of api as a dict:
dict(first_project_api)

# you can also get specific project api by it's slug:
kava_project_api = api.projects.get('kavyarnya')
dict(kava_project_api)
# {u'days_num_bugs_showing': X, ...}

dict(kava_project_api.estimate)
# {u'avg_time_per_cp': u'2.1'...}
kava_project_api.properties['owner']
# u'akhavr'

# as you can see api calls can be "chained":
api.projects.estimate  # ApiObject for /api/project/estimate
api.projects.properties  # ApiObject for /api/project/properties

# but some attributes of ApiObject "break chaining":
api.projects.children[0].estimate.response  # returns dict with response from API
api.projects.get  # method to get projects by slug, (see examples above)
api.projects.keys()  # will return keys of response dict


# alternate way to call specific api:
dict(api.projects.estimate.get(project='kavyarnya', company='42 Coffee Cups'))
# this is equivivalent to:
api.company_name = '42 Coffee Cups')
dict(api.projects.get('kavyarnya').estimate)

Running tests

python setup.py nosetests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kavahq-api-0.2.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kavahq-api-0.2.1.linux-x86_64.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file kavahq-api-0.2.1.tar.gz.

File metadata

  • Download URL: kavahq-api-0.2.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for kavahq-api-0.2.1.tar.gz
Algorithm Hash digest
SHA256 85dade54f090302f4619caec08680cf900d540b304785a0fcc6b199a5cfdba65
MD5 bd1ba0d8f16f260edd6e09e473e918e4
BLAKE2b-256 18e0945b291e1471aa74d1b0d7fb1692b52c9260e913df2547feaa09c24185a4

See more details on using hashes here.

File details

Details for the file kavahq-api-0.2.1.linux-x86_64.tar.gz.

File metadata

File hashes

Hashes for kavahq-api-0.2.1.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 6d59fc19c6466d7addd68d593cc2bcf6a9e15b58968c3bc1ffb95cfc1d38c97c
MD5 37380af36227e43f313e28d65f4c555e
BLAKE2b-256 82583472be554d3cbc365d2dc650b0beaea87e735d9c5078f019885d98f54cec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page