Skip to content

Commit

Permalink
Drop support for Python 2, Use ipware.get_client_ip instead of `ipw…
Browse files Browse the repository at this point in the history
…are.ip.get_real_ip`, Bump version 0.5.0
  • Loading branch information
mjnaderi committed Jul 1, 2020
1 parent 89a1c07 commit ae632e8
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 51 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ language: python

jobs:
include:
- python: 2.7
env: DJANGO=1.10
- python: 3.5
env: DJANGO=1.10
- python: 3.6
env: DJANGO=1.10

- python: 2.7
env: DJANGO=1.11
- python: 3.5
env: DJANGO=1.11
- python: 3.6
Expand Down Expand Up @@ -58,7 +54,7 @@ jobs:
- stage: black
python: 3.8
install: pip install black
script: black -l 120 --check qsessions tests
script: black -l 120 --check qsessions tests setup.py

allow_failures:
- env: DJANGO=master
Expand Down
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# 0.5.0

- Drop support for Python 2.
- Use `ipware.get_client_ip` instead of `ipware.ip.get_real_ip` (which is removed since `django-ipware==3.0.0`)
- Format source code using [black](https://github.com/psf/black)

Thanks [@sevdog](https://github.com/sevdog)

# 0.4.1

- Updated `download_geoip_db` management command to use new Maxmind download URLs, and provide license key.

Thanks @akx
Thanks [@akx](https://github.com/akx)

# 0.4.0

Expand All @@ -13,13 +21,13 @@ Thanks @akx

- Added `qsessions.backends.db` session backend.

Thanks @willstott101
Thanks [@willstott101](https://github.com/willstott101)

# 0.2.1

- Added support for Django 2.2.

Thanks @akx
Thanks [@akx](https://github.com/akx)

# 0.2.0

Expand All @@ -28,7 +36,7 @@ Thanks @akx
- Improved session delete performance (reduce number of queries)
- Refactored codes

Thanks @akx, @saeed617
Thanks [@akx](https://github.com/akx), [@saeed617](https://github.com/saeed617)

# 0.1.6

Expand Down
2 changes: 0 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ Compatibility
+----------------+--------------------------------+
| 3.5 | 1.10, 1.11, 2.0, 2.1, 2.2 |
+----------------+--------------------------------+
| 2.7 | 1.10, 1.11 |
+----------------+--------------------------------+

Installation
============
Expand Down
6 changes: 2 additions & 4 deletions qsessions/middleware.py
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,
)
70 changes: 34 additions & 36 deletions setup.py
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",
],
)

0 comments on commit ae632e8

Please sign in to comment.