Saravanan666/pypi-org huggingface dataset:
Package: requests-h2
requests-h2Requeststhat supports HTTP/1.1 and HTTP/2.It may help people who want requests-style coding to send HTTP2 requests and don't want to upgrade their OpenSSL version, and
it allows you to send HTTP/1.1 and HTTP/2 requests extremely easily.requests-h2是一个支持http2的http请求库，本项目基于requests与httpcore，除增加了额外参数外，与requests使用方法一致。You use it just like requests:>>>importrequests-h2asrequests>>>r=requests.get('https://www.google.com',http2=True)>>>r.status_code200>>>r.version'HTTP/2'InstallationYou can install requests-h2 either via the Python Package Index (PyPI) or from source.To install usingpip:pip install requests-h2RequirementsPython 3.7+Dependenciesrequestshttpcoreurllib3<2MotivationWe are used to usingrequeststo send HTTP requests, but it doesn't support HTTP2 util 2023 and maybe util now.
Although there are some libraries which have already supported HTTP2,but it's hard for me to change dependencies,so i created
this project
to meet my demands.
And theurllib3whichrequestsrelies on is doing their effort to support HTTP2,but they needOpenSSL> 1.11,and anyone
who don't want to upgrade it still can use this library.
Package: requests-hardened
requests-hardenedis a library that overrides the default behaviors of therequestslibrary, and adds new security features.InstallationThe project is available onPyPI:pip install requests-hardenedFeaturesOverrides of DefaultsThis library allows to override some default values from therequestslibrary
that can have a security impact:Config.never_redirect = Falsealways reject HTTP redirectsConfig.default_timeout = (2, 10)sets the default timeout value when no value orNoneis passedConfig.user_agent_override = Noneoptional config to overrideUser-Agentheader. When set toNone,requestslibrary will set itsdefault user-agent.SSRF FiltersA SSRF IP filter can be used to reject HTTP(S) requests targeting private and loopback
IP addresses.Settings:Config.ip_filter_enablewhether or not to filter the IP addressesip_filter_allow_localhostwhether or not to allow loopback IP addressesExample Usagefromrequests_hardenedimportConfig,Manager# Creates a global "manager" that can be used to create ``requests.Session``# objects with hardening in place.DefaultManager=Manager(Config(default_timeout=(2,10),never_redirect=False,ip_filter_enable=True,ip_filter_allow_localhost=False,user_agent_override=None))# Sends an HTTP request without re-using ``requests.Session``:resp=DefaultManager.send_request("GET","https://example.com")print(resp)# Sends HTTP requests with reusable ``requests.Session``:withDefaultManager.get_session()assess:sess.request("GET","https://example.com")sess.request("POST","https://example.com",json={"foo":"bar"})
Package: requests-header-refresh
Requests Header RefreshDescriptionThis Python module provides a function to handle HTTP refresh headers in therequestslibrary. It parses the refresh header, extracts or infers the refresh time and URL, and makes a subsequent request to the refresh URL if the refresh time is in a valid range. It also supports a maximum refresh to ignore the refresh if the refresh time is greater than a specified number of seconds.InstallationYou can use this module by importing it in your Python script. Make sure to have therequests-header-refreshlibrary installed in your environment. If not, you can install it using pip:pipinstallrequests-header-refreshYou will also need therequestslibrary to use this package.UsageFirst, import the necessary functions and classes:importrequestsfromrequests_header_refreshimportcreate_hookThen, create a session and a refresh handler with a timeout of 5 seconds:session=requests.Session()refresh_hook=create_hook(max_refresh=5)Add the handler as a response hook:session.hooks={'response':[refresh_hook]}Finally, make a request:response=session.get(url)In this example,refresh_hookwill ignore the refresh if the refresh time is greater than 5 seconds. Replaceurlwith the actual URL you want to make a request to. Also, adjust themax_refreshbased on your needs.The hook could also be used for a single request instead of entire session:response=requests.get(url,hooks={'response':[refresh_hook]})ContributingContributions are welcome.
Package: requests_html2
requests_html2HTML Parsing for Humans
项目衍生自requests-html用法参考expample相比于requests-html有如下改进：async 请求改用httpx浏览器渲染改用playwright元素操作优化，对于元素查找find()、xpath()的返回结果，参照linq增加筛选select()、where()Installpip install requests-html2Quick Startfromrequests_html2importHTMLSessionwithHTMLSession()assession:response=session.get('https://python.org/')print(response.html)
Package: requests-html-macros
Requests-Html-Macrosis a little sugar on top of an already great html parseing libraryRequests-HtmlThis library aims to help make parsing the web a bit easier than it already is with Requests-Html!  Create macros that can be reused over different web sites/sessions!
Could you do this by hand with requests-html, yes probably pretty simply, but I only realized that liek half way through developing this library and then was just like screw it let’s push it out anyways!Examplefromtimeimportsleepfromrequests_html_macroimportMacrofromrequests_htmlimportHTMLSession# Create a standard requests-html sessionsession=HTMLSession()response=session.get('http://python.org')# Create a macro with the responsemacro=Macro(response=response)# Create a macro that uses the parse library to search through the html@macro.search_pattern('Python is a{}language',first=True)deffoo(data):print(data[0])# Creates a macro that uses a css selector@macro.css_selector('#about',first=True)deffoo1(data):print(data.text)@macro.xpath('//a',first=True)deffoo2(data):print(data)whileTrue:macro.parse()sleep(30)macro.response=session.get('http://python.org')To Install$ pip install requests-html-macro
Package: requests-http-message-signatures
requests-http-message-signatures: A Requests auth module for HTTP Signaturerequests-http-message-signaturesis aRequestsauthentication plugin(requests.auth.AuthBasesubclass) implementing theIETF HTTP Signatures draft RFC. It has no
required dependencies outside the standard library. If you wish to use algorithms other than HMAC (namely, RSA and
ECDSA algorithms specified in the RFC), there is an optional dependency oncryptography.Installation$ pip install requests-http-message-signaturesUsageimport requests
  from requests_http_signature import HTTPSignatureAuth
  
  preshared_key_id = 'squirrel'
  preshared_secret = 'monorail_cat'
  url = 'http://example.com/path'
  
  requests.get(url, auth=HTTPSignatureAuth(key=preshared_secret, key_id=preshared_key_id))By default, only theDateheader is signed (as per the RFC) for body-less requests such as GET. TheDateheader
