SIGN IN SIGN UP
psf / requests UNCLAIMED

A simple, yet elegant, HTTP library.

53850 0 0 Python
2011-02-13 13:52:37 -05:00
#!/usr/bin/env python
2012-05-02 19:18:14 -04:00
import os
2011-02-13 13:52:37 -05:00
import sys
from codecs import open
from setuptools import setup
2016-02-02 12:02:37 +01:00
from setuptools.command.test import test as TestCommand
CURRENT_PYTHON = sys.version_info[:2]
2024-02-20 15:22:20 -08:00
REQUIRED_PYTHON = (3, 8)
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write(
"""
==========================
Unsupported Python version
==========================
This version of Requests requires at least Python {}.{}, but
you're trying to install it on Python {}.{}. To resolve this,
consider upgrading to a supported Python version.
If you can't upgrade your Python version, you'll need to
2024-02-20 15:22:20 -08:00
pin to an older version of Requests (<2.32.0).
""".format(
*(REQUIRED_PYTHON + CURRENT_PYTHON)
)
)
sys.exit(1)
2016-02-02 12:02:37 +01:00
2016-02-02 12:02:37 +01:00
class PyTest(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
try:
from multiprocessing import cpu_count
self.pytest_args = ["-n", str(cpu_count()), "--boxed"]
except (ImportError, NotImplementedError):
self.pytest_args = ["-n", "1", "--boxed"]
2016-02-02 12:02:37 +01:00
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
2017-05-25 11:31:38 -04:00
# 'setup.py publish' shortcut.
2011-12-11 11:39:57 -05:00
if sys.argv[-1] == "publish":
2017-05-26 21:43:03 -04:00
os.system("python setup.py sdist bdist_wheel")
os.system("twine upload dist/*")
2011-02-17 16:22:03 -05:00
sys.exit()
2011-02-13 13:52:37 -05:00
2017-05-26 22:44:56 -04:00
requires = [
"charset_normalizer>=2,<4",
"idna>=2.5,<4",
2023-05-03 08:39:44 -07:00
"urllib3>=1.21.1,<3",
"certifi>=2017.4.17",
2017-05-26 22:44:56 -04:00
]
test_requirements = [
"pytest-httpbin==2.0.0",
"pytest-cov",
"pytest-mock",
"pytest-xdist",
"PySocks>=1.5.6, !=1.5.7",
"pytest>=3",
]
2017-05-25 11:31:38 -04:00
about = {}
here = os.path.abspath(os.path.dirname(__file__))
2023-08-13 14:46:13 -07:00
with open(os.path.join(here, "src", "requests", "__version__.py"), "r", "utf-8") as f:
2017-05-25 11:31:38 -04:00
exec(f.read(), about)
2018-09-17 06:05:03 -04:00
with open("README.md", "r", "utf-8") as f:
readme = f.read()
2011-02-13 13:52:37 -05:00
setup(
name=about["__title__"],
2017-05-25 11:31:38 -04:00
version=about["__version__"],
description=about["__description__"],
2018-09-17 06:05:03 -04:00
long_description=readme,
long_description_content_type="text/markdown",
author=about["__author__"],
author_email=about["__author_email__"],
url=about["__url__"],
packages=["requests"],
2020-11-10 12:34:35 -08:00
package_data={"": ["LICENSE", "NOTICE"]},
2023-08-13 14:46:13 -07:00
package_dir={"": "src"},
2011-12-11 11:39:57 -05:00
include_package_data=True,
2024-02-20 15:22:20 -08:00
python_requires=">=3.8",
install_requires=requires,
license=about["__license__"],
2012-10-30 15:20:08 +00:00
zip_safe=False,
classifiers=[
"Development Status :: 5 - Production/Stable",
2021-12-29 15:29:09 -07:00
"Environment :: Web Environment",
2011-02-17 16:22:03 -05:00
"Intended Audience :: Developers",
2012-12-05 16:19:14 -06:00
"License :: OSI Approved :: Apache Software License",
2021-12-29 15:29:09 -07:00
"Natural Language :: English",
"Operating System :: OS Independent",
2011-02-17 16:22:03 -05:00
"Programming Language :: Python",
2012-01-23 02:28:01 -05:00
"Programming Language :: Python :: 3",
2019-08-20 01:01:06 -04:00
"Programming Language :: Python :: 3.8",
2020-11-10 12:34:35 -08:00
"Programming Language :: Python :: 3.9",
2021-09-03 19:03:15 -07:00
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
2016-02-02 12:02:37 +01:00
"Programming Language :: Python :: Implementation :: CPython",
2021-12-29 15:29:09 -07:00
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Libraries",
],
2016-02-02 12:02:37 +01:00
cmdclass={"test": PyTest},
tests_require=test_requirements,
2014-08-29 16:39:22 -05:00
extras_require={
"security": [],
"socks": ["PySocks>=1.5.6, !=1.5.7"],
"use_chardet_on_py3": ["chardet>=3.0.2,<6"],
2014-08-29 16:39:22 -05:00
},
project_urls={
"Documentation": "https://requests.readthedocs.io",
2019-09-19 07:52:28 -07:00
"Source": "https://github.com/psf/requests",
},
2011-02-13 13:52:37 -05:00
)