Saravanan666/pypi-org huggingface dataset:
Package: request2postman
request2postmanSmall lib that allows you to automatically
generate postman collections out of python requests libUsing requests hooksfromrequest2postmanimportCollection,request_to_postman_hookfromrequestsimportSessioncollection=Collection("some_name")withSession()assession:session.hooks["response"].append(request_to_postman_hook(collection))session.get("https://httpbin.org/basic-auth/user/pass")session.post("https://httpbin.org/basic-auth/user/pass",json={"key":"value"})withopen("collection.json","w")asfile:file.write(collection.json)Using Request object directlyfromrequest2postmanimportCollectionimportrequestsresp1=requests.get("https://httpbin.org/basic-auth/user/pass")resp2=requests.post("https://httpbin.org/basic-auth/user/pass",json={"key":"value"})collection=Collection("some_name")collection.add_request(resp1.request,name="request1")collection.add_request(resp2.request)withopen("collection.json","w")asfile:file.write(collection.json)Result{"info":{"_postman_id":"6fde81f7-6cb8-4cde-bf89-a2b476ed794f","name":"some_name","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"event":[],"variable":[],"item":[{"id":"79731ba3-25e5-4149-a975-20c4e7929728","name":"request1","response":[],"event":[],"request":{"url":{"raw":"https://httpbin.org/basic-auth/user/pass","protocol":"https","path":["basic-auth","user","pass"],"host":["httpbin","org"],"query":[],"variable":[]},"header":[],"method":"GET"}},{"id":"0a75dc4e-16ef-468e-a903-412832fd5749","name":"/basic-auth/user/pass","response":[],"event":[],"request":{"url":{"raw":"https://httpbin.org/basic-auth/user/pass","protocol":"https","path":["basic-auth","user","pass"],"host":["httpbin","org"],"query":[],"variable":[]},"header":[{"key":"Content-Length","value":"16"},{"key":"Content-Type","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"{\"key\": \"value\"}"}}}]}You can skip some headers to avoid posting Authorization headers or any other private headers with othersfromrequest2postmanimportCollectionimportrequestscollection=Collection("some_name",skip_headers=["Authorization"])resp1=requests.get("https://httpbin.org/basic-auth/user/pass")resp2=requests.post("https://httpbin.org/basic-auth/user/pass",json={"key":"value"})collection.add_request(resp1.request)collection.add_request(resp2.request)withopen("collection.json","w")asfile:file.write(collection.json)
Package: requestbugmaker
一、安装（python版本建议3.7以上）pipinstalldubborequests二、升级包pipinstall--upgradedubborequests三、示例获取dubbo服务详情# 导入importdubborequests# 获取dubbo服务详情data=dubborequests.search('cn.com.xxx.sso.ehr.api.dubbo.SsoEmpInfoService')获取服务下的所有方法# 导入importdubborequests# 获取dubbo服务下的所有方法data=dubborequests.list('cn.com.xxx.sso.ehr.api.dubbo.SsoEmpInfoService')# 获取dubbo服务指定的方法data=dubborequests.list('cn.com.xxx.sso.ehr.api.dubbo.SsoEmpInfoService','login')通过zookeeper获取服务的ip和端口, Telnet命令测试dubbo接口importdubborequestsfromdubborequestsimportConfig# 先配置zookeeper中心地址Config.zookeeper_url_list=['192.168.240.15:2181','192.168.240.15:2182','192.168.240.15:2183']invoke_data={"service_name":"cn.com.xxxxx.sso.ehr.api.dubbo.SsoEmpInfoService","method_name":"login","data":{"account":"xxxx","password":"xxxx"}}# 通过zookeeper获取服务的ip和端口, Telnet命令测试dubbo接口data=dubborequests.zk_invoke(*invoke_data)Telnet命令测试dubbo接口importdubborequestsinvoke_data={"ip":'xxxx',"port":7777,"service_name":"cn.com.xxxxx.sso.ehr.api.dubbo.SsoEmpInfoService","method_name":"login","data":{"account":"xxxx","password":"xxxx"}}# Telnet命令测试dubbo接口data=dubborequests.telnet_invoke(*invoke_data)
Package: requestChecker
Flask module allowing to configure and centralize the authorizations on
the routes.Exemplefrom flask import Flask
from flask_restful import Api, Resource
from RequestChecker import RequestChecker, Path, SecurityPolicyEnum, MethodsEnum

app = Flask("test")
api = Api(app)

requestChecker = RequestChecker(api)

def LoginResource(Resource):
    def post(self):
        pass

def TestResource(Resource):
    def get(self):
        pass

    def post(self):
        pass

pathLogin = Path('/login', policy=SecurityPolicyEnum.ANNONYMOUS, methods=[MethodsEnum.POST])
pathTest = Path('/test', policy=SecurityPolicyEnum.JWT, methods=[MethodsEnum.GET, MethodsEnum.POST])

requestChecker.addPath(pathTest, TestResource)
requestChecker.addPath(pathLogin, LoginResource)DependenciesFlaskflask_jwt_extendedwerkzeugFlask-Restful
Package: request-content-type-finder
request_content_type_finderFinds type of requests content in the following cases -content disposition and content type present in response headerswhen none of the above is present, content type is found using file signatures(magic bytes)Installationpipinstallrequest-content-type-finderUsagefromrequest_content_type_finderimportfindfind(requests_response)ContributorsNameContactShivam Kadukarshivamk2802@gmail.com
Package: request_context_manager
Request Context ManagerPurpose of Request ContextWhen application begins handling request, request context manager create a request context. Within request context, you could access the attributes bound with the context. If you try to access attributes outside the context, OutsideContext exception will be raised.How to Create Request Context Managerfromrequest_context_managerimportRequestContextManagerfromrequest_context_managerimportRequestContextAttr# create request context manageryour_request_context_manager=RequestContextManager('your_request_context_manager_name')# bind request context attributeclassYourRequestContextAttr:_request_context_manager=your_request_context_manageryour_attr=RequestContextAttr('your_attr_name',_request_context_manager)# get/set request context attribute within request contextwithyour_request_context_manager.under_request_context():YourRequestContextAttr.your_attr.set("hello world")your_attr_value=YourRequestContextAttr.your_attr.get()# "hello world"
Package: request-counter
Django-request-counterInstall this app to get django api request countInstallationInstall my-project with pippipinstallrequest-counterIn settings.py add below
Add the app in installed appsINSTALLED_APPS = [
    ...
    "request_counter",
]Add middlewareMIDDLEWARE = [
    ...
    "request_counter.middlewares.APICounterMiddleware",
]To check using API Addurlpartterns = [
    ...
    path("",include("request_counter.urls")),
]Set environment variable in settings.py file# set up redis ur;
# REDIS_URL = "redis://localhost:6379/7" # by default when not set
REDIS_URL = "<your redis url path>"

# api path that starts with that needs monitoring
RC_API_START_PATH = "/api/" # by default set "" for monitoring all path default /api/ when not set 
RC_API_START_PATH = "<your starting path>"

# database where you want to store the result after running script
# RC_DATABASE = "default" # by default it is set as default database when not set
RC_DATABASE = "<your desired database>"

# when saving on 1 database but have many environment
RC_ENVIRONMENT = "" # add prefix on your database path to identify
RC_ENVIRONMENT = "<your environment>"

RC_REDIS_EXPIRE_SECONDS = 86400 # redis key ttl expiry secondsYou need to setup cron to periodically save the data into default databasepython manage.py store_api_countNow make api request with admin usercurl --location '<base-url>/api-count/' \
--header '<your authentication header>'

curl --location '<base-url>/api-count/redis' \
--header '<your authentication header>'
Package: requester
# Requester[![PyPI version](https://badge.fury.io/py/requester.svg)](https://github.com/kssim/requester)[![Build Status](https://travis-ci.org/kssim/requester.svg?branch=master)](https://github.com/kssim/requester)[![codecov](https://codecov.io/gh/kssim/requester/branch/master/graph/badge.svg)](https://github.com/kssim/requester)[![Code Health](https://landscape.io/github/kssim/requester/master/landscape.svg?style=flat)](https://github.com/kssim/requester)[![Python](https://img.shields.io/badge/python-2.7-brightgreen.svg?style=flat)](https://github.com/kssim/requester)[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/kssim/requester)Requester is a python based HTTP / HTTPS request simulator.Basically, you create a request statement, send the request as it is, and check the response.In addition, it extracts the request from the pcap file, or sends the extracted request and compares the response with the response of the pcap file.# InstallationTo install Requester, simply:```bash$ pip install requester```# Usage* Basic Argument Description```bash$ requesterUsage: requesterOptions:-h, --help            show this help message and exit--port=PORT           port name(default 80)--host=HOST           host name or ip address-f FILE, --file=FILE  request file name(include full path)--pcap=PCAP           packet dump file name(include full path)-e, --extraction      Extract http request from packet dump file.-c, --check           Send an http request in the packet dump and comparethe response.```* Simple Usage without request file.```bash$ requester --host [website] --port [port]```* Simple usage with request file.```bash$ requester --host [website] --port [port] --file [request file full path]```* Extract request file from packet dump.```bash$ requester -e --pcap [pcap file full path]```* Sends the contents extracted from the request file in the packet dump and compares the response.```bash$ requester -c --pcap [pcap file full path]```# DocumentationI'll be writing soon.# ContributeIf you have an idea or issue, feel free to open an issue or make pull request.I'll create and share a structured process to contribute soon.
Package: request_factory
# request_factory client[![Build Status](https://travis-ci.org/tinyclues/request_factory.svg?branch=master)](https://travis-ci.org/tinyclues/request_factory) [![Coverage Status](https://coveralls.io/repos/github/tinyclues/request_factory/badge.svg?branch=delete_package)](https://coveralls.io/github/tinyclues/request_factory?branch=delete_package)This is for simplify the request management.Actually support :* http## Contributing to request_factory clientAll contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome.### Working with the codeNow that you have an issue you want to fix, enhancement to add, or documentation to improve, you need to learn how to work with GitHub.We use the [Github Flow](https://guides.github.com/introduction/flow/)Finally, commit your changes to your local repository with an explanatory message, request_factory client uses a convention for commit message prefixes.Here are some common prefixes along with general guidelines for when to use them:* ENH: Enhancement, new functionality* BUG: Bug fix* DOC: Additions/updates to documentation* TST: Additions/updates to tests* BLD: Updates to the build process/scripts* PERF: Performance improvement* CLN: Code cleanup* NOBUILD: special tag to skip test & build
Package: request-filter-groups
Request Filter GroupsDescriptionA Python wrapper and utility function for validating requests.The funtions takes a list of dictionaries containing JSON paths keys to search for the attribute to validate and filter rule values to validate the attributes with. Under the hood, the validation process usesValidatorto validate the JSON path values with the Validator rules. If atleast one filter group is validated, then the funcion returns True. List of possible Validator rules can be foundhere:ExamplesDecorator:Succeeded Validationr = RequestFilter()

@r.request_filter_groups([
    {
        "A.B": "regex:foo",
        "C": "required|min:3"
    }
])
def func(data):
    # <response logic>
    return {"statusCode": 200}

request_data = {
    "A": {"B": "foo"},
    "C": [1, 2, 3]
},

response = func(data)Returns dummyfunc()return value:{"statusCode": 200}Failed Validationr = RequestFilter()

@r.request_filter_groups([
    {
        "A.B": "regex:foo",
        "C": "required|min:10"
    }
])
def func(data):
    # <response logic>
    return {"statusCode": 200}

request_data = {
    "A": {"B": "foo"},
    "C": [1, 2, 3]
},

response = func(data)Returnsvalidate()return value{'statusCode': 422, 'body': ValidationError({'C': {'Min': 'Expected Maximum: 10, Got: 3'}})}InstallationPackage can be found onPyPIpip install request-filter-groupsTODO:Add Flask-related tests
Package: request-handler
Status code handlerLibrary for handler GET requests
comparing their status code.Installation$pip3installrequest_handlerGet startedHow to compare the status code to know
if continue or stop.fromrequest_handlerimportRequestHandlerif__name__=='__main__':handler=RequestHandler('https://catfact.ninja/fact')handler_jsoned=handler.check_json_response()ifhandler_jsoned:print(handler_jsoned)else:print("[-] Exiting...")exit(1)
Package: request-id-django-log
Request ID Django LogInstallpip install request-id-django-logUpdate yourINSTALLED_APPSandMIDDLEWAREINSTALLED_APPS=[..."request_id_django_log",]MIDDLEWARE=[..."request_id_django_log.middleware.RequestIdDjangoLog",]ConfigureThe following options are used by this library:REQUEST_ID_CONFIG={"REQUEST_ID_HEADER":"HTTP_X_REQUEST_ID","GENERATE_REQUEST_ID_IF_NOT_FOUND":True,"RESPONSE_HEADER_REQUEST_ID":"HTTP_X_REQUEST_ID",}REQUEST_ID_HEADERis the header name which will hold the received request_id. This must be used when another system is responsible for generating the request_ids and sending them to your django application.GENERATE_REQUEST_ID_IF_NOT_FOUNDIf set to true, a new request_id will be generated if none was previously supplied.RESPONSE_HEADER_REQUEST_IDsets the name of the response header which will hold the value of the request_id.With this configuration if the request have the headerX-REQUEST-IDthe library will use this header value.LogsIf you want your logs to have the request id, add the following lines to your logging dictionary configuration:LOGGING={..."filters":{"request_id":{"()":"request_id_django_log.filters.RequestIDFilter"}},"formatters":{"standard":{..."format":"%(levelname)-8s[%(asctime)s] [%(request_id)s]%(name)s:%(message)s",},...},"handlers":{"console":{..."filters":["request_id"],...}},"loggers":{"":{"level":"INFO","handlers":["console"]},...},}Supported Versionspython 2.7with Django1.8,1.9and1.11python 3.5,3.6and3.7with Django1.8,1.9,1.11,2.0,2.1,2.2and3.0
Package: request-id-flask
request-id-flaskAttach a unique identifier to every HTTP request in your WSGI application.request-id-flaskis implemented as a WSGI middleware.The package will do one of two things:Read theX-Request-IDHTTP header from a client HTTP request and return thesameX-Request-IDHTTP header in the server HTTP response and is stored in the WSGIenviron.Or, when noX-Request-IDHTTP header is present in the client HTTP request, generate a new and uniquerequest_ididentifier (using uuid 4) which is stored in the WSGIenvironand set as theX-Request-IDHTTP header in the server HTTP responser.RequirementsPython 3.6 or aboveInstallationYou can install the request-id-flask package using pip:pipinstallflask-ext-request-idHowever, recommended to add it to therequirements.txtfile instead.Access the request_idTheREQUEST_IDis stored in the requestenvirondictionary and may be accessed from anywhere this is available in Flask.Usagefromflaskimport(Flask,request)fromrequest_idimportRequestIdapp=Flask(__name__)RequestId(app)@app.route('/')defindex():request_id=request.environ.get('REQUEST_ID','')returnstr(request_id)
Package: requestions
# RequestionsRequestions is a serialization library for [Requests](https://github.com/kennethreitz/requests) using JSON. Also, requestions includes a decorator called httpetrified for storing responses and replaying them in the future for HTTP testing without the live interwebz.## InstallingSimple.``` bashsudo pip install requestions```or,``` bashsudo python setup.py install```## Usage``` python# responsesoriginal_response = requests.get("http://httpbin.org/get")serialized_response = requestions.write_response(original_response)response = requestions.read_response(serialized_response)# requestsoriginal_request = requests.models.Request(url="http://httpbin.org/post", method="POST")serialized_request = requestions.write_request(original_request)request = requestions.read_request(serialized_request)```## DecoratorSave responses in a json file, then use them later to make unit testing not so miserable.``` pythonimport jsonimport requestsfrom requestions import httpetrifieddef get_current_ip_address(self):"Abuses some poor sap's ip address detection service."response = requests.get("http://jsonip.com")return response.json()["ip"]@httpetrified("samples/helpers/jsonip-request.json")def test_get_current_ip_address(self):self.assertEqual("127.0.0.1", get_current_ip_address())```## Changelog* 0.0.7 - fix CaseInsensitiveDict problem* 0.0.5 - fix broken setup.py, gah* 0.0.4 - fix test for both requests==0.14.2 and requests>=1.0.3* 0.0.3 - httpetrified decorator* 0.0.1 - initial commit## Alternatives* [requests-vcr](https://github.com/sigmavirus24/requests-vcr)## LicenseBSD.
Package: request-lifecycle
OVERVIEW该工程是 Python 版本的 request-lifecycle，用于收集请求过程中的日志USAGE在 Flask 中在请求生命周期的两段嵌入如下代码。在嵌入 before_request 后，可以通过 g.trace_id 获取请求的 ID。fromflaskimportFlaskfromrequest_lifecycleimportRequestLifecycleMiddlewareapp=Flask(__name__)@app.before_requestdefbefore_request():"""在这里放入一个配置好 log-server 的前置中间件"""RequestLifecycleMiddleware.before_request(host='127.0.0.1',port='3000',app_name='whatever',additional_req_fields=[])@app.after_requestdefafter_request(response:Flask.response_class):"""在这里放入一个捕捉 response 的中间件"""additional_message={'adminTraceId':'traceId'}RequestLifecycleMiddleware.after_request(response=response,additional_log_message=additional_message)returnresponse
Package: request_limiter
Request LimiterRequest limiter contains a decorator to limit the rate of http requestFree software: MIT licenseDocumentation:https://request-limiter.readthedocs.io.FeaturesA decorator to limit django http requestA strategy to limit request per interval using requester IPGet startedInstallation:$pipinstallrequest_limiterLimit request to django view using a decorator:fromrequest_limiterimportrequest_limiter,LimitedIntervalStrategy,django_request_limiter@django_request_limiter@request_limiter(strategy=LimitedIntervalStrategy(requests=10,interval=60))# 10 request per minutedefmyview(request):# ...Limit the number of request to function or part of it:fromrequest_limiterimportrequest_limiter,LimitedIntervalStrategy,LimitException@request_limiter(strategy=LimitedIntervalStrategy(requests=1,interval=60))# 1 request per minutedefawesome_work(param):# ...awesome_work("test")try:awesome_work("limited")# raises LimitExceptionexceptLimitException:# .. handle limit exceptionlimiter=LimitedIntervalStrategy(requests=1,interval=60))# 1 request per minutedefanother_work(param):ifnotlimiter.allow():returnFalse# ...returnTrueanother_work("job1")# returns Trueanother_work("job2")# returns FalseCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.1 (2020-01-14)First release on PyPI.
Package: request-log-info
request_log_infoInstalling$pipinstallrequest-log-infoThen addrequest_log.middleware.LoggingMiddlewareto yourMIDDLEWARE.For example:MIDDLEWARE=(...,'request_log.middleware.LoggingMiddleware',...,)And configure logging in your app:LOGGING={'version':1,'disable_existing_loggers':False,'formatters':{'request':{'format':'%(type)s'+'[%(asctime)s]'+' ip:%(ip)s,'+' url:%(path)s,'+' method:%(method)s, '+'%(data)s'},},'handlers':{'info':{'class':'request_log.utils.RequestRotatingFileLogger','formatter':'request'},},'loggers':{'request':{'level':'DEBUG',# change debug level as appropiate'handlers':['info'],'propagate':False,},},}
Package: request-manager-attenuare
Goal 🎯Project Request Manager🚀This project has the primary goal of manage requisitions to a specific endpoint and treat different errors from the lib requests.
The class will try a couple of times until the result is the wanted response or it hits the maximum number of triesUsed technologies 💻* Requests
* PythonInstallation ⚙To run the project, follow the next stepsIntall virtualenvpipinstallvirtualenvCreate a virtual enviromentvirtualenvvenvEnter the virtual enviromentvenv/Scripts/activateImplementing the classImport the class to your project and add it as a super class or create a object from the classfrom request_manager.manager import RequestManager

class my_class(RequestManager):
    def __init__(self):
        super(my_class, self).__init__()from request_manager.manager import RequestManager

object = RequestManager()
object.send_requisitons_request()Files StructureLibrarys📚requestClass used to make requests using the urllib as a basic manager
Package: request-mapper
Python request mapperMap and validate incoming request data to Pydantic models. Request-mapper is framework agnostic with first-party
support for Flask.Examples# Add this in your app initialization code.setup_mapper(integration=FlaskIntegration(# Automatically decorate views to avoid adding @map_request to every view.# Will not incur any performance overhead for views that don't use request-mapper.# If map_views is enabled, setup_mapper must be called after# all views have been registered!map_views=True,# Register an error handler that returns 422 alongside pydantic validation errors# when the request cannot be mapped.add_error_handler=True,))# Define models using Pydantic v1 or v2.classPostCreateRequest(BaseModel):title:strcontent:strclassPostFilterQuery(BaseModel):status:PostStatus|None=None@app.get("/posts")# Map data from the current request.defpost_list_all(query:FromQueryString[PostFilterQuery])->PaginatedResponse[Post]:# "query" is a valid pydantic model at this point.returnPaginatedResponse(...)@app.post("/posts")defpost_create(body:FromRequestBody[PostCreateRequest])->PostCreateResponse:# "body" is a valid pydantic model at this point.returnPostCreateResponse(...)Quickstartpip install request-mapper.In your application setup, callmapper.setup_mapperwith the integration of your choice.Decorate targets with@map_request(Optional when using flask integration)Map request data using one of the provided annotated typesFromQueryString[T]orAnnotated[T, QueryStringMapping()]FromRequestBody[T]orAnnotated[T, RequestBodyMapping()]FromFormData[T]orAnnotated[T, FormDataMapping()]IntegrationsFlaskPull data from flask's request args, json and form data.Optional: Automatically map views without having to decorate them.Views which do not use request mapper will not incur any performance penalty.When using this feature the call tosetup_mappermust be AFTER all views are registered.Optional: Set up an error handler for validation errors which makes the api respond with a 422.Custom integrationsYou can create your own integration by inheritingBaseIntegrationand supplying an instance of that
to thesetup_mappercall.Note that you must decorate your views with@map_request
Package: request-miner
Request MinerA tool that enables you to automatically request and retry failing requests for a certain amount of times.
This tool is built on top of:requestsandbackoff, which this package relies on.Installationpipinstallrequest-minerUsageTo create a request without passing a session:fromrequest_minerimportminefromrequests.exceptionsimportRequestExceptionget_req=mine(method="GET",url="https://www.google.com")post_req=mine(method="POST",url="https://www.google.com",json={"key":"value"},backoff_type="expo",# default is constant, but you can override with existing backoff functions or your ownmax_tries=3,# max tries of a single requestmax_time=10,# max time of a requestexception=RequestException,# exception types that can be handledraise_on_giveup=True# if you want to raise the exception on giveup)# This request will failTo create a prepared request with a session:importrequestsfromrequestsimportRequest,Sessionfromrequest_minerimportprocess_requestfromrequests.exceptionsimportRequestExceptionsession=requests.Session()get_req=Request(method="GET",url="https://www.google.com").prepare()process_request(get_req,session,backoff_type="expo",# default is constant, but you can override with existing backoff functions or your ownmax_tries=3,# max tries of a single requestmax_time=10,# max time of a requestexception=RequestException,# exception types that can be handledraise_on_giveup=True# if you want to raise the exception on giveup)