Saravanan666/pypi-org huggingface dataset:
Package: httpSocketGateway
Gateway Server or ClientThis is client and server code for a gateway between internal and external network. That's to provide a way to communicate between the inside and the outside of network environment.Usageuse README.md from githubGatewayRceivehttp requestwith json andsend json with http propertiesto the client andwait response in jsonfrom client.WSClientmodify process_message methodto handle, process and respond to the message received from the gateway.You can also send json without modification to communicate with any other server (ws server) with thesimpleparameter.ExampleClientSend a request# Exemple of usefromhttpSocketGatewayimportWSClientimporttimeclassCustomWSClient(WSClient):# Override the process_message methoddefprocess_message(self,message):print("You receive",message)client=CustomWSClient('localhost',8080,reconnect=True,simple=True)client.run()time.sleep(1)client.send({"Hello":"World"})time.sleep(30)client.stop()Receive a requestYou should override theprocess_messagemethod fromWSClientclass.fromhttpSocketGatewayimportWSClientimporttimeclassWebSocketClient(WebSocketBaseClient):defprocess_message(self,message):print(f"Received:{message}")client=WebSocketClient("localhost",8080,simple=True)client.run()time.sleep(1)client.close()simpleparameter is used to send json without modification to match with thegateway server.Withsimpleparameter you can send json to any other server.GatewayTODO
Package: httpsproxy_urllib2
This package contains the python 2.5 urllib2 and httplib modules patched to
correctly use the CONNECT method to establish a connection to a HTTPS server
over a proxy server. The urllib2 module has also been made compatible with
python 2.4 (hashlib replaced with sha and md5 modules)The patch was downloaded fromhttp://bugs.python.org/issue1424152urllib2.py is r62464 from the python2.5 maintenance branchhttplib.py is r60748 from the python2.5 maintenance branch
Package: httpsrv
Simple http server for API mocking during automated testingExample usageUsingrequestslibrary:>>> import requests
>>> from httpsrv import Server
>>> server = Server(8080).start()
>>> server.on('GET', '/').text('hello')
>>> res = requests.get('http://localhost:8080')
>>> assert res.text == 'hello'Installationpip install httpsrvDocumentationhttp://httpsrv.readthedocs.org
Package: httpsrvvcr
Library for recording http requests into yaml format that can be
further understood byhttpsrvas a server fixtureInstallationPackage can be obtained from PyPipip install httpsrvvcrUsageBasic usage looks like following:python -m httpsrvvcr.recorder 8080 http://some-api-url.com/api > tape.yamlIt is possible to skip headers recording with--no-headersflag:python -m httpsrvvcr.recorder 8080 http://some-api-url.com/api --no-headers > tape.yamlOnce can also exclude some request methods from output completely:python -m httpsrvvcr.recorder 8080 http://some-api-url.com/api --skip-methods OPTIONS TRACE > tape.yamlAfter vcr tape is recorded one can usehttpsrvvcr.playermodule:import unittest

from httpsrv import Server
from httpsrvvcr.player import Player

server = Server(8080).start()
player = Player(server)

class MyTestCase(unittest.TestCase):
    def setUp(self):
        server.reset()

    @player.load('path/to/tape.yaml')
    def test_should_do_something(self):
        passDocumentationhttp://httpsrvvcr.readthedocs.io
