Skip to main content

JIRA Data Wrapper for Easy WebHook Handling

Project description

# JIRAPy
Python Library for reading JIRA Data from JSON API

### What Does it Do
When building apps that integrate with JIRA using its API, its often repetitive to parse and read out data from the objects you're sent. JIRAPy handles the parsing and storing of data so that you can access it with easy to use handlers like `jiraticket.summary` or `jiraticket.tags`, and since it uses native Python data formats and objects, filtering through data is as simple as `for tag in jiraticket.tags`.

It also includes a few convenience functions to make basic operations in Python more friendly, including the `add_comment()` function which when provided with a valid User/Pass combination can post comments to the remote JIRA instance for that ticket. If you need to comment on a JIRA with Self-Signed SSL, see the section 'My JIRA Uses Self-Signed Certificates'

JIRAPy works with data you already have, either from the APIs or from a WebHook. If you want a complete integration with a running JIRA instance that can pull down data for you, I highly recommend the [PyContribs](https://github.com/pycontribs) Package '[Jira](https://github.com/pycontribs/jira)' which provides a fantastic, complete, drop in solution.

### Why
I was writing bots to automatically perform actions when a ticket was raised to our board and found that I was recreating the same functions every time I created a new bot. This keeps all the helpers in an easy to import class.

### How Do I Install It
For now, you need to clone this Git repo and copy it into your project, but soon you'll be able to run `pip install jirapy` to get it anywhere.

### How Do I Use It
Import the class(es) you require from the module:

`from jirapy import JiraTicket`

then create a JIRA object from data returned from the API:

```
ticketdata = get_ticket("https://neko-design.jira.com/api/rest/2/issue/jirapy-1")
jiraticket = JiraTicket(ticketdata)
```

and now you can read back values from the data:

```
print jiraticket.summary
> Ticket Summary
print jiraticket.reporter
> E. Neko
jiraticket.add_comment("Updated System, Please Check", "username", "password")
> 200
```

### My JIRA Uses Self-Signed Certificates
I've included the option to turn off SSL Verification for the comments feature. When you create the JiraTicket object, set the optional `verifyssl` parameter to `False`:

```
ticketdata = get_ticket("https://neko-design.jira.com/api/rest/2/issue/jirapy-1")
jiraticket = JiraTicket(ticketdata, False)
# Or with a Named Parameter
jiraticket = JiraTicket(ticketdata, verifyssl=False)
```

### Testing
To run the tests, launch `tests/ticketTest.py` and it will run though the expected values, producing a report similar to the below:

```
bash-3.2$ python ticketTest.py
WARNING:root:Ticket Has no Labels
WARNING:root:Ticket Has no Components
[INFO] Starting JIRAPy Tests
[INFO] ---------------------------------------------
[INFO] TEST Ticket Summary SUCCESS
[INFO] TEST Ticket Description SUCCESS
[INFO] TEST Ticket Key SUCCESS
[INFO] TEST Ticket URL SUCCESS
[INFO] TEST Ticket Reporter SUCCESS
[INFO] TEST Ticket Status SUCCESS
[INFO] TEST Ticket Labels SUCCESS
[INFO] TEST Ticket Labels (Empty) SUCCESS
[INFO] TEST Ticket Components SUCCESS
[INFO] TEST Ticket Components (Empty) SUCCESS
[INFO] ---------------------------------------------
[INFO] 0 Tests Failed. 10 Passed.
[INFO] TESTS PASSED. All Tests Passed
```

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

jirapy-0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

jirapy-0.1-py2.py3-none-any.whl (7.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jirapy-0.1.tar.gz.

File metadata

  • Download URL: jirapy-0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jirapy-0.1.tar.gz
Algorithm Hash digest
SHA256 864c6f9821b9749a26bb98b5981dbef103e199341ab2c8c31fcdb2af31ed19f7
MD5 3c2ad6ca14af8ed2327df8913377fbdd
BLAKE2b-256 0b41e6d8d2ad39fa7d9d69afc02d8203dff8b5b0576469251ce260c9aad601af

See more details on using hashes here.

File details

Details for the file jirapy-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for jirapy-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 de484a94df60b3880712309ca2c9e0fb352c5cf07cbe77ed035101bac4942683
MD5 02ed391ea6351558ced11c14bfc48cf8
BLAKE2b-256 c4396c86dd8bf5461901353de0db85c77dbe3dd9464e5c10d922909733cabbf0

See more details on using hashes here.

Supported by

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