Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code update for Python3 #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html linguist-vendored=true
*.css linguist-vendored=true
9 changes: 7 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
Flask==0.10.1
-e git+https://github.com/threatstream/hpfeeds/#egg=hpfeeds-dev
Click==7.0
Flask==1.0.2
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
Werkzeug==0.14.1
-e git+https://github.com/threatstream/hpfeeds/#egg=hpfeeds-dev
4 changes: 2 additions & 2 deletions wordpot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
try:
from flask import Flask
except ImportError:
print "\n[X] Please install Flask:"
print " $ pip install flask\n"
print("\n[X] Please install Flask:")
print(" $ pip install flask\n")
exit()

from wordpot import app, pm, parse_options, check_options
Expand Down
10 changes: 5 additions & 5 deletions wordpot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
try:
from flask import Flask
except ImportError:
print "\n[X] Please install Flask:"
print " $ pip install flask\n"
print("\n[X] Please install Flask:")
print(" $ pip install flask\n")
exit()

from optparse import OptionParser
Expand Down Expand Up @@ -50,15 +50,15 @@ def parse_options():

(options, args) = parser.parse_args()

for opt, val in options.__dict__.iteritems():
for opt, val in options.__dict__.items():
if val is not None:
if opt in ['PLUGINS', 'THEMES']:
val = [ v.strip() for v in val.split(',') ]
app.config[opt] = val


def check_options():
for k, v in REQUIRED_OPTIONS.iteritems():
for k, v in REQUIRED_OPTIONS.items():
if k not in app.config:
LOGGER.error('%s was not set. Falling back to default: %s', k, v)
app.config[k] = v
Expand Down Expand Up @@ -87,7 +87,7 @@ def check_options():

if app.config['HPFEEDS_ENABLED']:
import hpfeeds
print 'Connecting to hpfeeds broker {}:{}'.format(app.config['HPFEEDS_HOST'], app.config['HPFEEDS_PORT'])
print('Connecting to hpfeeds broker {}:{}'.format(app.config['HPFEEDS_HOST'], app.config['HPFEEDS_PORT']))
app.config['hpfeeds_client'] = hpfeeds.new(
app.config['HPFEEDS_HOST'],
app.config['HPFEEDS_PORT'],
Expand Down
10 changes: 5 additions & 5 deletions wordpot/plugins_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from flask import request
from wordpot.logger import *
import os
import ConfigParser
import configparser

CURRENTPATH = os.path.abspath(os.path.dirname(__file__))

Expand Down Expand Up @@ -59,7 +59,7 @@ def __init__(self, slug=None):
def _load_config(self, slug=None):
self.slug = slug
try:
config = ConfigParser.ConfigParser()
config = configparser.ConfigParser()
plugin_config = os.path.join(CURRENTPATH, 'plugins/%s.ini' % self.slug)

config.read(plugin_config)
Expand All @@ -71,7 +71,7 @@ def _load_config(self, slug=None):
self.version = config.get('plugin', 'version')

self.hooks = [v.strip() for v in config.get('plugin', 'hooks').split(',')]
except Exception, e:
except Exception as e:
pass

def start(self, **kwargs):
Expand All @@ -80,11 +80,11 @@ def start(self, **kwargs):
self.outputs = {}

# Parse arguments
for k, v in kwargs.iteritems():
for k, v in kwargs.items():
self.inputs[k] = v
try:
self.run()
except Exception, e:
except Exception as e:
LOGGER.error('Unable to run plugin: %s\n%s', self.name, e.message)

def run(self):
Expand Down