z4r / python-rtkit

Python Api for Request Tracker's REST interface
http://z4r.github.com/python-rtkit/
Other
68 stars 44 forks source link

Check login details #27

Closed jakubjedelsky closed 11 years ago

jakubjedelsky commented 11 years ago

Is it possible to add some kind of check if login details are ok? Just check if user is correctly logged in RT and return True / False?

z4r commented 11 years ago

It's not a direct api exposed by RT. However if you're using CookieAuthenticatoryou could do something like:

auth = CookieAuthenticator(
    "john.foo",
    "john.foo",
    "http://rt.easter-eggs.org/demos/stable/REST/1.0/",
)
auth._login()
z4r commented 11 years ago
z4rimac:~ Z4R$ curl "http://rt.easter-eggs.org/demos/stable/REST/1.0/" -d "user=john.foo&pass=john.foo"
RT/4.0.5-116-g591e06a 200 Ok
    ....
z4rimac:~ Z4R$ curl "http://rt.easter-eggs.org/demos/stable/REST/1.0/" -d "user=john.foo&pass=john.fool"
RT/4.0.5-116-g591e06a 401 Credentials required

Your username or password is incorrect