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

Requests for new release for python2.7+ to python 3 #45

Open
wants to merge 6 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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ A python 2.7 script using Tornado and JSBeautifier to parse relative URLs from J
# Installing

```
$ python setup.py install
$ python3 setup.py install
```

# Running

Run `handler.py` and then visit http://localhost:8008.

```
$ python handler.py
$ python3 handler.py
```

# Authors
Expand All @@ -38,4 +38,4 @@ $ python handler.py

# Changelog

1.0 - Release
1.0 - Release
4 changes: 2 additions & 2 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import tornado.ioloop, tornado.web, tornado.autoreload
from tornado.escape import json_encode, json_decode

import safeurl, types, sys, re, mimetypes, glob, jsbeautifier, urlparse, pycurl
import safeurl, types, sys, re, mimetypes, glob, jsbeautifier, urllib.parse, pycurl
import calendar, time, datetime

from netaddr import *
from collections import defaultdict
from bs4 import BeautifulSoup
from cgi import escape
from html import escape

#------------------------------------------------------------
# Base / Status Code Handlers
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
safeurl
tornado
tornado<=5.1
jsbeautifier
netaddr
pycurl
BeautifulSoup4
BeautifulSoup4
6 changes: 3 additions & 3 deletions safeurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import re
import netaddr
import pycurl
import StringIO
import io

# Python 2.7/3 urlparse
try:
Expand Down Expand Up @@ -707,7 +707,7 @@ def execute(self, url):
self._handle.setopt(pycurl.URL, url["cleanUrl"])

# Execute the cURL request
response = StringIO.StringIO()
response = io.BytesIO()
self._handle.setopt(pycurl.WRITEFUNCTION, response.write)
self._handle.perform()

Expand All @@ -729,4 +729,4 @@ def execute(self, url):
if not redirected:
break

return response.getvalue()
return response.getvalue().decode('utf-8')
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
long_description=open('README.md').read(),
author='Ben Sadeghipour',
url='https://github.com/nahamsec/JSParser',
install_requires=['safeurl', 'tornado', 'jsbeautifier',
install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier',
'netaddr', 'pycurl', 'BeautifulSoup4'],
)