From f9b1e84704468ee9ac9ee0609a3a39b36fe50f37 Mon Sep 17 00:00:00 2001 From: Michael Shavit Date: Tue, 10 Dec 2019 23:57:53 -0500 Subject: [PATCH] Remove backblaze leftovers --- .gitignore | 1 - cps/kobo.py | 38 -------------------------------------- optional-requirements.txt | 3 --- 3 files changed, 42 deletions(-) diff --git a/.gitignore b/.gitignore index 5cf14e51..0ce14757 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,3 @@ gdrive_credentials vendor client_secrets.json -b2_secrets.json diff --git a/cps/kobo.py b/cps/kobo.py index eb290de6..8e79087e 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -8,19 +8,14 @@ import os from datetime import datetime, tzinfo, timedelta from time import gmtime, strftime -from b2sdk.account_info.in_memory import InMemoryAccountInfo -from b2sdk.api import B2Api from jsonschema import validate, exceptions from flask import Blueprint, request, make_response, jsonify, json, send_file from flask_login import login_required from sqlalchemy import func from . import config, logger, kobo_auth, ub, db, helper -from .constants import CONFIG_DIR as _CONFIG_DIR from .web import download_required -B2_SECRETS = os.path.join(_CONFIG_DIR, "b2_secrets.json") - kobo = Blueprint("kobo", __name__) kobo_auth.disable_failed_auth_redirect_for_blueprint(kobo) @@ -215,39 +210,6 @@ def get_download_url_for_book(book, book_format): ) -def get_download_url_for_book_b2(book, book_format): - if not data: - log.info(u"Book %s does have a kepub format", book_uuid) - return None - - file_name = data.name + ".kepub" - file_path = os.path.join(book.path, file_name) - - if not os.path.isfile(B2_SECRETS): - log.error(u"b2 secret file not found") - return None - with open(B2_SECRETS, "r") as filedata: - secrets = json.load(filedata) - - info = InMemoryAccountInfo() - b2_api = B2Api(info) - b2_api.authorize_account( - "production", secrets["application_key_id"], secrets["application_key"] - ) - bucket = b2_api.get_bucket_by_name(secrets["bucket_name"]) - if not bucket: - log.error(u"b2 bucket not found") - return None - - download_url = b2_api.get_download_url_for_file_name( - secrets["bucket_name"], file_path - ) - download_authorization = bucket.get_download_authorization( - file_path, valid_duration_in_seconds=600 - ) - return download_url + "?Authorization=" + download_authorization - - def create_book_entitlement(book): book_uuid = book.uuid return { diff --git a/optional-requirements.txt b/optional-requirements.txt index 043a6943..605667d2 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -32,6 +32,3 @@ rarfile>=2.7 # other natsort>=2.2.0 git+https://github.com/OzzieIsaacs/comicapi.git@5346716578b2843f54d522f44d01bc8d25001d24#egg=comicapi - -# Unsupported/Experimental backblaze integration for Kobo endpoint. -b2sdk>=1.0.2,<2.0.0