Ejemplo n.º 1
0
def jiraAPIGet(key):
    try:
        url = 'http://localhost:8081/rest/api/2/issue/' + key

        resp = requests.get(url,
                            auth=HTTPBasicAuth('wulf', 'ajtmf3376'),
                            headers=headers)

        if resp.status_code >= 200:
            if resp.status_code < 300:
                #print('status : ' + str(resp.status_code))
                try:
                    json_data = json.loads(resp.text)
                    print(json.dumps(json_data, sort_keys=True, indent=4))
                    return (json_data)
                except:
                    logger.debug('Request of jiraAPIGet')
            else:
                webhook(
                    "Jira Api Error : " + str(resp.status_code) + resp.text,
                    None, None)
                logger.error(resp.text)
    except Exception as e:
        webhook(
            "Jira Api Error : " + str(e) + str(resp.status_code) + " " +
            resp.text, None, None)
        logger.error('Error! Code: {c}, Message, {m}'.format(
            c=type(e).__name__, m=str(e)))
        pass
Ejemplo n.º 2
0
def jiraApiPost():  #지라 이슈 생성 요청
    try:
        url = 'http://localhost:8081/rest/api/2/issue'

        # post_dic['fields']['summary'] = "test from python"
        # post_dic['fields']['assignee'] = {'name' : assignee}
        # post_dic['fields']['reporter'] = {'name' : assignee}
        # post_dic['fields']['description'] = cont

        data = json.dumps(post_dic)

        resp = requests.post(url,
                             auth=HTTPBasicAuth('wulf', 'ajtmf3376'),
                             headers=headers,
                             data=data)  #한글빼고 잘댐

        if resp.status_code >= 200:
            if resp.status_code < 300:
                logger.debug('status : ' + str(resp.status_code))
                try:
                    json_data = json.loads(resp.text)
                    print(json.dumps(json_data, sort_keys=True, indent=4))
                    return (json_data['key'])
                except:
                    logger.debug('Request of jiraApiPost')
            else:
                webhook(
                    "Jira Api Error : " + str(resp.status_code) + resp.text,
                    None, None)
                logger.error(resp.text)
    except Exception as e:
        webhook(
            "Jira Api Error : " + str(e) + str(resp.status_code) + " " +
            resp.text, None, None)
        logger.error('Error! Code: {c}, Message, {m}'.format(
            c=type(e).__name__, m=str(e)))
        pass
Ejemplo n.º 3
0
from webhooks import webhook
import logging

logger = logging.getLogger('automatorLogger') 


headers = {'content-type':'application/x-www-form-urlencoded','Accept':'application/json, text/javascript, */*; q=0.01',
'Referer':'https://recommend.wisereport.co.kr/v1/Home/RecommendSummary/naver','Sec-Fetch-Mode':'cors','User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.71 Safari/537.36',
'X-Requested-With':'XMLHttpRequest'}

url = 'https://recommend.wisereport.co.kr/v1/Home/TopRecommend'
data = 'proc=3&dt=20190829'

resp = requests.post(url,headers=headers, data=data) #한글빼고 잘댐

dumpData = dump.dump_all(resp)
print(dumpData.decode('utf-8'))

if resp.status_code >= 200:
    if resp.status_code < 300:
        logger.debug('status : ' + str(resp.status_code))
        try:
            json_data = json.loads(resp.text)
            print(json.dumps(json_data,sort_keys = True, indent = 4))
            webhook(json_data,None,None)
            # return(json_data['key'])
        except:
            logger.debug('Request of jiraApiPost')
    else:
        logger.error(resp.text)
Ejemplo n.º 4
0
    'X-Requested-With': 'XMLHttpRequest'
}

url = 'https://recommend.wisereport.co.kr/v1/Home/TopRecommend'
data = 'proc=3&dt=20190903'

resp = requests.post(url, headers=headers, data=data)  #한글빼고 잘댐

dumpData = dump.dump_all(resp)  # 없어도 됨 그치만 디버깅용으로 써놓음
print(dumpData.decode('utf-8'))

texts = ''

if resp.status_code >= 200:
    if resp.status_code < 300:
        logger.debug('status : ' + str(resp.status_code))
        try:
            json_data = json.loads(resp.text)
            for data in json_data:
                texts += "|" + data['INV_NM'] + "|" + data[
                    "CMP_CD"] + "|" + data["CMP_NM_KOR"] + "|" + data[
                        "REASON_IN"] + "|\n"
            #print(json.dumps(json_data,sort_keys = True, indent = 4))
            jiraApiPost(texts)
            webhook(texts, None, None)
            # return(json_data['key'])
        except:
            logger.debug('Request error')
    else:
        logger.error(resp.text)
Ejemplo n.º 5
0
    'Referer':
    'https://recommend.wisereport.co.kr/v1/Home/RecommendSummary/naver',
    'Sec-Fetch-Mode': 'cors',
    'User-Agent':
    'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.71 Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest'
}

url = 'https://recommend.wisereport.co.kr/v1/Home/TopRecommend'
data = 'proc=3&dt=20190829'

resp = requests.post(url, headers=headers, data=data)  #한글빼고 잘댐

dumpData = dump.dump_all(resp)
print(dumpData.decode('utf-8'))

if resp.status_code >= 200:
    if resp.status_code < 300:
        logger.debug('status : ' + str(resp.status_code))
        try:
            json_data = json.loads(resp.text)
            print(json.dumps(json_data, sort_keys=True, indent=4))
            webhook(json_data, None, None)
            # return(json_data['key'])
        except:
            logger.debug('Request of jiraApiPost')
    else:
        webhook("Jira Api Error : " + str(resp.status_code) + resp.text, None,
                None)
        logger.error(resp.text)