Saravanan666/pypi-org huggingface dataset:
Package: api-tackle
Simple Python REST API Framework …QuickstartSeehttps://github.com/praekelt/api-tackle-example-appfor an example of how to build an API-Tackle application.A simple wsgi example application looks like:""" WSGI Flask App for production hosting with e.g.: gunicorn --bind 0.0.0.0:80 -w 1 -t 120 wsgi """importosimportloggingfromtackle.flask_utilsimportcreate_flask_app# noqafromtackle.flask_utilsimportsetup_logging# noqafromtackle.prometheus_utilsimportcreate_prometheus_server# noqafromtackle.rest_api.wrapper_utilimportadd_auth_token# noqafrommy_api.rest_apiimportget_path# noqacreate_prometheus_server(9100)setup_logging(requested_logging_path='~/.tackle/logs',include_prometheus=True)flask_app=create_flask_app(specification_dir=get_path()+'',add_api=True,swagger_ui=True,database_url='sqlite://',database_create_tables=True,debug=False)# === Add some auth tokens to the DB ===add_auth_token('tackleb6-12dd-4104-a7b6-f7d369ff5fec',"Default token e.g. internal hosting.")# === ===logging.info(f"rest_wsgi_app.py: __name__ =={__name__}")application=flask_app.appif__name__=="__main__":logging.info(f"rest_wsgi_app.py: __main__ Starting Flask app in Python __main__ .")flask_app.run()Building your own API…
Package: apitalker
ApitalkerTable of ContentsAboutDocumentationGetting StartedUsageExamplesAboutPython3 library. Wrapper forApitalks APIcalls. Enables simple calls for api resources with optional use of available parameters, as specified inApitalks documentation.Returned data (when methodapitalker.api.API.get_data()is used) are handled byapitalker.data.Dataclass, which provides some convenient methods for working with data.DocumentationDocumentation including examples isHERE.Getting StartedThese instructions will get you up and running.PrerequisitesWhat things you need to install the software.- Python 3+

- requests

