示例#1
0
文件: main.py 项目: conrado/atmt
    client_id = raw_input("Please type enter your Client ID: ")
client_secret = config.get('ApplicationTokens', 'client_secret')
if client_secret in ["None", None]:
    client_secret = raw_input("Please type enter your Client Secret: ")

print "We require an Assembla account info to download documents"
username = raw_input("Please enter your Assembla.com username: "******"and password: "******"Please enter the name of the space to copy tickets from: ")
space2 = raw_input("Please enter the name of the space to copy tickets to: ")

tickets = raw_input("Please enter full path to ticket list: ")

api = API(client_id, client_secret)

refresh_token = config.get('ClientTokens', 'refresh_token')
bearer_token = config.get('ClientTokens', 'bearer_token')
if bearer_token != "None":
    try:
        api.initTokens(bearer_token, refresh_token)
        api.me()
    except AssemblaError:
        api = init_client(api)
        bearer_token = api.client.access_token
        refresh_token = api.client.refresh_token
else:
    api = init_client(api)
    bearer_token = api.client.service.access_token
示例#2
0
import os
from datetime import datetime

from assembla.api import API


api = API(
    key=os.getenv('ASSEMBLA_KEY'),
    secret=os.getenv('ASSEMBLA_SECRET')
)

aulasdovaca = api.spaces()[0]

space_tools = api.space_tools(space_id=aulasdovaca.id)

for tool in space_tools:
    if tool.type == 'GitTool':
        space_tool = tool
        break

merge_requests = api.merge_requests(space_id=aulasdovaca.id, space_tool_id=tool.id)

branch_names = []

for merge in merge_requests:
    delta = datetime.now() - merge.updated_at
    if delta.total_seconds() / 60 / 60 >= 6:
        branch_names.append(merge.source_symbol)

print(', '.join(branch_names))
示例#3
0
#!/usr/bin/env python
# coding: utf-8

import os
from datetime import datetime

from assembla.api import API


api = API(
    key=os.getenv('ASSEMBLA_KEY'),
    secret=os.getenv('ASSEMBLA_SECRET')
)

aulasdovaca = api.spaces()[0]

api.space = aulasdovaca

milestones = api.milestones(space_id=aulasdovaca.id)

milestone = None
for ms in milestones:
    if ms.planner_type == 2:
        milestone = ms
        break

if milestone is None:
    raise TypeError('There is no default milestone!')

# burndown {
tickets = api.tickets(