-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added get newest RT ticket #232
base: master
Are you sure you want to change the base?
Conversation
(Closed and reopened, which seems to have fixed CI not getting triggered initially) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the good work, i'm still figuring out how to access rt api with my acct
@classmethod | ||
def get_newest(cls, connection, queue): | ||
"""Returns the newest created RT ticket in the given queue""" | ||
resp = connection.get("https://rt.ocf.berkeley.edu/REST/1.0/search/ticket?query=Queue='{}'&orderby=-Created".format(queue)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this would work since I can't seem to find relevant stuff in the docs (https://rt-wiki.bestpractical.com/wiki/REST#Ticket_Search), but I think it might return a bunch of tickets instead of one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid query: 'Wrong query, expecting a VALUE in 'Queue=>help<--here' at /opt/rt5/sbin/../lib/RT/Tickets.pm line 3036, <DATA> line 1662.
Stack:
[/opt/rt5/sbin/../lib/RT/Tickets.pm:3036]
[/opt/rt5/sbin/../lib/RT/Tickets.pm:3248]
[/opt/rt5/share/html/REST/1.0/search/dhandler:120]
[/opt/rt5/share/html/REST/1.0/autohandler:54]
[/opt/rt5/sbin/../lib/RT/Interface/Web.pm:710]
[/opt/rt5/sbin/../lib/RT/Interface/Web.pm:389]
[/opt/rt5/share/html/autohandler:53]
'.
return line.split(': ', 1)[1] | ||
|
||
return cls( | ||
number=num, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to do something to find id: ticket/<ticket-id>
;
|
||
lines = resp.text.splitlines() | ||
|
||
def find(header): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk this is legacy, it's elegant but comparatively inefficient i guess (need to do 4 passes instead of 1)
https://metacpan.org/pod/RT::Extension::REST2#Cookie-Auth |
New method to get latest RT ticket using REST API. Pushed to master to test since local tests aren't working.