This commit is contained in:
Kovid Goyal 2024-03-24 17:08:58 +05:30
parent 7654f34b69
commit 61dc642c42
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1,8 +1,9 @@
from calibre.web.feeds.recipes import BasicNewsRecipe
import mechanize
import json
from mechanize import Request
from datetime import datetime
from calibre.web.feeds.recipes import BasicNewsRecipe
class Nzz(BasicNewsRecipe):
title = 'NZZ'
@ -80,13 +81,13 @@ class Nzz(BasicNewsRecipe):
encoded_data = json.dumps(json_data).encode('utf-8')
# Create a mechanize Request object with the target URL, encoded data, and headers
req = mechanize.Request(url='https://epaper.nzz.ch/epaper/1.0/findEditionsFromDate',
req = Request(url='https://epaper.nzz.ch/epaper/1.0/findEditionsFromDate',
data=encoded_data,
headers=headers,
method='POST')
# Use mechanize to open the request and read the response
browser = mechanize.Browser()
browser = self.get_browser()
response = browser.open(req)
response_data = json.loads(response.read())