Create ticket in RT with python-rtkit having RESOURCE_STATUS: 401 Credentials required

北慕城南 提交于 2019-12-02 08:17:04

I haven't found a solution for this problem , but I succeeded to use python Requests library to create a ticket in RT .

  1. install Requests lib. http://docs.python-requests.org/en/latest/user/install/#install
  2. create a new ticket in RT

    #!/usr/bin/python -u
    import requests,logging
    
    logging.basicConfig(level=logging.DEBUG)
    post_data = """
    id: ticket/new
    Queue: myqueue
    Subject: Test Ticket creation in RT with Python
    Text: Wow ticket is created :-D . 
    """
    payload = {'user': 'user', 'pass': 'password','content':post_data}
    ticket_creation_reusult = requests.post("http://ticket.corp.kk.net/rt3/REST/1.0/ticket/new", payload)
    
    logging.debug(ticket_creation_reusult.text)
    

The output is:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1):  ticket.corp.kk.net
DEBUG:requests.packages.urllib3.connectionpool:"POST /rt3/REST/1.0/ticket/new     HTTP/1.1" 200 None
DEBUG:root:RT/3.8.13 200 Ok
# Ticket 221173 created.

Hope this can help you , if you have the same problem as me . :-)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!