Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 10-11-2013, 07:39 AM   #1
mr.w0lf
n00b
mr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with others
 
Posts: 58
Karma: 2802
Join Date: Jan 2012
Device: Kindle Touch
(weird) recipe opening a window

so, i am dealing with a Oauth driven site.. all code is fine, except that i had to hardcode authcode inside the recipe, after have manually retrieved it :/

At first i though to re-use one of the username/password to paste the auth_code but first i need to retrieve it, something that a normal user would find tricky.. any ideas?

note: calibre do not have to really deal with the oauth mechanism, the sequenze i have in mind is

Code:
  1. run recipe
  2. (if no oauth token is saved) open a popup / window with the proper oauth url
  3. do auth process
  4. retrieve auth_code
mr.w0lf is offline   Reply With Quote
Old 10-11-2013, 07:47 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
recipes can run in contexts where no GUI is available, therefore you cannot rely on being able to interact with the user while a recipe is running.

As I see it, you have two options

1) get the user to input the OAuth token in the username or password fields
2) get the user to input their OAuth providers credentials in the suername and password fields and then add code to the recipe to do the authentication

1) is easy for you hard for the user 2) is hard for you easy for the user.
kovidgoyal is offline   Reply With Quote
Advert
Old 10-11-2013, 07:49 AM   #3
mr.w0lf
n00b
mr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with others
 
Posts: 58
Karma: 2802
Join Date: Jan 2012
Device: Kindle Touch
yeah i was thinking the same.. will try to implement number 2, let's see if that drives me mad, especially because it involves even auth via google
mr.w0lf is offline   Reply With Quote
Old 10-11-2013, 10:14 AM   #4
mr.w0lf
n00b
mr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with others
 
Posts: 58
Karma: 2802
Join Date: Jan 2012
Device: Kindle Touch
i found that maybe i could do that with mechanize, but there is some JS involveed, in one of the steps, and as far as i know mechanize don't load it.. may you point me where is located the code of javascript_login() function? maybe i can re-use some of it to achieve what i need
mr.w0lf is offline   Reply With Quote
Old 10-11-2013, 02:03 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
See the get_browser() function in feeds/news.py it uses a full headless webkit browser and then copies the cookies to mechanize.
kovidgoyal is offline   Reply With Quote
Advert
Old 10-14-2013, 12:51 PM   #6
mr.w0lf
n00b
mr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with othersmr.w0lf plays well with others
 
Posts: 58
Karma: 2802
Join Date: Jan 2012
Device: Kindle Touch
tryed it, but Oauth passes through Google auth and this thing uses meta-refresh that jsbrowser doesn't seem to support/understand/don't want do deal with it..
on the other side i could circumvent it if it was possible for me to write raw headers to use the same method in Google_uber recipe..

on the other side i can not handle the last response it's give to me: browser points to localhost, which is obviously offline, but i need to get the url of it to get the auth code that is what is all this mess for

I am a little tired, sorry if something is not that clear :/
mr.w0lf is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening converting management window failed chilly_bang Devices 2 08-06-2013 06:35 AM
Opening a new window in calibre, and closing another window Dr. Drib Calibre 3 02-23-2012 09:27 AM
Link opening into new window? din155 Feedback 8 08-15-2011 03:19 PM
Passing parameters to recipe from "Schedule News Download" Window (e.g. for filtering oecherprinte Recipes 6 05-13-2011 11:38 AM
Opening links in a new window dhbailey Feedback 1 03-22-2007 04:01 PM


All times are GMT -4. The time now is 01:46 AM.


MobileRead.com is a privately owned, operated and funded community.