From a036e554d270ccf7f6de3ba34c92711f8c768841 Mon Sep 17 00:00:00 2001 From: evilhero Date: Wed, 7 Sep 2016 00:04:42 -0400 Subject: [PATCH] Fixed some incorrect lib references --- lib/cfscrape/__init__.py | 6 +++--- lib/js2py/host/console.py | 2 +- lib/js2py/host/jseval.py | 4 ++-- lib/js2py/host/jsfunctions.py | 2 +- mylar/Failed.py | 2 +- mylar/api.py | 2 +- mylar/auth32p.py | 2 +- mylar/cv.py | 2 +- mylar/findcomicfeed.py | 3 +-- mylar/importer.py | 2 +- mylar/locg.py | 2 +- mylar/mb.py | 2 +- mylar/newpull.py | 2 +- mylar/notifiers.py | 4 ++-- mylar/rsscheck.py | 24 +++++++++++++++++------- mylar/sabparse.py | 2 +- mylar/search.py | 4 ++-- mylar/test.py | 4 ++-- mylar/torrent/clients/rtorrent.py | 2 +- mylar/versioncheck.py | 2 +- mylar/webserve.py | 8 ++++---- 21 files changed, 46 insertions(+), 37 deletions(-) diff --git a/lib/cfscrape/__init__.py b/lib/cfscrape/__init__.py index b47e8fb4..ca29bfa7 100644 --- a/lib/cfscrape/__init__.py +++ b/lib/cfscrape/__init__.py @@ -3,9 +3,9 @@ import logging import random import re import os -from lib.requests.sessions import Session -import lib.js2py as js2py -from lib.js2py import eval_js as eval_js +from requests.sessions import Session +import js2py +from js2py import eval_js try: from urlparse import urlparse diff --git a/lib/js2py/host/console.py b/lib/js2py/host/console.py index 55075ce2..3b67a6f6 100644 --- a/lib/js2py/host/console.py +++ b/lib/js2py/host/console.py @@ -1,4 +1,4 @@ -from lib.js2py.base import * +from js2py.base import * @Js def console(): diff --git a/lib/js2py/host/jseval.py b/lib/js2py/host/jseval.py index de5ff365..2868b0c3 100644 --- a/lib/js2py/host/jseval.py +++ b/lib/js2py/host/jseval.py @@ -1,7 +1,7 @@ -from lib.js2py.base import * +from js2py.base import * import inspect try: - from lib.js2py.translators.translator import translate_js + from js2py.translators.translator import translate_js except: pass diff --git a/lib/js2py/host/jsfunctions.py b/lib/js2py/host/jsfunctions.py index fb76a059..9d55bde4 100644 --- a/lib/js2py/host/jsfunctions.py +++ b/lib/js2py/host/jsfunctions.py @@ -1,4 +1,4 @@ -from lib.js2py.base import * +from js2py.base import * RADIX_CHARS = {'1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'a': 10, 'c': 12, 'b': 11, 'e': 14, 'd': 13, 'g': 16, 'f': 15, 'i': 18, 'h': 17, 'k': 20, 'j': 19, 'm': 22, 'l': 21, diff --git a/mylar/Failed.py b/mylar/Failed.py index b4b406cd..ab08545e 100644 --- a/mylar/Failed.py +++ b/mylar/Failed.py @@ -18,7 +18,7 @@ from __future__ import division import mylar from mylar import logger, db, updater, helpers, parseit, findcomicfeed, notifiers, rsscheck -import lib.feedparser as feedparser +import feedparser as feedparser import urllib import os, errno import string diff --git a/mylar/api.py b/mylar/api.py index 0c6289d9..4cc6b079 100644 --- a/mylar/api.py +++ b/mylar/api.py @@ -18,7 +18,7 @@ import mylar from mylar import db, mb, importer, search, PostProcessor, versioncheck, logger -import lib.simplejson as simplejson +import simplejson as simplejson import cherrypy import os import urllib2 diff --git a/mylar/auth32p.py b/mylar/auth32p.py index 4cbec2ea..644c6d84 100644 --- a/mylar/auth32p.py +++ b/mylar/auth32p.py @@ -3,7 +3,7 @@ import re import time import datetime import os -import requests as requests +import requests from bs4 import BeautifulSoup from cookielib import LWPCookieJar diff --git a/mylar/cv.py b/mylar/cv.py index a216d046..b2b9a7c2 100755 --- a/mylar/cv.py +++ b/mylar/cv.py @@ -25,7 +25,7 @@ import mylar import platform from bs4 import BeautifulSoup as Soup import httplib -import lib.requests as requests +import requests def patch_http_response_read(func): def inner(*args): diff --git a/mylar/findcomicfeed.py b/mylar/findcomicfeed.py index 5d4e7403..616e6d57 100755 --- a/mylar/findcomicfeed.py +++ b/mylar/findcomicfeed.py @@ -2,8 +2,7 @@ import os import sys -import lib.feedparser as feedparser -#import feedparser +import feedparser import re import logger import mylar diff --git a/mylar/importer.py b/mylar/importer.py index 0722979e..7d59e573 100755 --- a/mylar/importer.py +++ b/mylar/importer.py @@ -28,7 +28,7 @@ import shutil import imghdr import sqlite3 import cherrypy -import lib.requests as requests +import requests import gzip from StringIO import StringIO diff --git a/mylar/locg.py b/mylar/locg.py index b02ef673..344eb682 100755 --- a/mylar/locg.py +++ b/mylar/locg.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with Mylar. If not, see . -import lib.requests as requests +import requests from bs4 import BeautifulSoup, UnicodeDammit import datetime import re diff --git a/mylar/mb.py b/mylar/mb.py index 944a6ae0..bcc4dc3f 100755 --- a/mylar/mb.py +++ b/mylar/mb.py @@ -21,7 +21,7 @@ import threading import platform import urllib, urllib2 from xml.dom.minidom import parseString, Element -import lib.requests as requests +import requests import mylar from mylar import logger, db, cv diff --git a/mylar/newpull.py b/mylar/newpull.py index 07987c8f..492f9245 100755 --- a/mylar/newpull.py +++ b/mylar/newpull.py @@ -12,7 +12,7 @@ import unicodedata from decimal import Decimal from HTMLParser import HTMLParseError from time import strptime -import lib.requests as requests +import requests import mylar from mylar import logger diff --git a/mylar/notifiers.py b/mylar/notifiers.py index b77ac705..dd235cd1 100644 --- a/mylar/notifiers.py +++ b/mylar/notifiers.py @@ -24,9 +24,9 @@ from urllib import urlencode import os.path import subprocess import time -import lib.simplejson as simplejson +import simplejson import json -import lib.requests as requests +import requests # This was obviously all taken from headphones with great appreciation :) diff --git a/mylar/rsscheck.py b/mylar/rsscheck.py index a39573b2..3c8b243d 100755 --- a/mylar/rsscheck.py +++ b/mylar/rsscheck.py @@ -2,9 +2,9 @@ import os, sys import re -import lib.feedparser as feedparser -import lib.requests as requests -import lib.cfscrape as cfscrape +import feedparser +import requests +import cfscrape import urlparse import ftpsshup import datetime @@ -14,7 +14,7 @@ from StringIO import StringIO import mylar from mylar import db, logger, ftpsshup, helpers, auth32p, utorrent -import mylar.torrent.clients.transmission as transmission +import torrent.clients.transmission as transmission def _start_newznab_attr(self, attrsD): @@ -146,8 +146,18 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None): payload = None try: - scraper = cfscrape.create_scraper() - r = scraper.get(feed, verify=verify)#requests.get(feed, params=payload, verify=verify) + cf_cookievalue = None + if pickfeed == '2': + scraper = cfscrape.create_scraper() + cf_cookievalue, cf_user_agent = scraper.get_tokens(feed) + headers = {'Accept-encoding': 'gzip', + 'User-Agent': cf_user_agent} + logger.info(cf_cookievalue) + + if cf_cookievalue: + r = scraper.get(feed, verify=verify, cookies=cf_cookievalue, headers=headers) + else: + r = scraper.get(feed, verify=verify)#requests.get(feed, params=payload, verify=verify) except Exception, e: logger.warn('Error fetching RSS Feed Data from %s: %s' % (picksite, e)) return @@ -828,7 +838,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): try: scraper = cfscrape.create_scraper() - cf_cookievalue, cf_user_agent = cfscrape.get_tokens(url) + cf_cookievalue, cf_user_agent = scraper.get_tokens(url) headers = {'Accept-encoding': 'gzip', 'User-Agent': cf_user_agent} diff --git a/mylar/sabparse.py b/mylar/sabparse.py index 44d98cd3..c15d6553 100755 --- a/mylar/sabparse.py +++ b/mylar/sabparse.py @@ -1,7 +1,7 @@ import mylar from mylar import logger -import lib.requests as requests +import requests from bs4 import BeautifulSoup, UnicodeDammit import re import datetime diff --git a/mylar/search.py b/mylar/search.py index 98c16f81..a8dc6603 100755 --- a/mylar/search.py +++ b/mylar/search.py @@ -18,8 +18,8 @@ from __future__ import division import mylar from mylar import logger, db, updater, helpers, parseit, findcomicfeed, notifiers, rsscheck, Failed, filechecker, auth32p -import lib.feedparser as feedparser -import lib.requests as requests +import feedparser +import requests import urllib import os, errno import string diff --git a/mylar/test.py b/mylar/test.py index ab200111..b375ec70 100644 --- a/mylar/test.py +++ b/mylar/test.py @@ -8,7 +8,7 @@ from base64 import b16encode, b32decode from torrent.helpers.variable import link, symlink, is_rarfile -import lib.requests as requests +import requests #from lib.unrar2 import RarFile import torrent.clients.rtorrent as TorClient @@ -64,7 +64,7 @@ class RTorrent(object): def get_the_hash(self, filepath): import hashlib, StringIO - import lib.rtorrent.lib.bencode as bencode + import rtorrent.lib.bencode as bencode # Open torrent file torrent_file = open(filepath, "rb") diff --git a/mylar/torrent/clients/rtorrent.py b/mylar/torrent/clients/rtorrent.py index 84ef7350..83d6fae0 100755 --- a/mylar/torrent/clients/rtorrent.py +++ b/mylar/torrent/clients/rtorrent.py @@ -1,6 +1,6 @@ import os -from rtorrent import RTorrent +from lib.rtorrent import RTorrent import mylar from mylar import logger, helpers diff --git a/mylar/versioncheck.py b/mylar/versioncheck.py index 3d878a6d..4fd24253 100755 --- a/mylar/versioncheck.py +++ b/mylar/versioncheck.py @@ -18,7 +18,7 @@ import platform, subprocess, re, os, urllib2, tarfile import mylar from mylar import logger, version -import lib.requests as requests +import requests import re #user = "evilhero" diff --git a/mylar/webserve.py b/mylar/webserve.py index a19453fa..377a575c 100755 --- a/mylar/webserve.py +++ b/mylar/webserve.py @@ -39,7 +39,7 @@ import mylar from mylar import logger, db, importer, mb, search, filechecker, helpers, updater, parseit, weeklypull, PostProcessor, librarysync, moveit, Failed, readinglist, notifiers #,rsscheck -import lib.simplejson as simplejson +import simplejson as simplejson from operator import itemgetter @@ -4419,7 +4419,7 @@ class WebInterface(object): logger.fdebug('sab_password: ' + str(sab_password)) logger.fdebug('sab_apikey: ' + str(sab_apikey)) if mylar.USE_SABNZBD: - import lib.requests as requests + import requests from xml.dom.minidom import parseString, Element #if user/pass given, we can auto-fill the API ;) @@ -4450,7 +4450,7 @@ class WebInterface(object): if requests.exceptions.SSLError: logger.warn('Cannot verify ssl certificate. Attempting to authenticate with no ssl-certificate verification.') try: - from lib.requests.packages.urllib3 import disable_warnings + from requests.packages.urllib3 import disable_warnings disable_warnings() except: logger.warn('Unable to disable https warnings. Expect some spam if using https nzb providers.') @@ -4842,7 +4842,7 @@ class WebInterface(object): def get_the_hash(self, filepath): import hashlib, StringIO - import lib.rtorrent.lib.bencode as bencode + import rtorrent.lib.bencode as bencode # Open torrent file torrent_file = open(os.path.join('/home/hero/mylar/cache', filepath), "rb")