- pandasInstallingTo install this package, simply use standardpip install apitalkeror clone this repo and runpython setup.py install.UsageSee examples inDocumentation
Package: apitally
API monitoring made easy.Apitally is a simple and affordable API monitoring solution with a focus on data privacy. It is easy to set up and use for new and existing API projects using Python or Node.js.🔗apitally.ioApitally client library for PythonThis client library for Apitally currently supports the following Python web
frameworks:FastAPIStarletteFlaskDjango NinjaDjango REST FrameworkLearn more about Apitally on our 🌎websiteor check out
the 📚documentation.Key featuresMiddleware for different frameworks to capture metadata about API endpoints,
requests and responses (no sensitive data is captured)Non-blocking clients that aggregate and send captured data to Apitally in
regular intervalsInstallUsepipto install and provide your framework of choice as an extra, for
example:pipinstallapitally[fastapi]The available extras are:fastapi,starlette,flaskanddjango.UsageOursetup guidesinclude all the details
you need to get started.FastAPIThis is an example of how to add the Apitally middleware to a FastAPI
application. For further instructions, see oursetup guide for FastAPI.fromfastapiimportFastAPIfromapitally.fastapiimportApitallyMiddlewareapp=FastAPI()app.add_middleware(ApitallyMiddleware,client_id="your-client-id",env="dev",# or "prod" etc.)FlaskThis is an example of how to add the Apitally middleware to a Flask application.
For further instructions, see oursetup guide for Flask.fromflaskimportFlaskfromapitally.flaskimportApitallyMiddlewareapp=Flask(__name__)app.wsgi_app=ApitallyMiddleware(app,client_id="your-client-id",env="dev",# or "prod" etc.)DjangoThis is an example of how to add the Apitally middleware to a Django Ninja or
Django REST Framework application. For further instructions, see oursetup guide for Django.In your Djangosettings.pyfile:MIDDLEWARE=["apitally.django.ApitallyMiddleware",# Other middleware ...]APITALLY_MIDDLEWARE={"client_id":"your-client-id","env":"dev",# or "prod" etc.}Getting helpIf you need help pleasecreate a new discussionon GitHub orjoin our Slack workspace.LicenseThis library is licensed under the terms of the MIT license.
Package: apitest
apitestapitest: Testing your API for securityCurrent version1.0.0-alpha1Project sitehttps://github.com/bbva/apitestIssueshttps://github.com/bbva/apitest/issues/Documentationhttps://apitest.readthedocs.org/AuthorsDaniel Garcia (cr0hn)Latest Version1.0.0Python versions3.5 or aboveWhat’s apitestA Docker analysis toolsVery quick installInstall from Pypi>python3.5-mpipinstallapitestFrom source>gitclonehttps://github.com/bbva/apitest.gitapitest>cdapitest>python3.5setup.pyinstallShow options:>apitest-hDocumentationGo to documentation site:https://apitest.readthedocs.org/ContributingAny collaboration is welcome!There’re many tasks to do.You can check theIssuesand send us a Pull Request.Also you can read theTODOfile.LicenseThis project is distributed underMIT license
Package: apitester
#apitesteran api test generating tool by referencing Open API Documentationinput - OpenAPI Spec Document (Formats Supported - .yaml & .json)output - pytest cases covering all the combinations of inputs as per Spec Document###processRead OpenAPI SpecGenerate Meta Information about the Complete API SpecList out Test Suite for each URIList out Input Variables for each API RequestList out Input Variables Test Values for ArgumentsGenerate the TestCases considering all Permutation n Combinations of the Input ValuesGenerate pytest suites for Each API
Package: api-testing
api-testing: API Testing framework for functional testing of REST APIsGet started with writing API tests in an easy and simplified way. No boilerplate code requiredThis API testing framework created using python make itsimple to write and  maintain testsfor REST APIs without worrying about writing extra boilerplate code.You can mention the REST API server details like server address, port number and credentials in theglobal configuation fileand then directly start writing test cases under tests folder.All the reusable functions likeHTTP server methodsare provided under the HTTP utility class. There is aAuthentication helperclass also available for authentication of user and fetching authorization token from the API server.Pytest fixtures are used to implement thesetup and teardown methodsfrom HTTP utility class and Authentication helper class. Before a test case runs, the Authentication helper class authenticates user and fetches the authorization token. Then, the Http utiliy class is initialized and the authorization token is set in the request headers. After the test case run is completed, the authorization token is deleted also from the API server.You can start writing the test cases directly and call the HTTP utility class methods to perform the REST API operations. You can use Pytest assertions to assert on the REST API operation result.Installation and how to run the testsPlease make sure you have python version greater than or equal to 3.7 installed on your system. You can install it from official python website:https://www.python.org/downloads/release/python-379/Download or clone the code from the api-testing GitHub repository to your systemhttps://github.com/luvsharma19/api-testingGo to the directory location of downloaded or cloned code folder - "api-testing"cdapi-testingRun the following command to install the dependencies listed in requirements.txtpipinstall-rrequirements.txtWrite test cases under the folder "tests". ( A example test case for creating a user is already present in the folder )Run the following command to run the test cases written under the "tests" folderpytest.You can go through the folder structure of the api-testing module to get familier with testing framework. Also, all the Pytest commands will work for this testing framework also.Please feel free to provide your feedback and contribute to this project by creating a pull request. You can also reach me via email -luvsharma1931@yahoo.com
Package: apit-lk
## Installation` pip install apit `## Usage
Import` from apit.calc import calculate_apit calculate_apit(gross_income) `## Roadmap[x] Add Monthly Tax Deductions from Regular Profits from Employment APIT calculation[ ] Add Tax breakdown[ ] Add other calculation methods with breakdown ( ex: Lump-Sum-Payments,Tax-on-Tax Rates,Bonus..etc)## ContactDinuth Perera - +94776793824 -pm@dinuth.me## AcknowledgmentsFind from below offical Advance Personal Income Tax Tables​​​ & Rules.[Sri Lanka IRD - Advance Personal Income Tax Tables​​​ ](http://www.ird.gov.lk/en/publications/sitepages/apit_tax_tables.aspx?menuid=1502)
Package: apito
ApitoThis tool accesses the API directly, rather than loading the site and iterating over the tags.Installationpython-mpipinstall-Uapito# ORgitclonehttps://github.com/WhiteApfel/apito.gitcdapito
pythonsetup.pyinstallHow to usefromapitoimportApito,Aiopitoa=Apito()# Aiopito -- asyncresponse=a.search('Моё сердечко',proxy="socks5://ya_slovno:vys0hsHaYa@luzha:2005")ifresponse.status=='ok':print('Total found: ',response.result.total_count())foriteminresponse.result.items:print(f'{item.value.title}@{item.value.locationoritem.value.address}')print(f'Price:{item.value.price}')results=a.search_generator("Упущенные возможности")foriteminresults:print(f"{item.value.title}#{item.value.id}")
Package: apitoolbox
APIToolboxFull-stack, asynchronous Python3 framework.Design goalsFast, full-service frameworkModular approach that does not force any design decisionsGetting startedfromfastapiimportFastAPI,Requestfromapitoolboximportcrud,db_registryfromapitoolbox.middlewareimportSessionMiddlewarefromapitoolbox.modelsimportBASE,Session,UserDATABASE_URL="sqlite:///sqlite.db?check_same_thread=False"# Define our modelclassMyUser(User):pass# Instantiate the applicationapp=FastAPI()app.add_middleware(SessionMiddleware,bind=DATABASE_URL)# Create all tablesbind=db_registry.get_or_create(DATABASE_URL)BASE.metadata.create_all(bind=bind)# Load some datasession=Session()fornamein["alice","bob","charlie","david"]:user=MyUser.get_by_username(session,name)ifuserisNone:user=MyUser(username=name)session.add(user)session.commit()# Add an endpoint@app.get("/users")asyncdeflist_users(request:Request):returnawaitcrud.list_instances(MyUser,request.state.session)Assuming the above code is stored in the filemain.py, then run it via:uvicornmain:app--reloadCall the endpoint:curl-slocalhost:8000/users|jq.The output should contain a list of 4 users,
each with the attributesid,username,updated_atandcreated_at.NOTE: Sqlite3 really doesn't like multiple threads using the same connection (hencecheck_same_thread=False).
In this case, it's safe but in production a different database should be used.
Package: apitoolkit-fastapi
API Toolkit Python FastAPI SDKThe API Toolkit FastAPI client is an sdk used to integrate FastAPI web services with APIToolkit.
It monitors incoming traffic, gathers the requests and sends the request to the apitoolkit servers.Design decisions:Use the gcp SDK to send real time traffic from REST APIs to the gcp topicHow to Integrate:First install the apitoolkit Go sdk:pip install apitoolkit-fastapiThen add apitoolkit to your app like so (Gin example):from fastapi import FastAPIfrom apitoolkit_fastapi import APIToolkitapp = FastAPI()# Initialize apitoolkitapitoolkit = APIToolkit(api_key='<API_KEY goes here>')app.middleware('http')(apitoolkit.middleware)@app.get("/")def read_root():return {"Hello": "World"}Client Redacting fieldsWhile it's possible to mark a field as redacted from the apitoolkit dashboard, this client also supports redacting at the client side.
Client side redacting means that those fields would never leave your servers at all. So you feel safer that your sensitive data only stays on your servers.To mark fields that should be redacted, simply add them to the apitoolkit config struct.
Eg:fromfastapiimportFastAPIfromapitoolkit_fastapiimportAPIToolkitapp=FastAPI()# A list of fields to redact from response bodyredact_res=["$.api_key","$.password"]# A list of fields to redact from request bodyredact_req=["$.credit-card.cvv","$.credit-card.name"]# A list of fields to redact from request and repsonse headersredact_headers=["Authorization","Cookie"]# Initialize apitoolkitapitoolkit=APIToolkit(api_key="<API_KEY>",debug=True,redact_response_body=redact_res,redact_request_body=redact_req,redact_headers=redact_headers)app.middleware('http')(apitoolkit.middleware)@app.get("/")defread_root():return{"Hello":"World"}It is important to note that while theredact_headersconfig field accepts a list of headers(case insensitive),
theredact_request_bodyandredact_response_bodyexpect a list of JSONPath strings as arguments.The choice of JSONPath was selected to allow you have great flexibility in descibing which fields within your responses are sensitive.
Also note that these list of items to be redacted will be aplied to all endpoint requests and responses on your server.
To learn more about jsonpath to help form your queries, please take a look at this cheatsheet:https://lzone.de/cheat-sheet/JSONPath
Package: apitoolkit-flask
API Toolkit Python Flask SDKThe API Toolkit Flask client is an sdk used to integrate flask web services with APIToolkit.
It monitors incoming traffic, gathers the requests and sends the request to the apitoolkit servers.Design decisions:Use the gcp SDK to send real time traffic from REST APIs to the gcp topicHow to Integrate:First install the apitoolkit flask sdk:pip install apitoolkit-flaskThen add apitoolkit to your app like so (flask example):fromflaskimportFlaskfromapitoolkit_flaskimportAPIToolkitapp=Flask(__name__)apitoolkit=APIToolkit(api_key="<API_KEY>",debug=True)@app.before_requestdefbefore_request():apitoolkit.beforeRequest()@app.after_requestdefafter_request(response):apitoolkit.afterRequest(response)returnresponse@app.route('/hello',methods=['GET','POST'])defsample_route(subject):return{"Hello":"World"}app.run(debug=True)This will monitor all requests and send them to the APIToolkit's servers.Client Redacting fieldsWhile it's possible to mark a field as redacted from the apitoolkit dashboard, this client also supports redacting at the client side.
Client side redacting means that those fields would never leave your servers at all. So you feel safer that your sensitive data only stays on your servers.To mark fields that should be redacted, add them to the APIToolkit constructor.
Eg:fromflaskimportFlaskfromapitoolkit_flaskimportAPIToolkitapp=Flask(__name__)# A list of fields to redact from response bodyredact_res=["$.api_key","$.password"]# A list of fields to redact from request bodyredact_req=["$.credit-card.cvv","$.credit-card.name"]# A list of fields to redact from request and repsonse headersredact_headers=["Authorization","Cookie"]apitoolkit=APIToolkit(api_key="<API_KEY>",debug=True,redact_response_body=redact_res,redact_request_body=redact_req,redact_headers=redact_headers)@app.before_requestdefbefore_request():apitoolkit.beforeRequest()@app.after_requestdefafter_request(response):apitoolkit.afterRequest(response)returnresponse@app.route('/hello',methods=['GET','POST'])defsample_route(subject):return{"Hello":"World"}app.run(debug=True)It is important to note that while theredact_headersconfig field accepts a list of headers(case insensitive),
theredact_request_bodyandredact_response_bodyexpect a list of JSONPath strings as arguments.The choice of JSONPath was selected to allow you have great flexibility in descibing which fields within your responses are sensitive.
Also note that these list of items to be redacted will be aplied to all endpoint requests and responses on your server.
To learn more about jsonpath to help form your queries, please take a look at this cheatsheet:https://lzone.de/cheat-sheet/JSONPath
Package: apitracker-agent
This is API Tracker agent for Python. API Tracker tracks and manages 3rd party API. It let developers quickly add best practices
in integrating with 3rd party API, for example: logging, alerting, auto retry, request queuing and moreSign up athttps://apitracker.comfor a free accountInstallapitracker-agent is available on PyPI and thus can be installed with pip on most platforms.:$ pip install apitracker-agentDocumentationSee the documentation athttps://docs.apitracker.com/docs/python-agent
Package: apium-dev
Python JSON-RPC FrameworkInstallpip install apium-devExampleCreate RPC methodEach method must be in path: api/<method_name>/method.pyCreate fileapi/hello/method.py:importapiumfromapiumimportafclassHello(apium.Method):name=af.Str(required=True)age=af.Int(default=18)defexecute(self):return{'msg':f'Hi{self.name}, you are{self.age}'}Settings web-frameworkAssociate URL to handler.DjangoEditurls.pyin your django project:fromdjango.urlsimportpathfromapium.handlers.django.handlerimportapi_handlerurlpatterns=[# ... your other path, e. g. 'admin/'path('api/',api_handler),]Flask#!/usr/bin/env pythonfromflaskimportFlaskfromapium.handlers.flask.handlerimportapi_handlerapp=Flask(__name__)app.add_url_rule('/api/',view_func=api_handler,methods=['POST'])app.run('localhost',8080,debug=True)JSON-RPC requestFirst example (withoutage)JSON:{"jsonrpc":"2.0","id":1,"method":"hello","params":{"name":"John"}}Send request:curl http://127.0.0.1:8080/api/ \
    -X POST \
    -H 'Content-Type: application/json' \
    -d '{"jsonrpc": "2.0", "id": 1, "method": "hello", "params": {"name": "John"}}'Response:{"jsonrpc":"2.0","id":1,"result":{"msg":"Hi John, you are 18"}}Second example (withage)JSON:{"jsonrpc":"2.0","id":1,"method":"hello","params":{"name":"Smith","age":20}}Send request:curl http://127.0.0.1:8080/api/ \
    -X POST \
    -H 'Content-Type: application/json' \
    -d '{"jsonrpc": "2.0", "id": 1, "method": "hello", "params": {"name": "Smith", "age": 20}}'Response:{"jsonrpc":"2.0","id":1,"result":{"msg":"Hi Smith, you are 20"}}
Package: apiutils
CONSTANCE 配置:CONSTANCE_CONFIG = OrderedDict((
    ('SL_CPROFILE_LOG', (False, '请求函数耗时统计')),
    ('SL_CPROFILE_LOG_MIN_SECONDS', (10, '函数耗时LOG最小时间')),
    ('SL_CPROFILE_LOG_SKIP_PATH', ("", '请求函数耗时统计排除URL')),
    ('SL_CPROFILE_LOG_WHITE_PATH', ("", '关闭函数耗时统计时仍然统计的URL')),
    ('SL_LONG_TIME_MAIL_MIN_SECONDS', (20, '函数耗时mail最小时间')),
    ('SL_LONG_TIME_COUNT_MIN_SECONDS', (10, '函数耗时记录到长时间统计')),

    ('VERIFY_CODE_MOBILE_COUNT', (10, '每个手机号每天可发送次数')),
    ('VERIFY_CODE_WHITE_LIST_MOBILES', ('13800138000', '白名单手机号(逗号隔开)')),
    ('VERIFY_CODE_WHITE_LIST_CODE', ('6379', '白名单验证码')),
    ('VERIFY_CODE_SEND_EXPIRE_SECONDS', (60, '验证码发送限制秒数, 成功发送验证码后再次请求将在该时间过后才会重新发送')),
    ('VERIFY_CODE_EXPIRE_SECONDS', (1800, '验证码默认过期秒数')),
    ('VERIFY_CODE_MAX_TIMES', (10, '验证码可验证次数, 达到验证码次数后重新发送才能继续验证')),
    ('VERIFY_CODE_SMS_CONTENT', ('直接发送短信以验证手机号，半小时内发送有效', '验证码上行说明文字')),
))settings配置:def async_call(func, *args, **kwargs):
    return func(*args, **kwargs)

SERVER_IP
SMS_ACCESS_KEY_ID = '阿里短信key'
SMS_ACCESS_KEY_SECRET = '阿里短信secret'
SMS_SIGNNAME_VCODE = '验证码短信签名'
SMS_TEMPLATE_VCODE = '验证码短信模板id'
SMS_TEMPLATE_VCODE_PARAM = '验证码短信模板参数明'
Package: api-utils
API utilsAPI utils simplify life when creating or consuming APIsModule: apiu.pathMethod: apiu.path.join()Join one or more path components intelligently.Rules:If any component starts with "http", all previous parts will be discarded.The returned path will always start with "/", except if it starts with "http".The returned path will never end with "/", except when ending in a protocol
notation ("://") or enforced (see below)A trailing slash can be enforced with a final component "/"Empty strings are skipped
Package: apiview-stub-generator
API Stub GeneratorAzure SDK API review tool is used to review all published Azure SDK APIs and this review tool works for all language format. API tool needs a stub file generated in json format with tokens to list APIs in review tool. API stub generator package is developed to create a stub file with api surface level information. Following are the main published components included in this stub file.- Classes and module level functions
- Instance methods
- Class and Instance variables
- PropertiesSteps to create API reviewFollowing are the steps to create an API review request for python package.Generate stub file tokensUpload stub file tokens into API review portalGenerate stub Fileapiview-stub-generatorpackage is used to generate stub file tokens from either source code repo or from prebuilt wheel package. Following are the steps to generate stub file token.Installapiview-stub-generatorpackage. From the root of the apiview-stub-generator package, run:pip install . --extra-index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"Runapistubgencommand with source repo or whl package as parameter and this will generate a json file with tokens.Help for apistubgenapistubgen --pkg-path <path to package root>This also takes an optional parameter to mention output path where json token file will be generated. If out-path is not given then file will be generated in current working directory.apistubgen --pkg-path <path to package root> --out-path <Outpath path>Sample:apistubgen --pkg-path C:\git\azure-sdk-for-python\sdk\core\azure-core
apistubgen --pkg-path C:\git\azure-sdk-for-python\sdk\core\azure-core --out-path C:\outToken file will be created with a naming convention `_python.json'Upload token file to API review portalGo tohttps://apiview.devClick onCreate reviewSelect generated token file and upload
Package: apiwrapper
Simple API WrapperFree software: BSD licenseDocumentation:https://apiwrapper.readthedocs.org.OverviewRecently noticed a pattern and repeated pieces of code in Python API wrappers for simple requests and polling. A separate Python package will minimize code duplication and encourage de-coupling of logic from the API request functions.InstallationAt the command line:$ easy_install apiwrapperOr, if you have virtualenvwrapper installed:$ mkvirtualenv apiwrapper
$ pip install apiwrapperGetting started with a simple request# as a helper classfromapiwrapperimportAPIWrappermy_api=APIWrapper()url='https://api.github.com/users/ardydedase/repos'resp=my_api.make_request(url=url)print(resp)# as a parent classclassGithubAPI(APIWrapper):defget_repos(self,username):"""
        Uses `make_request` method
        """url="https://api.github.com/users/{username}/repos".format(username=username)returnself.make_request(url,method='get',headers=None,data=None,callback=None)More features including pollingRead the docs:https://apiwrapper.readthedocs.org/en/latest/usage.htmlOr useapiwrapper/apiwrapper.pyas a reference. Implementation is straightforward.History0.1.0 (2015-01-11)First release on PyPI.
Package: apix
apixExample# models.pyfromapiximportSchema,Path,PathInfoclassData(Schema):key:strvalue:strclassGetData(Path[Data]):__info__=PathInfo("GET","/data",Data)key:str# sync.pyfromapix.syncimportSyncClientclassMySyncClient(SyncClient):BASE_URL="https://my.api"defget_data(self,key:str)->Data:returnself(GetData(key=key))# main.pyfromapiximportConfigwithMySyncClient()asclient:print(client.get_data("Key"))# "Value"SerializersmsgspecHttp Clientshttpx
Package: apix-cli
apixApiXCommand Line ToolInstallationInstall from PyPI:pipinstallapix-cliQuickstartOn first launch, you will be asked to enter certain parameters.Create project :project nameis the name of the online database you want to create locally.apixprojectnew<projectname>Run project :apixprojectrun<projectname>--reloadUpdate modules :apixprojectupdate-modules<projectname><databasename>module1,module2DocumentationPlease refer to :https://apikcloud.github.io/apix-cli/