Saravanan666/pypi-org huggingface dataset:
Package: http-to-xmpp
HTTP to XMPP gatewayThis is a dumb dumb gateay between HTTP and XMPP:You POST some text over HTTP, text gets sent over XMPP.Only one XMPP jid can receive message.Installationpip install http-to-xmppSetupIt can be configured either via environment variables:$exportXMPP_DEST_JID=the_human_receiving_messages@the_server.org
$exportXMPP_JID=the_bot_account@the_server.org
$exportXMPP_PASSWORD=the_bot_password
$http-to-xmppor via arguments:$http-to-xmpp--xmpp-jidbot_account@the_server.org--xmpp-password"$(passbot_account@the_server.org)"--xmpp-dest-jidhuman_account@the_server.orgHTTP host and port to listen to can be changed using--http-hostand--http-port, they default tolocalhost:1985.UsageYou just have to send POST requests, to/on the given host:port
pair so by default, using curl, one can post messages using:$ curl -XPOST -d Coucou localhost:1985
Package: http-types
HTTP Types in PythonPython (3.6 or later) library to read and write records of HTTP exchanges in theHTTP typesformat.Installationpipinstallhttp-typesWriting HTTP exchangesUsingHttpExchangeWritera recording of HTTP traffic can be serialised for use with any program that can handle the HTTP Types format:request=RequestBuilder.from_dict({"host":"api.github.com","protocol":"https","method":"get","pathname":"/v1/users","query":{"a":"b","q":["1","2"]},})response=ResponseBuilder.from_dict({"statusCode":200,"headers":{"content-type":"text/plain"},"body":"(response body string)",})exchange=HttpExchange(request=request,response=response)withtempfile.TemporaryFile(mode="w")asoutput:writer=HttpExchangeWriter(output)writer.write(exchange)# Serialize to dictionaryas_dict=HttpExchangeWriter.to_dict(exchange)# Serialize to JSON stringas_str=HttpExchangeWriter.to_json(exchange)Reading HTTP exchangesWithHttpExchangeReaderrecordings in the HTTP Types format can be read for processing:forexchangeinHttpExchangeReader.from_jsonl(input_file):assertexchange.request.method==HttpMethod.GETassertexchange.request.protocol==Protocol.HTTPSassertexchange.response.statusCode==200DevelopmentInitial setup:Create a new virtual environment.Install dependencies:pip install --upgrade -e '.[dev]'To test, runpython setup.py test, which will:Enforce code formatting usingblack.Test withpytest, configured inpytest.ini.Type check withmypy.Enforce style guide withflake8, configured in.flake8.PublishingBump the version insetup.pyif the version is the same as in the publishedpackage. Commit and push.Runpython setup.py testandpython setup.py distto check that everything works.To build and upload the package, runpython setup.py upload. Insert PyPI credentials to upload the package toPyPI. The command will also rungit tagto tag the commit as a release and push the tags to remote.To see what the different commands do, seeCommandclasses insetup.py.
Package: httpunixsocketconnection
HTTPUnixSocketConnectionReally small Python class that extends native http.client.HTTPConnection allowing sending HTTP requests to Unix SocketsInstallationPoetrypoetryaddhttpunixsocketconnectionpippipinstallhttpunixsocketconnectionUsageBecause the class base ishttp.client.HTTPConnection, the API is almost the same.
Only the constructor andconnectmethod is different.
With the rest please followthe official docs.fromhttpunixsocketconnectionimportHTTPUnixSocketConnection# Create a connectionconn=HTTPUnixSocketConnection(unix_socket="/var/run/some.unix.socket"# timeout=Like in HTTPConnection# blocksize=Like in HTTPConnection)Example: Getting list of Docker ContainersfromhttpunixsocketconnectionimportHTTPUnixSocketConnectionconn=HTTPUnixSocketConnection("/var/run/docker.sock")conn.request("GET","/containers/json")res=conn.getresponse()print(res.status,res.reason)content=res.read().decode("utf-8")print(content)
Package: httpx-auth-awssigv4
httpx-auth-awssigv4This package provides utilities to addAWS Signature V4authentication infrormation to calls made by pythonhttpxlibrary.Documentation:https://mmuppidi.github.io/httpx-auth-awssigv4GitHub:https://github.com/mmuppidi/httpx-auth-awssigv4PyPI:https://pypi.org/project/httpx-auth-awssigv4/MIT LicenseInstallationpipinstallhttpx-auth-awssigv4UsageBasic UsageThis library has primarily been developed to help add authentication support tohttpxlibrary while making calls to
REST API deployed using AWS API Gateway service. Will be extended in future to help with calling AWS services.importhttpxfromhttpx_auth_awssigv4importSigv4Auth# creating a callable for httpx libraryauth=Sigv4Auth(access_key="AWS_ACCESS_KEY_ID",secret_key="AWS_SECRET_ACCESS_KEY",service="execute-api",region="us-east-1")# Calling an API endpoint deployed using AWS API Gateway which has# AWS_IAM set as authorization typeresponse=httpx.get(url="https://<API ID>.execute-api.<Region>.amazonaws.com/prod/detials",params={"username":"tstark"},auth=auth)# Making a post callresponse=httpx.get(url="https://<API ID>.execute-api.<Region>.amazonaws.com/prod/details",params={"username":"tstark"},json={"mission":"avengers"},auth=auth)With STS credentialsSigv4Authcan be used with temporary credentials generated with tools likeaws-sso-util.importboto3fromhttpx_auth_awssigv4importSigv4Auth# fetch temporary credentials from AWS STS servicecredentials=boto3.Session(profile_name="<profile>").get_credentials()# creating a callable for httpx libraryauth=Sigv4Auth(access_key=credentials.access_key,secret_key=credentials.secret_key,token=credentials.tokenservice="execute-api",region="us-east-1")Sigv4Authcan also be used with temporary credentials from AWS STS.importboto3fromhttpx_auth_awssigv4importSigv4Auth# role with `execute-api` permissionsROLE_ARN="arn:aws:iam::<ACCOUNT ID>:role/<ROLE NAME"# fetch temporary credentials from AWS STS servicecredentials=boto3.client('sts').assume_role(RoleArn=ROLE_ARN,RoleSessionName="httpxcall")["Credentials"]# creating a callable for httpx libraryauth=Sigv4Auth(access_key=credentials["AccessKeyId"],secret_key=credentials["SecretAccessKey"],token=credentials["SessionToken"]service="execute-api",region="us-east-1")ToDoAdd examples on usage along with API backend deployment instructions.Test the library with AWS services and add integration tests.CreditsThis package was created withCookiecutterand thewaynerv/cookiecutter-pypackageproject template.
Package: httpx-cache
HTTPX-CACHEhttpx-cache is an implementation of the caching algorithms inhttplib2andCacheControlfor use withhttpxtransport object.It is is heavily insipired by:https://github.com/ionrock/cachecontrolhttps://github.com/johtso/httpx-cachingDocumentationFull documentation is available athttps://obendidi.github.io/httpx-cache/InstallationUsing pip:pipinstallhttpx-cachePlease make sure to pin the exacthttpx-cacheversion for your project, to make sure it all works.ContributorsFeel free to contribute !
Package: httpx-caching
Caching for HTTPX.Note: Early development / alpha, use at your own risk.This package adds caching functionality toHTTPXAdapted from Eric Larson's fantasticCacheControlforrequests.Project goals:Sans-io caching protocolFully async compatibleSupport multiple http clients (currently only supports httpx)Limitations:Currently only has in-memory cache storage (async redis would be nice!)Test suite was taken wholesale from CacheControl, so still uses a test server and mocking rather than taking advantage of the sans-io implementation.Usage:importasynciofromhttpximportAsyncClientfromhttpx_cachingimportCachingClientclient=AsyncClient()client=CachingClient(client)asyncdefrun_example():awaitclient.get("http://example.com")loop=asyncio.get_event_loop()loop.run_until_complete(run_example())Documentation:TODOSeeCacheControl's documentationfor general documentation of the caching approach.
Package: httpxfetch
httpxfetchhttpxfetchis a Python wrapper for the JavaScriptfetchfunction, designed to streamline the process of reverse engineering APIs. The primary goal of this project is to simplify testing and data inspection by allowing users to copy thefetchrequests generated by browser developer tools, paste them into their Python code, and execute them seamlessly.InstallationYou can installhttpxfetchusing pip:pipinstallhttpxfetchQuick Startfromhttpxfetchimportfetch# Example: Making a GET requestresponse=fetch('https://api.example.com/data')print(response.status_code)print(response.json())FeaturesSimplified Testing:Copy and pastefetchrequests from browser developer tools into your Python code for easy testing and data exploration.Wrapper for HTTPX:Utilizes the powerfulhttpxlibrary to perform HTTP requests in Python.JSON Handling:Automatically converts the request body to a JSON string using theJSON.stringifyequivalent function.Usagefromfetch_to_httpximportfetch,JSON# Example: Making a POST request with JSON payloadurl='https://api.example.com/data'options={'method':'post','headers':{'Content-Type':'application/json'},'body':JSON.stringify({'key':'value'}),}response=fetch(url,options)print(response.status_code)print(response.json())Return TypeThefetchfunction returns an instance of thehttpx.Responseclass. All methods available in thehttpx.Responseclass can be applied to the result of thefetchfunction.DisclaimerThe project intentionally includes some redundant steps, such as converting thefetchbody to a string before loading it as a dictionary. This is done to minimize the effort required, providing a convenient function to simulateJSON.stringifyfor ease of use.ContributingContributions are welcome! Feel free to open issues, submit pull requests, or provide suggestions to improve the project.LicenseThis project is licensed under the MIT License - see theLICENSEfile for details.
Package: httpx-file
httpx-fileTransport adapter forthttpxto allowfile://URI fetching in the local filesystem.Installationpip install httpx-fileUsageSynchronoushttpx-filesubclasseshttpx.Client, so you can just replacehttpx.Clientwithhttpx_file.Clientto get the same behavior with addedfile://protocol
support.fromhttpx_fileimportClientclient=Client()client.get('file:///etc/fstab)Or you can also mountFileTransportin ahttpx.Clientinstance.fromhttpx_fileimportFileTransportfromhttpximportClientclient=Client(mounts={'file://':FileTransport()})client.get('file:///etc/fstab)AsynchronousIt is also possible to usehttpx-filepossibilities asynchronous way.
To do this, you can just replace 'httpx.AsyncClient' with 'httpx_file.AsyncClient'.fromhttpx_fileimportAsyncClient# Taken from tests/test_transport.pyfrompathlibimportPathTHIS=Path(__file__)asyncdeftest_async_client():async_client=AsyncClient()async_response=awaitasync_client.get(THIS.as_uri())assertasync_response.content==THIS.read_bytes()Or you can also mountFileTransportin ahttpx.AsyncClientinstance.fromhttpx_fileimportFileTransportfromhttpximportAsyncClientclient=AsyncClient(mounts={'file://':FileTransport()})client.get('file:///etc/fstab)
Package: httpx-negotiate-sspi
httpx-negotiate-sspiThis is a port ofrequests-negotiate-sspiforhttpx.The implmentation stays close to the original, in an attempt to make any fixes
or updates more straighforward.The following is taken from the README of the original package with changes to
reflect httpx.An implementation of HTTP Negotiate authentication for Requests. This
module provides single-sign-on using Kerberos or NTLM using the Windows
SSPI interface.This module supports Extended Protection for Authentication (aka Channel
Binding Hash), which makes it usable for services that require it,
including Active Directory Federation Services.Usageimporthttpxfromhttpx_negotiate_sspiimportHttpSspiAuthr=httpx.get('https://iis.contoso.com',auth=HttpSspiAuth())Optionsusername: Username.Default: Nonepassword: Password.Default: Nonedomain: NT Domain name.Default: '.' for local account.service: Kerberos Service type for remote Service Principal
Name.Default: 'HTTP'host: Host name for Service Principal Name.Default: Extracted from request URIdelegate: Indicates that the user's credentials are to be delegated to the server.
Default: FalseIf username and password are not specified, the user's default
credentials are used. This allows for single-sign-on to domain resources
if the user is currently logged on with a domain account.
Package: httpx-ntlm
This package allows for HTTP NTLM authentication using the HTTPX library. It is an
adaptation ofhttps://github.com/requests/requests-ntlm.UsageHttpNtlmAuthextends HTTPXAuthbase class, so usage is simple:importhttpxfromhttpx_ntlmimportHttpNtlmAuthhttpx.get("http://ntlm_protected_site.com",auth=HttpNtlmAuth('domain\\username','password'))HttpNtlmAuthcan be used in conjunction with aClientin order to
make use of connection pooling. Since NTLM authenticates connections,
this is more efficient. Otherwise, each request will go through a new
NTLM challenge-response.importhttpxfromhttpx_ntlmimportHttpNtlmAuthclient=httpx.Client(auth=HttpNtlmAuth('domain\\username','password'))client.get('http://ntlm_protected_site.com')Installationpip install httpx-ntlmRequirementshttpxpyspnego
Package: httpx-oauth
HTTPX OAuthAsync OAuth client using HTTPXDocumentation:https://frankie567.github.io/httpx-oauth/Source Code:https://github.com/frankie567/httpx-oauthInstallationpipinstallhttpx-oauthContributors ✨Thanks goes to these wonderful people (emoji key):François Voron🚧Xavi Torelló💻dbf💻Kenton Parton💻stepan-chatalyan💻Foster Snowhill💻William Hatcher💻Matt Chan📦Goran Mekić📦Joona Yoon💻LindezaGrey💻R. Singh🐛Lukas Lösche🐛💻This project follows theall-contributorsspecification. Contributions of any kind welcome!DevelopmentSetup environmentWe useHatchto manage the development environment and production build. Ensure it's installed on your system.Run unit testsYou can run all the tests with:hatchruntestFormat the codeExecute the following command to applyisortandblackformatting:hatchrunlintServe the documentationYou can serve the documentation locally with the following command:hatchrundocsThe documentation will be available onhttp://localhost:8000.LicenseThis project is licensed under the terms of the MIT license.
Package: httpx-pkcs12
httpx-pkcs12Addon which activates PKCS12 certificates usage with HTTPX client.Usagewithopen('path/to/your/cert','rb')asf:cert_contents=f.read()password='your-secret-password'context=create_ssl_context(cert_contents,password)# async versionasyncwithhttpx.AsyncClient(verify=context)asclient:response=...# or sync versionresponse=httpx.get(...,verify=context)
Package: httpx_ratelimiter
httpx-ratelimitSimple wrapper aroundPyrateLimiterthat adds integration withhttpxlibraryUsageUsing per_* kwargs:fromtimeimporttimefromhttpximportClientfromhttpx_ratelimiterimportLimiterTransport# Apply a rate limit of 5 requests per second to all requests# if wait time between request will be more than 600ms, raise an BucketFullExceptionwithClient(transport=LimiterTransport(per_second=5,max_delay=600))asc:start=time()for_iinrange(100):print(f'[t +{time()-start:.2f}] got response:{c.get("https://httpbin.org/status/200,429")}')Using custom list of ratesfromtimeimporttimefromhttpximportClientfromhttpx_ratelimiterimportLimiterTransportfrompyrate_limiterimportLimiter,Rate,Duration# limit 5 requests over 2 seconds and 10 requests over 1 minuterates=[Rate(5,Duration.SECOND*2),Rate(10,Duration.MINUTE)]# if wait time between request will be more than 600ms, silently failwithClient(transport=LimiterTransport(rates=rates,max_delay=600,raise_when_fail=False))asc:start=time()for_iinrange(100):print(f'[t +{time()-start:.2f}] got response:{c.get("https://httpbin.org/status/200,429")}')ThanksThank to originalRequests-ratelimiterauthor for idea and backbone of a project.
Package: httpx-socks
httpx-socksThehttpx-sockspackage provides proxy transports forhttpxclient.
SOCKS4(a), SOCKS5(h), HTTP (tunneling) proxy supported.
It usespython-socksfor core proxy functionality.RequirementsPython >= 3.6httpx>=0.21.0python-socks>=2.0.0async-timeout>=3.0.1 (optional)trio>=0.16.0 (optional)Installationonly sync proxy support:pip install httpx-socksto include optional asyncio support (it requires async-timeout):pip install httpx-socks[asyncio]to include optional trio support:pip install httpx-socks[trio]Usagesync transportimporthttpxfromhttpx_socksimportSyncProxyTransportdeffetch(url):transport=SyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')withhttpx.Client(transport=transport)asclient:res=client.get(url)returnres.textasync transport (asyncio, trio)importhttpxfromhttpx_socksimportAsyncProxyTransportasyncdeffetch(url):transport=AsyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')asyncwithhttpx.AsyncClient(transport=transport)asclient:res=awaitclient.get(url)returnres.textsecure proxy connections (aka "HTTPS proxies", experimental feature, both sync and async support)importsslimporthttpxfromhttpx_socksimportAsyncProxyTransportasyncdeffetch(url):proxy_ssl=ssl.SSLContext(ssl.PROTOCOL_TLS)proxy_ssl.verify_mode=ssl.CERT_REQUIREDproxy_ssl.load_verify_locations(...)transport=AsyncProxyTransport.from_url('http://user:password@127.0.0.1:8080',proxy_ssl=proxy_ssl)asyncwithhttpx.AsyncClient(transport=transport)asclient:res=awaitclient.get(url)returnres.text
Package: httpx-with-httpcore-with-random-feature-branch
HTTPX- A next-generation HTTP client for Python.HTTPX is a fully featured HTTP client library for Python 3. It includesan integrated
command line client, has support for bothHTTP/1.1 and HTTP/2, and provides bothsync
and async APIs.Install HTTPX using pip:$pipinstallhttpxNow, let's get started:>>>importhttpx>>>r=httpx.get('https://www.example.org/')>>>r<Response [200 OK]>>>>r.status_code200>>>r.headers['content-type']'text/html; charset=UTF-8'>>>r.text'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'Or, using the command-line client.$pipinstall'httpx[cli]'# The command line client is an optional dependency.Which now allows us to use HTTPX directly from the command-line...Sending a request...FeaturesHTTPX builds on the well-established usability ofrequests, and gives you:A broadlyrequests-compatible API.An integrated command-line client.HTTP/1.1and HTTP/2 support.Standard synchronous interface, but withasync support if you need it.Ability to make requests directly toWSGI applicationsorASGI applications.Strict timeouts everywhere.Fully type annotated.100% test coverage.Plus all the standard features ofrequests...International Domains and URLsKeep-Alive & Connection PoolingSessions with Cookie PersistenceBrowser-style SSL VerificationBasic/Digest AuthenticationElegant Key/Value CookiesAutomatic DecompressionAutomatic Content DecodingUnicode Response BodiesMultipart File UploadsHTTP(S) Proxy SupportConnection TimeoutsStreaming Downloads.netrc SupportChunked RequestsInstallationInstall with pip:$pipinstallhttpxOr, to include the optional HTTP/2 support, use:$pipinstallhttpx[http2]HTTPX requires Python 3.8+.DocumentationProject documentation is available athttps://www.python-httpx.org/.For a run-through of all the basics, head over to theQuickStart.For more advanced topics, see theAdvanced Usagesection, theasync supportsection, or theHTTP/2section.TheDeveloper Interfaceprovides a comprehensive API reference.To find out about tools that integrate with HTTPX, seeThird Party Packages.ContributeIf you want to contribute with HTTPX check out theContributing Guideto learn how to start.DependenciesThe HTTPX project relies on these excellent libraries:httpcore- The underlying transport implementation forhttpx.h11- HTTP/1.1 support.certifi- SSL certificates.idna- Internationalized domain name support.sniffio- Async library autodetection.As well as these optional installs:h2- HTTP/2 support.(Optional, withhttpx[http2])socksio- SOCKS proxy support.(Optional, withhttpx[socks])rich- Rich terminal support.(Optional, withhttpx[cli])click- Command line client support.(Optional, withhttpx[cli])brotliorbrotlicffi- Decoding for "brotli" compressed responses.(Optional, withhttpx[brotli])A huge amount of credit is due torequestsfor the API layout that
much of this work follows, as well as tourllib3for plenty of design
inspiration around the lower-level networking details.HTTPX isBSD licensedcode.Designed & crafted with care.— 🦋 —Release InformationAddedAdd missing type hints to few__init__()methods. (#2938)Full changelog
Package: httpx-ws
HTTPX WSWebSockets support for HTTPXDocumentation:https://frankie567.github.io/httpx-ws/Source Code:https://github.com/frankie567/httpx-wsInstallationpipinstallhttpx-wsFeaturesSync and async clientHelper methods to send text, binary and JSON dataHelper methods to receive text, binary and JSON dataAutomatic ping/pong answersHTTPX transport to test WebSockets defined in ASGI appsAutomatic keepalive pingasyncioandTriosupport throughAnyIOContributors ✨Thanks goes to these wonderful people (emoji key):François Voron🚧💻Kousik Mitra💻David Brochart📦ysmu🐛Sam Foreman🐛Marc-Antoine Parent🐛💻Marcelo Trylesinski🐛🔬MtkN1🐛🔬Tom Christie🐛🔬David Montague🐛This project follows theall-contributorsspecification. Contributions of any kind welcome!DevelopmentSetup environmentWe useHatchto manage the development environment and production build. Ensure it's installed on your system.Run unit testsYou can run all the tests with:hatchruntestFormat the codeExecute the following command to apply linting and check typing:hatchrunlintLicenseThis project is licensed under the terms of the MIT license.
Package: httpxy
httpxyHTTP client with yaml supportAdds minor convenience features to the excellenthttpxlibrary which aims to make working withyamleasier and safer.Installationpip install httpxyFeaturesAlways usesafe_load().DONEResponseobjects have aresponse.yaml()for deserializing YAML to adict.DONEAutomatic serialization of objects to yaml.TODOAutomatic deserializing of yaml to python objects/classes/models.TODOWorks with multiple yaml packages.TODOExamplesDeserialize directly fromResponseobjects.Equivalent toresponse.json().importhttpxyfrompprintimportpprintresponse=httpxy.get("https://mockbin.org/request",headers={"accept":"application/yaml"})dict_from_yaml=response.yaml()pprint(dict_from_yaml,sort_dicts=False,depth=1){'startedDateTime':'2021-03-06T19:54:03.157Z','clientIPAddress':'99.99.999.999','method':'GET','url':'https://mockbin.org/request','httpVersion':'HTTP/1.1','cookies':None,'headers':{...},'queryString':{},'postData':{...},'headersSize':559,'bodySize':0}print(response.text)startedDateTime:'2021-03-06T19:54:03.157Z'clientIPAddress:99.99.999.999method:GETurl:'https://mockbin.org/request'httpVersion:HTTP/1.1cookies:headers:host:mockbin.orgconnection:closeaccept-encoding:gzipx-forwarded-proto:httpcf-visitor:'{"scheme":"https"}'accept:application/yamluser-agent:python-httpx/0.17.0queryString:{}postData:mimeType:application/octet-streamtext:""params:[]headersSize:559bodySize:0