Thanks a lot. This explains everything. A big step forward thanks to your help.
I am going to study ESPN recipe closely. Kovid used "TemporaryFile" to eliminate writing to the root (or any folder that may not have permission). Hopefully "TemporaryFile" or "PersistentTemporaryFile" (example
) will be the magic bullet.
from calibre.ptempfile import TemporaryFile
br = BasicNewsRecipe.get_browser()
url = ('https://r.espn.go.com/members/v3_1/login')
raw = br.open(url).read()
raw = re.sub(r'(?s)<form>.*?id="regsigninbtn".*?</form>', '', raw)
with TemporaryFile(suffix='.htm') as fname:
with open(fname, 'wb') as f:
br.form = br.forms().next()
br.form.find_control(name='username', type='text').value = self.username
br.form['password'] = self.password