I figured out my problem.  I need to refresh the api after I post to get a 
valid session.

# Bad way
rbt_api = rbclient.get_root()
post.Post().run_from_argv(args)
# Enter username/password
rr = rbt_api.get_review_request(...)

That didn't work.  This does

# Works
post.Post().run_from_argv(args)
# Enter username/password
rbt_api = rbclient.get_root()
rr = rbt_api.get_review_request(...)  

I don't fully understand the sequence, but it works and seems sensible so I 
thought I'd post it in case someone else runs into something similar.

Thanks

--Steve


On Wednesday, June 3, 2015 at 4:30:55 PM UTC-7, Steve wrote:
>
> Thanks Barret,
>
> I'm very confused about the cookie file behavior.  I tried to simplify it 
> as much as possible and found this:
>
> $ rbt post 814
>
> will write a new cookie file with a session id,  but calling rbt from a 
> python script in any of these ways:
>
> subprocess.call("rbt post 814", shel=True)
>
> subprocess.call(['rbt', 'post', '814'])
>
> or even
>
> os.system("rbt post 814")
>
> writes a cookie file with just the header and no session id.  I'm baffled.
>
> How are others calling rbt from python scripts and getting authentication 
> to work?
>
> --Steve
>
>
> On Tuesday, June 2, 2015 at 10:38:23 AM UTC-7, Barret Rennie wrote:
>>
>> Hey Steve,
>>
>> The cookie file is written inside of the ReviewBoardServer class (in 
>> rbtools.api.request) when it is instantiated.
>>
>> Regards,
>> Barret Rennie
>>
>> On Jun 2, 2015, at 11:29 AM, Steve <seide...@gmail.com> wrote:
>>
>> I have a wrapper to rbt that calls directly into Post.run_from_argv(). 
>>  I'm seeing different behavior regarding the saving of credentials in the 
>> .rbtools-cookies file and am hoping someone can tell me where to look in 
>> the code to understand this.  I've been stepping through the debugger, but 
>> getting lost.
>>
>> Here's the problem I'm having.  On my main dev box, when prompted for 
>> login, I get a proper .rbtools-cookies file.  But on my test machines, the 
>> file gets written with only the header - no cookie - so I get prompted 
>> every time.  
>>
>> Every configuration is using RBTools 0.6.3 and RB 2.0.15.  The only 
>> difference that I can see is in python versions. 
>>
>> This works:
>>
>> RBTools 0.6.3, RB 2.0.15
>> Python 2.7.8
>>
>> These combos don't work:
>>
>> RBTools 0.6.3 RB 2.0.15
>> Python 2.7.5, Python 2.6.6
>>
>> I don't know if this is significant, but the successful case has this 
>> line in the header:
>>
>> # http://curl.haxx.se/rfc/cookie_spec.html
>>
>> and all the others have this:
>>
>> # http://www.netscape.com/newsref/std/cookie_spec.html
>>
>> which may indicate a different authentication module is being used.  In 
>> every case, rbt itself works correctly, so the problem is coming from my 
>> calling directly into run_from_argv.  I don't expect anyone to solve this 
>> for me but if I could get some clues as to where to look for the code that 
>> saves the cookie file that would be very helpful.
>>
>> Thanks!
>>
>> --Steve
>>
>>
>> -- 
>> Supercharge your Review Board with Power Pack: 
>> https://www.reviewboard.org/powerpack/
>> Want us to host Review Board for you? Check out RBCommons: 
>> https://rbcommons.com/
>> Happy user? Let us know! https://www.reviewboard.org/users/
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "reviewboard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to reviewboard...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to