Package: httpstatus35
Python 3.5http.HTTPStatusbackported to 3.4 and 2.7Getting startedInstall:$ pip install httpstatus35…or if you want to use Python 2.7 run:$ pip install httpstatus35[py2x]Enjoy:$ python2.7
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from httpstatus import HTTPStatus
>>> HTTPStatus.OK
<HTTPStatus.OK: 200>Licensehttpstatus35is licensed under the MIT license. See the license file
for details.
Package: http-status-code
http-status-codeIntroductionGetting StartedExampleContributorsLicenseIntroductionThis module contains a simple library with a single class to define HTTP status codesGetting StartedIn order to install, open the command prompt and type ✌️:pip install http_status_codeThe following status codes are available in the standard module:
General:Successful request: 																200Bad request:																		400You are not authorized:	            				 							403The required resource is not found:												404Request arguments (query string or body) validation error: 	            		410AuthenticationInvalid credentials:																430Your account is inactive:															431Missing token:																	432The token is invalid:																433The token is expired:																434Wrong token error (related to refresh and access tokens)                          435You have logged out invalid credentials. Please log in again:						436DatabaseThis record already exists:														630This record is related to other records. Therefore, it cannot be deleted:			631ExampleIn order to use refer to the following [example](https://github.com/Quakingaspen-codehub/http_status_code/blob/master/Example.ipynb)ContributorsThis project exists thanks to all the people who contribute. [Contribute].""LicenseThis library is licensed under the MIT License - see theLICENSE.mdfile for details.
Package: http-status-codes
HTTP Status ConstantsA set of constants for HTTP statuses and headers. Improve your code readability.InstallationYou can install Http Constants fromPyPI:pip install http_constantsThe library is supported on Python 3.7+.UsageHeadersfrom http_constants.headers import HTTPHeaders
HTTPHeaders.ACCEPT
> 'Accept'

HTTPHeaders.CONTENT_TYPE_VALUES.json
> 'application/json'StatusesIn[1]: 
    from http_constants import status
    status.SERVICE_UNAVAILABLE
Out[1]:
    503
---
In[2]: 
    from http_constants.status import HttpStatus
    HttpStatus(500).get_meaning()

Out[2]: 
    'Internal Server Error'MethodsIn[1]: 
    from http_constants import method
    method.GET
Out[1]:
    "GET"URI SchemasIn[1]: 
    from http_constants import schema
    schema.HTTP
Out[1]:
    "http"
Package: httpstatuspuppet
[![Build Status](https://travis-ci.org/wtsi-hgi/http-status-puppet.svg?branch=master)](https://travis-ci.org/wtsi-hgi/http-status-puppet)[![codecov](https://codecov.io/gh/wtsi-hgi/http-status-puppet/branch/master/graph/badge.svg)](https://codecov.io/gh/wtsi-hgi/http-status-puppet)[![PyPI version](https://badge.fury.io/py/httpstatuspuppet.svg)](https://badge.fury.io/py/httpstatuspuppet)# HTTP Status Puppet_A HTTP server that will return a status code of your choice_## IntroductionThis server simply returns back a status code depending on what endpoint is contacted, e.g.```$ curl -s -o /dev/null -w "%{http_code}" http://0.0.0.0:8000/403403$ curl -s -o /dev/null -w "%{http_code}" http://0.0.0.0:8000/200200```## InstallationPrerequisites- Python 3.6+The tool can be installed from PyPi:```bashpip install httpstatuspuppet```Bleeding edge versions can be installed directly from GitHub:```bashpip install git+https://github.com/wtsi-hgi/http-status-puppet/.git@master#egg=httpstatuspuppet```## Usage_Warning: this server was only designed for use in testing!_### LocalAfter installing dependencies, in the project directory:```bashPYTHONPATH=. python httpstatuspuppet/entrypoint.py```### Docker```bashdocker run -d -p ${HOST_PORT}:8000 mercury/http-status-puppet```## Alternatives- C# server: https://github.com/Readify/httpstatus.
Package: httpstreamproxy
http streaming proxyThis project implements HTTP streaming proxy that can be used to proxy webcam streams.To run this software you may use Docker orPIPpackage manager such as shown belowDocker approachdocker run -p 8080:8080 -e target_url="https://192.168.1.70/anonymous/jpeg/stream=0" -e verify="False" grro/httpstreamproxy:0.1.0PIP approachsudo pip install httpstreamproxyAfter this installation you may start the proxy inside your python code or via command line usingsudo httpproxy --command listen --port 8080 --target_url https://192.168.1.70/anonymous/jpeg/stream=0 --verify FalseHere, the proxy  will be bind to on port 8080.By running asystemd-based Linux distributionyou may use theregistercommand to register and start the proxy as systemd unit.
By doing this the proxy will be started automatically on boot. Starting the server manually using thelistencommand is no longer necessary.sudo httpproxy --command register --port 8080 --target_url https://192.168.1.70/anonymous/jpeg/stream=0 --verify False
Package: http-stream-xml
Parse XML in HTTP response on the fly, by chunks.It could beHTTP protocol chunksOr just partial download of big HTTP response.I use it to work withNCBI (PubMed) Entrez API.See usage example inthe blog article.Installationpipinstallhttp-stream-xml--upgradeScriptsmakehelpCoverage reportCodecovCoverallsDocumentationDocumentation
Package: httpsuite
🧳 httpsuitehttpsuiteis a collection of tools to parse, manipulate, and compile raw HTTP messages. Built to be used as a dependency for larger projects that require parsing, modifying, requesting, and responding to raw HTTP requests.InstallingTo install justhttpsuite:pip install httpsuiteThis package is depedent ontoolbox. If you plan to contribute make sure to install thedevrequirements:pip install httpsuite[dev]DocumentationRead the documentationhere.Usehttpsuiteprovides two main objects,RequestandResponse. Both objects can be initialized with either__init__orparse:fromhttpsuiteimportRequest,Responseimportjsonrequest=Request(method="GET",target="/",protocol="HTTP/1.1",headers={"Host":"www.google.com","Connection":"keep-alive","Content-Length":"18"},body=json.dumps({"hello":"world"}),)response=Response(protocol="HTTP/1.1",status=200,status_msg="OK",headers={"Host":"www.google.com","Connection":"keep-alive","Content-Length":"18"},body=json.dumps({"hello":"world"}),)orfromhttpsuiteimportRequest,Responserequest=Request.parse((b"GET / HTTP/1.1\r\n"b"Host: www.google.com\r\n"b"Connection: keep-alive\r\n"b"Content-Length: 18\r\n"b"\r\n"b'{"hello": "world"}'))response=Response.parse((b"HTTP/1.1 200 OK\r\n"b"Host: www.google.com\r\n"b"Connection: keep-alive\r\n"b"Content-Length: 18\r\n"b"\r\n"b'{"hello": "world"}'))RequestandResponsesobjects can be directly modified as one would expect, with no limitations as to the type:request.method="POST"request.headers+={"Accept":"*/*"}response.status=100response.status_msg=b"Continue"Internally, every item of a request or response is saved as anItem, a special object type that allows easy setting and comparisons on the fly:response.status==100# >>> Trueresponse.status=="100"# >>> Trueresponse.status==b"100"# >>> TrueOnce the object is modified to the users preference, utilizing theRequestandResponseobject is as easy as calling a property (specifically.raw):print(request.raw)# >>> b'POST / HTTP/1.1\r\nHost: www.google.com\r\nConnection: keep-alive\r\nContent-Length: 18\r\nAccept: */*\r\n\r\n{"hello": "world"}'print(response.raw)# >>> b'HTTP/1.1 100 Continue\r\nHost: www.google.com\r\nConnection: keep-alive\r\nContent-Length: 18\r\n\r\n{"hello": "world"}'Uniquely, the__str__method forRequestandResponsereturn the objects with arrows to make obvious of its type:print(request)print(response)→ POST / HTTP/1.1
→ Host: www.google.com
→ Connection: keep-alive
→ Content-Length: 18
→ Accept: */*
→
→ {"hello": "world"}

← HTTP/1.1 100 Continue
← Host: www.google.com
← Connection: keep-alive
← Content-Length: 18
←
← {"hello": "world"}For more information and examples ofhttpsuite, check out thedocs.
Package: http-tarpit
http-tarpitWeb-server which produces infinite chunked-encoded responses:heart: :heart: :heart:You can say thanks to the author by donations to these wallets:ETH:0xB71250010e8beC90C5f9ddF408251eBA9dD7320eBTC:Legacy:1N89PRvG1CSsUk9sxKwBwudN6TjTPQ1N8aSegwit:bc1qc0hcyxc000qf0ketv4r44ld7dlgmmu73rtlntwRequirementsPython 3.5.3+aiohttp 3.4.4+InstallationStandard Python package installation. This package is available on PyPI:pip3 install http-tarpitDockerRun following command to pull image and print options help:dockerrun-ityarmak/http-tarpit--helpUse following command with required options to run daemon in background (example):dockerrun-dit\-p8080:8080\--restartunless-stopped\--namehttp-tarpit\yarmak/http-tarpit-mnullTLS example:dockerrun-dit\-p8443:8080\-v/etc/letsencrypt:/srv/certs:ro\--restartunless-stopped\--namehttp-tarpit\yarmak/http-tarpit\-c/srv/certs/live/example.com/fullchain.pem\-k/srv/certs/live/example.com/privkey.pemUsageSynopsis:$ http-tarpit --help
usage: http-tarpit [-h] [--disable-uvloop] [-v {debug,info,warn,error,fatal}]
                   [-m {clock,newline,urandom,null,slow_newline}]
                   [-a BIND_ADDRESS] [-p BIND_PORT] [-c CERT] [-k KEY]

Web-server which produces infinite chunked-encoded responses

optional arguments:
  -h, --help            show this help message and exit
  --disable-uvloop      do not use uvloop even if it is available (default:
                        False)
  -v {debug,info,warn,error,fatal}, --verbosity {debug,info,warn,error,fatal}
                        logging verbosity (default: info)
  -m {clock,newline,urandom,null,slow_newline}, --mode {clock,newline,urandom,null,slow_newline}
                        operation mode (default: clock)

listen options:
  -a BIND_ADDRESS, --bind-address BIND_ADDRESS
                        bind address (default: 0.0.0.0)
  -p BIND_PORT, --bind-port BIND_PORT
                        bind port (default: 8080)

TLS options:
  -c CERT, --cert CERT  enable TLS and use certificate (default: None)
  -k KEY, --key KEY     key for TLS certificate (default: None)Modes of operationclock- feed client with current time string every secondnewline- feed client with newlines as fast as possibleurandom- feed client with random bytes as fast as possiblenull- feed client with zero bytes as fast as possibleslow_newline- feed client with newline character every second
Package: http-test-client
Library to simplify writing HTTP REST service integration tests.Allows to build a HTTP REST client with automatic resource cleanup.Examplefromhttp_test_clientimportClient,HttpTransport,RestResources,resourcesclassArticleResources(RestResources):defsearch(self,query):returnself._request('/search',method='POST',data={'query':query})classResource(RestResources.Resource):defpublish(self):returnself._request('/publish',method='POST')comments=resources('/comments')classMyClient(Client):users=resources('/users')articles=resources('/articles',ArticleResources)client=MyClient(HttpTransport('http://localhost:8888'))# managing resourcesclient.users.list()# => [{'id': '1', 'name': 'John'}, ...]client.users.create({'name':'Jane'})# => {'id': '2'}client.users['1'].get()# => {'id': '1', 'name': 'John'}client.users['1'].delete()# delete all resources that were created during this client sessionclient.cleanup()# custom actionclient.articles['123'].publish()# nested resourcesclient.articles['123'].comments.list()Installation$ pip install http-test-clientRequirementsPython >= 2.7 and <= 3.6requests>= 2.14six >= 1.10Project LinksPyPI:https://pypi.python.org/pypi/http-test-clientIssues:https://github.com/maximkulkin/http-test-client/issuesLicenseMIT licensed. See the bundledLICENSEfile for more details.
Package: httptestkit
httptestkit##########Connects to a web target as many times as required as quickly as required. Has options to show:* Request headers.* Information on DNS records associated with the site's domain.* A lookup on the details of the IP address associated with the site.Installation============To install this software:.. code-block:: bash$ pip install httptestkitPython Version==============This software only supports Python 3.5 and above.Usage=====.. code-block:: bash$ httptestkit www.domain.tld --loop --sleep 0 --limit 5 --headers --dnsinfo --ipinfoLicense=======Licensed under the MIT license. See LICENSE for details.
Package: httptestserver
HTTP(s) and SMTP servers which can be run within a Python process. Serving
from different thread along with application and tests, exposing a simple
thread-safe API, so the calling code can control how the server behaves.Sometimes integration tests cannot do with mocking thesocket.socketfunction avoiding real networking, this partially solves the problem by
providing a real server which is easy to use and can perform real network
communication in a controlled and reliable way.Features:Runs in a different thread along with your tests.Control server responses and behaviour.Access to server internal state and data after or during the request.HTTPs support, it bundles a self-signed certificate useful for testing.SMTP support which will collect and parse all your outgoing email.History of all performed requests/responses.Supportspython2.73.2,3.3and3.4FunctionsFunctions that return a running server instance:>>>server=start_server()>>>server.host'127.0.0.1'Or context managers for limited use:>>>withhttp_server()asserver:...server.host'127.0.0.1'>>>withsmtp_server()asserver:...server.inbox[]Mixin classesMixins that include an working server asself.server.importrequestsfromhttptestserverimportHttpsTestServerclassTestApplication(HttpsTestServer):# Test what was actually get by the serverdeftest_it_should_send_headers(self):headers={'key':'value'}requests.get(self.default_url,headers=headers)assertself.server.data['headers']['key']=='value'# Control server responsesdeftest_it_should_parse_json_response(self):self.server.data['headers']={'Content-Type':'application/json'}self.server.data['response_content']="{'key': 'value'}"response=requests.get(self.default_url)assertresponse.json()=={'key':'value'}# Make the server behave as you wantdeftest_it_should_raise_timeout_at_2s_wait(self):self.server.data['response_timeout']=2try:requests.get(self.default_url,timeout=1)exceptrequests.exceptions.Timeout:passelse:assertFalse# Access to server's requests/responses historydeftest_it_should_make_two_requests(self):requests.get(self.default_url)requests.get(self.default_url+'2')assertlen(self.server.history)==2assertself.server.history[-1]['path']==self.default_url+'2'DevelopmentIn order get a development environment, create a virtualenv and install the
desired requirements.virtualenvenvenv/bin/activatepipinstall-rdev-requirements.txtThe included certificate was generated using SSL:opensslreq-new-x509-keyoutserver.pem-outserver.pem-days40000-nodesTestsTo run the tests just usetoxornose:toxnosetestsDocumentationTo generate the documentation change to thedocsdirectory and run make.
You need to install thesphinxandchangelogpackages in order to be
able to run the makefile.cddocsmakehtmlopenbuild/html/index.html
Package: httptime
HTTP Transaction ProfileSeries of tools to profile HTTP interactions in Python scripts. It can be used for understanding impact of slow web API's on an application.How It WorksThehttptime.enable_loggingfunction redirects the debug output of the http.client module (common module responsible for all HTTP communication in python) to the Pythonloggingframework. The output is then saved to a file.Tools are provided for parsing and visualizing the output.Usage (Save Data)Insert the following block of code at the beginning of your script. That's it.importhttptimehttptime.enable_logging()Theenable_loggingfunction does the following:Redirectshttp.clientdebug output into theloggingmodule.Savealldebug output to a file. Note that currently alllogging.DEBUGoutput is saved to this file, including from other modules.The output file path can be specified via theoutfileparameter to theenable_loggingfunction. If not specified, then the output is saved to~/.httptime/{prog}-{date}.txt, where{prog}is the name of script being executed and{date}is the current date/time in the format%Y-%m-%d %H:%M:%SZ%z.Usage (View Data)The data can be visualized using the Dash-based appapp.py. The following command opens a server atlocalhost:5000. You can client on invidiual blocks in the graph to get more details.pythonapp.pypath/to/example/outfile.txtTODOOptions toenable_loggingto better steer saved data.Module that saves data to a dataframe for custom analysis code.
Package: httptools
httptools is a Python binding for the nodejs HTTP parser.The package is available on PyPI:pip install httptools.APIshttptools contains two classeshttptools.HttpRequestParser,httptools.HttpResponseParser(fulfilled throughllhttp) and a function for
parsing URLshttptools.parse_url(throughhttp-parsefor now).
See unittests for examples.classHttpRequestParser:def__init__(self,protocol):"""HttpRequestParserprotocol -- a Python object with the following methods(all optional):- on_message_begin()- on_url(url: bytes)- on_header(name: bytes, value: bytes)- on_headers_complete()- on_body(body: bytes)- on_message_complete()- on_chunk_header()- on_chunk_complete()- on_status(status: bytes)"""defget_http_version(self)->str:"""Return an HTTP protocol version."""defshould_keep_alive(self)->bool:"""Return ``True`` if keep-alive mode is preferred."""defshould_upgrade(self)->bool:"""Return ``True`` if the parsed request is a valid Upgrade request.The method exposes a flag set just before on_headers_complete.Calling this method earlier will only yield `False`."""deffeed_data(self,data:bytes):"""Feed data to the parser.Will eventually trigger callbacks on the ``protocol``object.On HTTP upgrade, this method will raise an``HttpParserUpgrade`` exception, with its sole argumentset to the offset of the non-HTTP data in ``data``."""defget_method(self)->bytes:"""Return HTTP request method (GET, HEAD, etc)"""classHttpResponseParser:"""Has all methods except ``get_method()`` thatHttpRequestParser has."""defget_status_code(self)->int:"""Return the status code of the HTTP response"""defparse_url(url:bytes):"""Parse URL strings into a structured Python object.Returns an instance of ``httptools.URL`` class with thefollowing attributes:- schema: bytes- host: bytes- port: int- path: bytes- query: bytes- fragment: bytes- userinfo: bytes"""DevelopmentClone this repository withgit clone --recursive git@github.com:MagicStack/httptools.gitCreate a virtual environment with Python 3:python3 -m venv envnameActivate the environment withsource envname/bin/activateInstall development requirements withpip install -e .[test]Runmakeandmake test.LicenseMIT.
Package: http-tools
httptoolscapture | intercept | repeathttptools helps you to capture, repeat and live intercept HTTP requests with scripting capabilities and is built on top ofmitmproxy.Made within IndiaInstallpip install http-toolsDevelop$ git clone https://github.com/MobSF/httptools.git
$ cd httptools
$ python setup.py developUsage$ httptools
usage: httptools [-h] [-m MODE] [-p PORT] [-i IP] [-n NAME] [-u UPSTREAM]

optional arguments:
  -h, --help            show this help message and exit
  -m MODE, --mode MODE  Supported modes
                        1. capture: Capture requests.
                        2. repeat: Repeat captured requests.
                        3. intercept: Intercept and tamper the request.
                        4. server: Start httptools server.
  -p PORT, --port PORT  Proxy Port
  -i IP, --ip IP        Proxy Host
  -n NAME, --name NAME  Project Name
  -u UPSTREAM, --upstream UPSTREAM
                        Upstream ProxyCapture -httptools -m captureStarts HTTPS proxy at0.0.0.0:1337by default.Install Root CA cert fromhttp://mitm.it/Repeat -httptools -m repeatReplay the captured traffic. Use --upstream to forward it to
a fuzzer like BurpSuite or OWASP ZAP.Intercept -httptools -m interceptTo Fiddle with HTTP request and response in live.Use:http_tools/modules/interceptor.py(The location will be relative to where httptools is installed)Server Web UI -httptools -m serverStarts the Web UI athttps://0.0.0.0:1337by default.