def __init__(self, account_read_token=os.environ.get('ROLLBAR_READ_TOKEN'), account_write_token=os.environ.get('ROLLBAR_WRITE_TOKEN')):
   APIGateway.__init__(self)
   self._host_url = 'https://api.rollbar.com/api/1'
   self._api = {
     'get_project': {
       'path': '/project/{id}',
       'method': 'GET',
       'params': {
         'access_token': account_read_token
       }
     },
     'get_project_access_tokens': {
       'path': '/project/{id}/access_tokens',
       'method': 'GET',
       'params': {
         'access_token': account_read_token
       }
     },
     'list_projects': {
       'path': '/projects',
       'method': 'GET',
       'params': {
         'access_token': account_read_token
       }
     }
   }
   self._common_params = {}
   self._common_headers = {}
Esempio n. 2
0
 def __init__(self, token=os.environ['CIRCLE_TOKEN']):
   APIGateway.__init__(self)
   self._username, self._project = Helper.owner_and_repo()
   self._host_url = 'https://circleci.com/api/v1'
   self._api = {
     'recent_branch_builds': {
       'path': '/project/{username}/{project}/tree/{branch}',
       'method': 'GET',
       'valid_status': [200]
     },
     'cancel_build': {
       'path': '/project/{username}/{project}/{build_num}/cancel',
       'method': 'POST'
     },
     'new_build': {
       'path': '/project/{username}/{project}/tree/{branch}',
       'method': 'POST'
     }
   }
   self._common_headers = {
     'Accept': 'application/json'
   }
   self._common_params = {
     'circle-token': token
   }
 def __init__(self, data_filepath=None, auth_info=None, tokens_updater=None):
   APIGateway.__init__(self)
   self._common_params = {}
   self._common_headers = {}
   self._oauth2_gateway = None
   self._protocol_status.append(401)
   self._httpd = None
   self._serverthread = None
   self._data_filepath = data_filepath
   self._auth_info = None
   self._tokens_updater = tokens_updater
   if auth_info is not None:
    self._set_auth_info(auth_info)
 def __init__(self, oauth2_url):
   APIGateway.__init__(self)
   self._host_url = oauth2_url
   self._common_params = {}
   self._common_headers = {}
   self._api = {
     'refresh_token': {
       'path': '',
       'method': 'POST',
       'params': {
         'grant_type': 'refresh_token'
       }
     },
     'get_token': {
       'path': '',
       'method': 'POST',
       'params': {
         'grant_type': 'authorization_code'
       },
       'valid_status': [200]
     }
   }
 def __init__(self, project_name, account_read_token=os.environ.get('ROLLBAR_READ_TOKEN'), account_write_token=os.environ.get('ROLLBAR_WRITE_TOKEN')):
   APIGateway.__init__(self)
   self._access_tokens = PyAccountRollbarAPI(account_read_token=account_read_token, account_write_token=account_write_token).get_project_access_tokens(project_name)
   self._host_url = 'https://api.rollbar.com/api/1'
   self._api = {
     'item_by_counter': {
       'path': '/item_by_counter/{counter}',
       'method': 'GET',
       'params': {
         'access_token': self._access_tokens['read']
       }
     },
     'get_item': {
       'path': '/item/{id}',
       'method': 'GET',
       'params': {
         'access_token': self._access_tokens['read']
       }
     },
     'patch_item': {
       'path': '/item/{id}',
       'method': 'PATCH',
       'params': {
         'access_token': self._access_tokens['write']
       }
     },
     'report_deploy': {
       'path': '/deploy/',
       'method': 'POST',
       'params': {
         'access_token': self._access_tokens['write'],
       }
     }
   }
   self._common_params = {}
   self._common_headers = {}
 def __init__(self, owner, repo, token=os.environ.get('GITHUB_TOKEN')):
   APIGateway.__init__(self)
   self._owner = owner
   self._repo = repo
   self._cache = {}
   self._host_url = 'https://api.github.com'
   self._api = {
     'list_issues': {
       'path': '/orgs/{org}/issues',
       'method': 'GET'
     },
     'list_issue': {
       'path': '/repos/{owner}/{repo}/issues/{number}',
       'method': 'GET',
       'valid_status': [200, 404]
     },
     'list_labels': {
       'path': '/repos/{owner}/{repo}/labels',
       'method': 'GET',
       'valid_status': [200, 404]
     },
     'list_label': {
       'path': '/repos/{owner}/{repo}/label/{name}',
       'method': 'GET',
       'valid_status': [200, 404]
     },
     'add_labels_to_issue': {
       'path': '/repos/{owner}/{repo}/issues/{number}/labels',
       'method': 'POST',
       'valid_status': [200, 404]
     },
     'remove_label_from_issue': {
       'path': '/repos/{owner}/{repo}/issues/{number}/labels/{name}',
       'method': 'DELETE',
       'valid_status': [200, 404]
     },
     'remove_all_labels_from_issue': {
       'path': '/repos/{owner}/{repo}/issues/{number}/labels',
       'method': 'DELETE',
       'valid_status': [204, 404]
     },
     'user': {
       'path': '/user',
       'method': 'GET',
       'valid_status': [200]
     },
     'list_collaborators': {
       'path': '/repos/{owner}/{repo}/collaborators',
       'method': 'GET',
       'valid_status': [200]
     },
     'create_issue': {
       'path': '/repos/{owner}/{repo}/issues',
       'method': 'POST'
     },
     'create_pr': {
       'path': '/repos/{owner}/{repo}/pulls',
       'method': 'POST',
       'valid_status': [201]
     },
     'list_pr': {
       'path': '/repos/{owner}/{repo}/pulls',
       'method': 'GET',
       'valid_status': [200]
     },
     'list_pr_review_comments': {
       'path': '/repos/{owner}/{repo}/pulls/{number}/comments',
       'method': 'GET',
       'valid_status': [200]
     },
     'list_issue_comments': {
       'path': '/repos/{owner}/{repo}/issues/{number}/comments',
       'method': 'GET',
       'valid_status': [200]
     },
     'list_issue_labels': {
       'path': '/repos/{owner}/{repo}/issues/{number}/labels',
       'method': 'GET',
       'valid_status': [200, 404]
     },
     'list_pr_commits': {
       'path': '/repos/{owner}/{repo}/pulls/{number}/commits',
       'method': 'GET',
       'valid_status': [200]
     },
     'merge_pr': {
       'path': '/repos/{owner}/{repo}/pulls/{number}/merge',
       'method': 'PUT',
       'valid_status': [200]
     }
   }
   self._common_headers = {
     'Authorization': 'token {0}'.format(token)
   }
   self._common_params = {}