is set if it is absent. In addition, for requests with bodies (such as POST), theDigestheader is set to the SHA256
of the request body and signed (an example of this appears in the RFC). To add other headers to the signature, pass an
array of header names in theheaderskeyword argument.In addition to signing messages in the client, the class methodHTTPSignatureAuth.verify()can be used to verify
incoming requests:def key_resolver(key_id, algorithm):
      return 'monorail_cat'

  HTTPSignatureAuth.verify(request, key_resolver=key_resolver)Asymmetric key algorithms (RSA and ECDSA)For asymmetric key algorithms, you should supply the private key as thekeyparameter to theHTTPSignatureAuth()constructor as bytes in the PEM format:with open('key.pem', 'rb') as fh:
      requests.get(url, auth=HTTPSignatureAuth(algorithm="rsa-sha256", key=fh.read(), key_id=preshared_key_id))When verifying, thekey_resolver()callback should provide the public key as bytes in the PEM format as well.LinksIETF HTTP Signatures draftProject home pagePackage distribution (PyPI)Based on requests-http-signatureBugsPlease report bugs, issues, feature requests, etc. on ourissue tracker.LicenseLicensed under the terms of theApache License, Version 2.0.
Package: requests-http-signature-jaywink
requests-http-signatureis aRequestsauthentication plugin(requests.auth.AuthBasesubclass) implementing
theIETF HTTP Signatures draft RFC. It has no required
dependencies outside the standard library. If you wish to use algorithms other than HMAC (namely, RSA and ECDSA algorithms
specified in the RFC), there is an optional dependency oncryptography.Installation$ pip install requests-http-signatureUsageimportrequestsfromrequests_http_signatureimportHTTPSignatureAuthpreshared_key_id='squirrel'preshared_secret='monorail_cat'url='http://example.com/path'requests.get(url,auth=HTTPSignatureAuth(key=preshared_secret,key_id=preshared_key_id))By default, only theDateheader is signed (as per the RFC) for body-less requests such as GET. TheDateheader
is set if it is absent. In addition, for requests with bodies (such as POST), theDigestheader is set to the SHA256
of the request body and signed (an example of this appears in the RFC). To add other headers to the signature, pass an
array of header names in theheaderkeyword argument.In addition to signing messages in the client, the class methodHTTPSignatureAuth.verify()can be used to verify
incoming requests:defkey_resolver(key_id,algorithm):return'monorail_cat'HTTPSignatureAuth.verify(request,key_resolver=key_resolver)Asymmetric key algorithms (RSA and ECDSA)For asymmetric key algorithms, you should supply the private key as thekeyparameter to theHTTPSignatureAuth()constructor as bytes in the PEM format:withopen('key.pem','rb')asfh:requests.get(url,auth=HTTPSignatureAuth(algorithm="rsa-sha256",key=fh.read(),key_id=preshared_key_id))When verifying, thekey_resolver()callback should provide the public key as bytes in the PEM format as well:LinksIETF HTTP Signatures drafthttps://github.com/joyent/node-http-signatureProject home page (GitHub)Documentation (Read the Docs)Package distribution (PyPI)Change logBugsPlease report bugs, issues, feature requests, etc. onGitHub.LicenseLicensed under the terms of theApache License, Version 2.0.
Package: requests-httpsproxy
==============requests-httpsproxy==============allow http/https requests through `HTTPS Proxy<https://www.chromium.org/developers/design-documents/secure-web-proxy>`_.Requirements------------* requests >= 2.13.0* PyOpenSSL >= 0.11* tlslite-ngUsage-----.. code:: pythonimport requestsimport requests_httpsproxyhttps_proxy = 'https://username:password@phus.lu'sess = requests.Session()print (sess.get('https://httpbin.org/ip', proxies={'http':https_proxy, 'https':https_proxy}).text)License-------MITRelated issues-------- https://github.com/kennethreitz/requests/issues/1182- https://github.com/kennethreitz/requests/issues/1622- https://github.com/kennethreitz/requests/issues/1903- https://github.com/kennethreitz/requests/issues/3468- https://github.com/kennethreitz/requests/issues/3806- https://github.com/kennethreitz/requests/issues/3882
Package: requests-hustauth
HustAuthThis project provides HustPass support forRequestsVariation ofHustLoginInstallationpip install requests-hustauthDependency(automatically handled by PIP)Requests
Pillow
numpy
pycryptodome
fake_useragentUsageexample.pyimportrequestsfromrequests_hustauthimportHustAuthsession=requests.Session()hust_auth=HustAuth('USERID','PASSWORD')resp=session.get('http://m.hust.edu.cn/wechat/apps_center.jsp',auth=hust_auth)print(resp.text)
Package: requests-iamauth
Requests IAMAuthUse AWS SigV4 authorization with requests.Accessing an API secured with IAM authorization in AWS API Gateway can be tricky.This tool uses the built-in authorization strategy inrequeststo help you access your secured endpoints.Installationpipinstallrequests-iamauthUsageSigning Version 4AWSsigv4is the current standard for signing requests bound for AWS services.Userequests-iamauthto as an authorizer for therequestsPython library:importrequestsfromiamauthimportSigv4Authsigv4=Sigv4Auth(service_name="execute-api",# default)session=requests.Session()session.auth=sigv4session.get('https://abcdef0123.execute-api.us-east-2.amazonaws.com/my/api')Override the default boto3 session by passing a custom one into the constructor forSigv4Auth:importboto3sigv4=Sigv4Auth(boto3_session=boto3.Session(),)Signing Version 4aAWSsigv4ais an extension to the sigv4 signing process that enables signing requests bound for more than one region.Note — at the time of this writing, the only API Gateway API type that appears to support sigv4 are REST APIs.Userequests-iamauthto as an authorizer for therequestsPython library:importrequestsfromiamauthimportSigv4aAuthsigv4a=Sigv4aAuth(service="execute-api",# defaultregion="*",# default)session=requests.Session()session.auth=sigv4asession.get('https://abcdef0123.execute-api.us-east-2.amazonaws.com/my/api')Override the default AWS credentials provider by passing a custom one into the constructor forSigv4aAuth:frombotocore.compatimportawscrtsigv4a=Sigv4aAuth(credentials_provider=awscrt.auth.AwsCredentialsProvider.new_default_chain(),)
Package: requests-iam-session
requests-iam-sessionAWSSession class that extendsBaseUrlSessionfromrequestsand automatically authenticates through IAM.Installationpoetry add requests-iam-sessionUsage examplefromrequests_iam_sessionimportAWSSessionsession=AWSSession("https://example.com/")response=session.get("/users/1")print(response.json())
Package: request-signer
Request SignerCreates and validates signed requests between backend systems.Requires aSIGNED_REQUEST_API_KEYto be defined in your project's settings.UsageRequest signer usesrequeststo make requests, by appending api calls with aX-SignedRequest-Signatureheader.There are working examples in the project'sdjango_exampleandflask_exampledirectories on how to make requests.Notes:You can pass a company_id and/or user_id to the consuming view which will be available in the view asrequest.rs_company_idandrequest.rs_user_id.Views protected by request_signer are assumed to be ADMIN level views and will NOT filter by company
or user unless specifically provided.  It is up to the requestor to make sure they are not asking
for data that those viewing the response should not be allowed to see.DjangoSigning a requestfrom request_signer.django_utils import signed_request

# GET
signed_request.get('https://localhost:8000')


# POST/PATCH

"""
The request_signer wrapper will jsonify your data object and set the Content-Type to 'application/json'.
"""

data = {'a': 'b'}
signed_request.post('https://localhost:8000', data)
signed_request.patch('https://localhost:8000', data)Requiring signaturesfrom rest_framework.views import APIView
from request_signer.django_utils.permissions import APISignature

class SigntureRequiredView(APIView):

    permission_classes = [APISignature]FlaskDue to the pain of managing app and request contexts, you have to pass the signing key into the request in the Flask library.api_keymustbe passed as a keyword argument.Signing a requestfrom request_signer.flask_utils import signed_request

api_key = app.config['SIGNED_REQUEST_API_KEY']

# GET
signed_request.get('https://localhost:8000', api_key=api_key)


# POST/PATCH

"""
The request_signer wrapper will jsonify your data object and set the Content-Type to 'application/json'.
"""

data = {'a': 'b'}
signed_request.post('https://localhost:8000', data, api_key=api_key)
signed_request.patch('https://localhost:8000', data, api_key=api_key)Requiring signaturesSeems to be safest if you place the decorator closest to the method definition.from request_signer.flask_utils.permissions import signature_required

class SigntureRequiredView(BaseView):

    @signature_required
    def get(self, request):
        return 'Good Job'Buildingpip install --upgrade buildpython3 -m buildTaggingUpdate tag whenever semver changes.git tag -a v1.4 -m "cool message"Tags don't automatically get pushed; push them up like a normal commit.git push origin v1.4
Package: requests-jwt
This package is not actively maintained and has never had a security audit.requests-jwtThis package allows for HTTP authentication usingJSON Web Tokens.UsageJWTAuthextends requestsAuthBase, so usage is simple:importrequestsfromrequests_jwtimportJWTAuthauth=JWTAuth('secretT0Ken')requests.get("http://jwt-protected.com",auth=auth)More documentation is available atRead the Docs.Installationpip install requests_jwtRequirementsrequestsPyJWT
Package: requests-jwtauth
requests-jwtauthAuthenticator plugins forRequeststhat support JWT bearer tokens.DescriptionThis package contains two classes,HTTPBearerAuthandJWTSecretAuth,
that implement theAuthBaseinterface from theRequestspackage. TheHTTPBearerAuthclass takes a single bearer token value at initialization,
and adds that to anAuthorization: Bearerheader. TheJWTSecretAuthclass takes a shared secret, and uses that to generate and
sign short-livedJWTtokens to be added to anAuthorization: Bearerrequest header. By default, these tokens are valid for 1 hour (3600
seconds), and may contain arbitraryJWT claimsin their payload.DependenciesPython 3.8+RequestsJWCryptoInstallationpipinstallrequests-jwtauthUsageHTTPBearerAuthimportrequestsfromrequests_jwtauthimportHTTPBearerAuth# send a request with a pre-obtained bearer tokenmy_token='...'r=requests.get('http://example.com',auth=HTTPBearerAuth(my_token))JWTSecretAuthimportrequestsfromrequests_jwtauthimportJWTSecretAuth# use a shared secret to generate (and automatically regenerate)# short-lived JWT bearer tokenssecret_auth=JWTSecretAuth(# shared secret with the service that requires authenticationsecret='...',# JWT claims to place in the token payload# this class takes care of providing the 'exp' (expiration time) keyclaims={'sub':'...'},# Time-To-Live, in seconds; default is 3600 (i.e., 1 hour)ttl=3600,# instead of waiting for it to actually expire,# renew the token whenever the remaining time-to-live is# less than this number of seconds; default is 60expiration_buffer=60,# signing algorithm to use; defaults to H256signing_algorithm='H256')r=requests.get('http://example.com',auth=secret_auth)Development Setupgitclonegit@github.com:umd-lib/requests-jwtauth.gitcdrequests-jwtauth
pyenvinstall$(cat.python-version)--skip-existing
python-mvenv.venv--prompt"requests-jwtauth-py$(cat.python-version)"source.venv/bin/activate
pipinstall-e.[test]TestingUsingpytest:pytestWithtest coverageinformation:pytest--cov-report=term-missing--covsrc
Package: requests-limiter
requests-limiterRate limiting made easy.Have fun using third-parties REST APIs without have to worry about rate limiting.Download$ pip install requests-limiterExampleTake a look into theexamplethat creates a simple rate limiter for the Riot APISummonerV4endpoints.To-doMake the library thread-safeWrite the logic in C/C++ in order to support more languages with the same codebaseCreate a utility module
Package: requests-llnw-auth
requests-llnw-authThis module provides an authentication plugin for Requests to generate the X-LLNW-Security-* request headers required by Limelight Networks APIs.Getting StartedFirstly, install the package:pip install requests-llnw-authThen in your Python script, create anLLNWAuthobject, using your Limelight Control username and API key, and pass it to arequestsfunction using theauthkeyword attribute.importrequestsfromrequests_llnw_authimportLLNWAuthllnw_auth=LLNWAuth('username','api_key')shortname='yourshortname'res=requests.get(f'https://apis.llnw.com/config-api/v1/svcinst/delivery/shortname/{shortname}',auth=llnw_auth)
Package: requests_logger
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description: This package is a wrapper around Requests to log http requests in a human readable format.
Keywords: requests,logging,request,log,logger
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.5
Package: requestsloginsession
RequestsLoginSessionrequestsloginsessionis a simple wrapper forrequests.Session()that saves the data locally via pickle to allow session information to be recalled on subsequent script runs without needing to relogin. All the attributes fromrequestsare available.InstallFrom PyPi:pip install requestsloginsessionOr use the latest commit:git clone https://github.com/damonjavert/requestsloginsession.git
cd requestsloginsession
python setup.py installFeaturesSaves cookie data to a local file viapickleand uses it to send cookie data in subsequent requests.Cookie data saved has an expiry time -max_session_time_seconds, after whichrequestsloginsessionwill not send it, or you can force it not to be used withforce_login.Login success can be tested with a specific URL -login_test_urland string -login_test_stringto be found on the page.A proxy can be used.Customisableuser_agentstring.Example usage>>>fromrequestsloginsessionimportRequestsLoginSession>>>login_url="http://httpbingo.org/">>>login_data={'username':'example','password':'example'}>>>mysession=RequestsLoginSession(login_url,login_data)>>>r=mysession.retrieve_content("http://httpbingo.org/cookies/set?k1=v1234&k2=v5678")>>>$filehttpbingo.org_session.dathttpbingo.org_session.dat:data$# We have now exited python, when we start a new interpreter we can request httpbingo$# to show our cookies and the `k1=v1234&k2=v5678` data will now be shown:$python3>>>fromrequestsloginsessionimportRequestsLoginSession>>>login_url="http://httpbingo.org/">>>login_data={'username':'example','password':'example'}>>>mysession=RequestsLoginSession(login_url,login_data)>>>r=mysession.retrieve_content("http://httpbingo.org/cookies")>>>r.json(){'k1':'v1234','k2':'v5678'}>>>r.status_code200>>>r.text'{\n"k1": "v1234",\n"k2": "v5678"\n}\n'FAQWhy not just userequests.Session()directly?Of course you can do, but this module makes life easier by handling the cookie data for you and allowing the cookie data to survive multiple runs of your script, so you do not need to relogin each time.I have an API key for the site I am requesting, do I still need to use this?No, you probably do not. This module is designed to access sites where you need to authenticate before you can access it. Any modern API does not need this and you send an API key in each request. - If you have an API key you can just userequestsdirectly.
Package: requests-magpie
requests Magpie authentication libraryRequests is an HTTP library, written in Python, for human beings. This library
adds optional Magpie authentication support. Basic GET usage:importrequestsfromrequests_magpieimportMagpieAuthauth=MagpieAuth("https://www.example.com/magpie","username","password")r=requests.get("https://www.example.com/protected",auth=auth)The entirerequests.apishould be supported.History0.2.0Add parameter to provide extra request keyword arguments as needed for performing the authentication request.Add parameter to cache result from authentication request to avoid performing the opeartion each time.0.1.1Initial Release