-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop support for Python 2, Use
ipware.get_client_ip
instead of `ipw…
…are.ip.get_real_ip`, Bump version 0.5.0
- Loading branch information
Showing
5 changed files
with
49 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
from django.contrib.sessions.middleware import SessionMiddleware as DjSessionMiddleware | ||
from django.conf import settings | ||
from ipware.ip import get_real_ip, get_ip | ||
from ipware import get_client_ip | ||
|
||
|
||
class SessionMiddleware(DjSessionMiddleware): | ||
def process_request(self, request): | ||
session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME) | ||
request.session = self.SessionStore( | ||
ip=get_real_ip(request) or get_ip(request), | ||
user_agent=request.META.get("HTTP_USER_AGENT", ""), | ||
session_key=session_key, | ||
ip=get_client_ip(request)[0], user_agent=request.META.get("HTTP_USER_AGENT", ""), session_key=session_key, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,52 @@ | ||
import os | ||
from setuptools import setup, find_packages | ||
|
||
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: | ||
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme: | ||
README = readme.read() | ||
|
||
# allow setup.py to be run from any path | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
dev_requirements = [ | ||
'geoip2==3.0.0', # for testing GeoIP2 | ||
'pytest', | ||
'pytest-cov', | ||
'pytest-django', | ||
"geoip2==3.0.0", # for testing GeoIP2 | ||
"pytest", | ||
"pytest-cov", | ||
"pytest-django", | ||
] | ||
|
||
setup( | ||
name='django-qsessions', | ||
version='0.4.1', | ||
description='Extended session backends for Django', | ||
name="django-qsessions", | ||
version="0.5.0", | ||
description="Extended session backends for Django", | ||
long_description=README, | ||
author='Mohammad Javad Naderi', | ||
url='https://github.com/QueraTeam/django-qsessions', | ||
download_url='https://pypi.python.org/pypi/django-qsessions', | ||
license='MIT', | ||
packages=find_packages('.', include=('qsessions', 'qsessions.*')), | ||
author="Mohammad Javad Naderi", | ||
url="https://github.com/QueraTeam/django-qsessions", | ||
download_url="https://pypi.python.org/pypi/django-qsessions", | ||
license="MIT", | ||
packages=find_packages(".", include=("qsessions", "qsessions.*")), | ||
include_package_data=True, | ||
install_requires=[ | ||
'Django>=1.10', | ||
'user-agents>=1.1.0', | ||
'django-ipware>=1.1.5', | ||
], | ||
extras_require={'dev': dev_requirements}, | ||
install_requires=["Django>=1.10", "user-agents>=1.1.0", "django-ipware>=2.0.0"], | ||
extras_require={"dev": dev_requirements}, | ||
tests_require=dev_requirements, | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Framework :: Django :: 1.11', | ||
'Framework :: Django :: 2.0', | ||
'Framework :: Django :: 2.1', | ||
'Framework :: Django :: 2.2', | ||
'Framework :: Django :: 3.0', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Topic :: Internet :: WWW/HTTP :: Session', | ||
'Topic :: Security', | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Web Environment", | ||
"Framework :: Django", | ||
"Framework :: Django :: 1.10", | ||
"Framework :: Django :: 1.11", | ||
"Framework :: Django :: 2.0", | ||
"Framework :: Django :: 2.1", | ||
"Framework :: Django :: 2.2", | ||
"Framework :: Django :: 3.0", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Topic :: Internet :: WWW/HTTP :: Session", | ||
"Topic :: Security", | ||
], | ||
) |