Saravanan666/pypi-org huggingface dataset:
Package: rest-api-auth-manager
rest-api-simple-auth-managerSimple REST API authentication and authorization manager, designed to operate with token-based security. This package is intended to act as a middleware, providing a secure method for verifying user credentials before granting access to the requested resource.The current implementation relies on a Redis instance to store and manage credentials. However, we are working on integrating other database options to offer more flexibility and customization.Installpipinstallrest_api_auth_managerInitializing the auth managerfromrest_api_auth_managerimportAuthManager,ConfigclassCustomConfig(Config):credentials_database_host="127.0.0.1"environment="dev"token_length=16auth_manager=AuthManager(CustomConfig)Add new useruser={"alias":"ASH_KETCHUM","name":"Ash Ketchum","email":"ash@test.com","roles":["pokemons:get"],}token=auth_manager.add_user(user)Granting usage on a specific resourceauth_manager.add_role_to_user("ASH_KETCHUM","pokemons:post")Verifying requests authentication and authorizationtoken="SUPER_SECRET"auth_manager.verify_auth(token,"api/pokemon","GET")
Package: restapi-client
RESTAPI-CLIENTThis lib is used for call RestApi services.InstallingIn your python environment use this command:$ pip install restapi-clientUsageFormat of calls:<myserver.com>.<endpoint>.[save,get(id),get_all,delete(id),update(id,data)]Example:from restapi import Client
api = Client()
ret = api.<endpointname>.get()
api.<endpointname>.save(dict_data)
ret = api.<endpointname>.get(“<the_id>”)
api.<endpointname>.update(“<the_id>”, dict_data)
api.<endpointname>.delete(“<the_id>”)
Package: restapidoc
RESTful api documentation generation script===================script to generate restful api documentation out of annotated php code. [Output example you can find here](http://htmlpreview.github.io/?https://raw.github.com/dzhibas/rest-api-doc/master/documentation.html)annotation example/*** @route /v1/modulename/authentication* @method POST* @ingroup modulename** authentication service example** HTTP response code tells about status of login:** - 202: Request Accepted* - 401: Invalid username/password* - 403: Request Denied* - 503: Service Unavailable** @example input** POST /v1/modulename/authentication HTTP/1.1* Content-Type: application/json; charset=utf-8** {*  "username": "demousername",*  "passwrod": "demopassword",* }** @example output** {*  "message":"Request Accepted",*  "id":386* }** @jsonparam username extranet username required* @jsonparam password extranet password required** @returns json*/Installation==pip install -r requirements.txtUsage==$ python parse.py -cHelp==usage: parse.py [-h] [-c] [-d DIR] [--filter FILTER] [-o OUTPUT]optional arguments:-h, --help            show this help message and exit-c, --coverage        ouputs into stdin documentation coverage-d DIR, --dir DIR     folder in which we need look for documentationannotation. default: test_src_folder/--filter FILTER       gob filter in which files to search. default:*Controler*.php-o OUTPUT, --output OUTPUToutput filename. default: documentation.htmlopen generated documentation.html
Package: rest-api-lib-creator
REST API lib creatorREST API lib creator is a boilerplate-free way for creating libs for RESTful APIs (specially the ones created usingDjango REST framework- but certainly adaptable for other frameworks).NOTES:This is a port for a personal project I made for myself. It may or may not solve your needs (it solves mine).This is still alpha. I opened this on GH just so I can see if this is something I should improve (or not).Examples:The bare minimum for creating your own lib:fromrest_api_lib_creator.coreimportViewsetRestApiLibclassUser(ViewsetRestApiLib):base_api_url='http://super.cool/api/users'With this you can play around with your API:users=User.list()# Triggers a requests.get with url=http://super.cool/api/usersisinstance(users[0],User)user=User.create(first_name='Filipe',last_name='Waitman',email='filwaitman@gmail.com',photo=open('image.png','rb'))# Triggers a requests.post with url=http://super.cool/api/users and data={'first_name': 'Filipe', 'last_name': 'Waitman', 'email': 'filwaitman@gmail.com'} and files={'photo': <file binary content>}# Similarly to the call above you could create an empty object and save it:user=User()user.first_name='Filipe'user.last_name='Waitman'user.email='filwaitman@gmail.com'user.photo=open('image.png','rb')user.save()# Triggers a requests.post with url=http://super.cool/api/users and data={'first_name': 'Filipe', 'last_name': 'Waitman', 'email': 'filwaitman@gmail.com'} and files={'photo': <file binary content>}isinstance(user,User)print(user.id)# Prints the user id (assuming the API returned this field)print(user.first_name)# )rints the user first name (assuming the API returned this field)user.first_name='New name'user.save()# Triggers a requests.patch with url=http://super.cool/api/users/<user-id> and data={'first_name': 'New name'}user.delete()# Triggers a requests.delete with url=http://super.cool/api/users/<user-id>If your resource return other nested resources you can parse them as well:classPet(ViewsetRestApiLib):base_api_url='http://super.cool/api/pets'nested_objects={'owner':User,}pet=Pet.retrieve('pet-id')isinstance(pet,Pet)isinstance(pet.owner,User)See a more complete (and real world) examplehereYou can see all possible customizationshere(someday I'll improve this doc).Special thanks:Django REST framework- you're the best, seriously.Stripe-python lib- which I used as an inspiration to create this project.Development:Run linter:pipinstall-rrequirements_dev.txt
isort-rc.
tox-elintRun tests viatox:pipinstall-rrequirements_dev.txt
toxRelease a new major/minor/patch version:pipinstall-rrequirements_dev.txt
bump2version<PART># <PART> can be either 'patch' or 'minor' or 'major'Upload to PyPI:pipinstall-rrequirements_dev.txt
pythonsetup.pysdistbdist_wheel
python-mtwineuploaddist/*Contributing:Pleaseopen issuesif you see one, orcreate a pull requestwhen possible.
In case of a pull request, please consider the following:Respect the line length (132 characters)Write automated testsRuntoxlocally so you can see if everything is green (including linter and other python versions)
Package: restapi-logging-handler
# Python RESTful API Asyncronous Logging Handler with Loggly SupportA simple logging handler for python that will send any logging events out to aRESTful API using HTTP POST requests. Fully asyncronuous using requests-futures,tested for Python 2 & 3, and has support for Loggly.## Installationpip install restapi-logging-handler## UsageImport whichever module(s) you need:```from restapi_logging_handler import RestApiHandlerfrom restapi_logging_handler import LogglyHandler```### RESTful API UsageSet your Python logging handler to send logs to a REST-ful API```logger = logging.getLogger(__name__)restapiHandler = RestApiHandler('http://my.restfulapi.com/endpoint/')logger.addHandler(restapiHandler)logger.setLevel(logging.INFO)logger.info("Send this to my RESTful API")```By default, it sends the log data as a JSON object. You can currently changethat to send text instead.```restapiHandler = RestApiHandler('http://my.restfulapi.com/endpoint/', 'text')```### Loggly UsageSet your Python logging handler to send logs out to your Loggly account. Thehandler collects logs in a batch and sends them out every `interval` seconds.After the interval passes, Loggly is sent all the logs collected. There are`max_attempts` attempts to send the logs before the internal handleError() methodand an exception are thrown.####Parameters- custom_token: The LogglyHandler takes as its first argument the custom token given to youwhen you sign up for a Loggly account.- app_tags: The second argument can be a tag string,or a list of tags to be associated with the log inside of Loggly.- interval: defaults to 1 second- max_attempts: defaults to 5 attempts```logglyHandler = LogglyHandler(custom_token='loggly-custom-key',app_tags=['tag1','tag2',...],interval=1.0,max_attemps=5)```## TestingInstall tox and run it to test against Python 2 and 3.```sudo pip install nosetox```## ForkingIf you'd like to extend this to include more REST-ful API's than just Loggly,send me a pull request!
Package: rest-api-payload
Production API PayloadA to-go-to production API payload with an easy format for building APIs with Python.QuickstartTo get it running, follow the steps below:1). Pip install the package in your project terminal:pipinstallrest-api-payload2). In the file (.py) that you wish to use it, import it:fromrest_api_payloadimportsuccess_response,error_responseThat's pretty much it - you can now call the function and pass the required arguments!ExampleSuppose you have a function that returns a response to the client:...deflist_of_posts(request):"""Returns a list of posts"""post=Post.objects.all()post_serializer=PostSerializer(post,many=True)returnResponse(post_serializer.data)The above response output would be:[{"title":"First blog post","content":"Lorem ipsume content","author":1},{"title":"Second blog post","content":"Lorem ipsume content","author":2},{"title":"Third blog post","content":"Lorem ipsume content","author":3}]This works too, but let's take the function to the next level by doing this:...fromrest_api_payloadimportsuccess_responsedeflist_of_posts(request):"""Returns a list of post"""post=Post.objects.all()post_serializer=PostSerializer(post,many=True)payload=success_response(status=True,message="Post retrieved!",data=post_serializer.data)returnResponse(data=payload,status=status.HTTP_200_OK)The above response output would be:["status":true,"message":"Posts retrieved!","data":{{"title":"First blog post","content":"Lorem ipsume content","author":1},{"title":"Second blog post","content":"Lorem ipsume content","author":2},{"title":"Third blog post","content":"Lorem ipsume content","author":3}}]I built this payload because of a project I took lead in building from scratch - and literally had to sympathize with the frontend (web and mobile) engineers. I hope you find this package useful, kindly leave a star if you did.ContributeAll contributions are welcome:Read the issues, Fork the project and do a Pull Request.Request a new topic creating aNew issuewith theenhancementtag.Find any kind of errors in theREADMEand create aNew issuewith the details or fork the project and do a Pull Request.Suggest a better or more pythonic way for existing examples.
Package: rest-api-response
Production API ResponseA go-to production API response with an easy format for building APIs with Python.QuickstartTo get it running, follow the steps below:1). Pip install the package in your project terminal:pipinstallrest-api-response2). In the file (.py) that you wish to use it, import it:fromrest_api_responseimportsuccess_response,error_responseThat's pretty much it - you can now call the function and pass the required arguments!ExampleSuppose you have an API class that returns a list of blog posts to a client:# imports goes here...classPostListAPIView(views.APIView):serializer_class=PostSerializerdefget(self,request):"""Returns a list of posts"""posts=Post.objects.all()serializer=self.serializer_class(posts,many=True)returnResponse(serializer.data)The API response would be:[{"title":"First blog post","content":"Lorem ipsume content","author":1},{"title":"Second blog post","content":"Lorem ipsume content","author":2},{"title":"Third blog post","content":"Lorem ipsume content","author":3}]This works too, but let's take the response to the next level by doing this:# imports goes here...fromrest_api_responseimportsuccess_responseclassPostListAPIView(views.APIView):serializer_class=PostSerializerdefget(self,request):"""Returns a list of posts"""posts=Post.objects.all()serializer=self.serializer_class(posts,many=True)_response=success_response(message="Post retrieved!",data=serializer.data)returnResponse(data=_response,status=status.HTTP_200_OK)The API response would be:["status":true,"message":"Posts retrieved!","data":[{"title":"First blog post","content":"Lorem ipsume content","author":1},{"title":"Second blog post","content":"Lorem ipsume content","author":2},{"title":"Third blog post","content":"Lorem ipsume content","author":3}]]And that's it. You have a nicely catchy response. :-)ContributeAll contributions are welcome:Read the issues, Fork the project and do a Pull Request.Request a new topic creating aNew issuewith theenhancementtag.Find any kind of errors in theREADMEand create aNew issuewith the details or fork the project and do a Pull Request.Suggest a better or more pythonic way for existing examples.
Package: restapisdk
Getting Started with RESTAPI SDKInstall the Rest API SDKYou must have Python 3 >=3.7, <= 3.9 installed on your system to use this SDK. This SDK package depends on other Python packages like nose, jsonpickle etc. These dependencies are defined in the requirements.txt file that comes with the SDK. To resolve these dependencies, you can use the PIP Dependency manager. Install it by following steps athttps://pip.pypa.io/en/stable/installing/.Python and PIP executables should be defined in your PATH. Open command prompt and type pip --version. This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined.To install the dependencies create requirements.txt with content thoughtspot-rest-api-sdk, run the commandecho thoughtspot-rest-api-sdk > requirements.txt. Next, run the commandpip install -r requirements.txt. This should install all the required dependencies.To install the SDK, run the commandpip install thoughtspot-rest-api-sdkat the command line.Initialize the API ClientNote:Documentation for the client can be foundhere.The following parameters are configurable for the API Client:ParameterTypeDescriptioncontent_typestringbody content type for post requestDefault:'application/json'accept_languagestringresponse formatDefault:'application/json'access_tokenstringThe OAuth 2.0 Access Token to use for API requests.base_urlstringDefault:'https://localhost:443'environmentEnvironmentThe API environment.Default:Environment.PRODUCTIONhttp_client_instanceHttpClientThe Http Client passed from the sdk user for making requestsoverride_http_client_configurationboolThe value which determines to override properties of the passed Http Client from the sdk usertimeoutfloatThe value to use for connection timeout.Default: 60max_retriesintThe number of times to retry an endpoint call if it fails.Default: 0backoff_factorfloatA backoff factor to apply between attempts after the second try.Default: 2retry_statusesArray of intThe http statuses on which retry is to be done.Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524]retry_methodsArray of stringThe http methods on which retry is to be done.Default: ['GET', 'PUT', 'GET', 'PUT']The API client can be initialized as follows:fromrestapisdk.restapisdk_clientimportRestapisdkClientfromrestapisdk.configurationimportEnvironmentclient=RestapisdkClient(content_type='application/json',accept_language='application/json',access_token='AccessToken',environment=Environment.PRODUCTION,base_url='https://localhost:443',)AuthorizationThis API usesOAuth 2 Bearer token.GuideAPI ReferenceLive PlaygroundWe recommend that you browse through thecode playgroundbefore you start constructing your API requests. The playground offers an interactive portal with comprehensive information about the API endpoints, request and response workflows.
Package: restapisdktest
Getting Started with RESTAPI SDKInstall the Rest API SDKTo install the SDK, run the following command at the command line:pip install thoughtspot-rest-api-sdkInitialize the API ClientNote:Documentation for the client can be foundhere.The following parameters are configurable for the API Client:ParameterTypeDescriptioncontent_typestringbody content type for post requestDefault:'application/json'accept_languagestringresponse formatDefault:'application/json'access_tokenstringThe OAuth 2.0 Access Token to use for API requests.base_urlstringDefault:'https://localhost:443'environmentEnvironmentThe API environment.Default:Environment.PRODUCTIONhttp_client_instanceHttpClientThe Http Client passed from the sdk user for making requestsoverride_http_client_configurationboolThe value which determines to override properties of the passed Http Client from the sdk usertimeoutfloatThe value to use for connection timeout.Default: 60max_retriesintThe number of times to retry an endpoint call if it fails.Default: 0backoff_factorfloatA backoff factor to apply between attempts after the second try.Default: 2retry_statusesArray of intThe http statuses on which retry is to be done.Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524]retry_methodsArray of stringThe http methods on which retry is to be done.Default: ['GET', 'PUT', 'GET', 'PUT']The API client can be initialized as follows:fromrestapisdk.restapisdk_clientimportRestapisdkClientfromrestapisdk.configurationimportEnvironmentclient=RestapisdkClient(content_type='application/json',accept_language='application/json',access_token='AccessToken',environment=Environment.PRODUCTION,base_url='https://localhost:443',)AuthorizationThis API usesOAuth 2 Bearer token.GuideAPI ReferenceLive PlaygroundWe recommend that you browse through thecode playgroundbefore you start constructing your API requests. The playground offers an interactive portal with comprehensive information about the API endpoints, request and response workflows.
Package: rest-api-supporter
rest-api-supporterhttps://pypi.org/project/rest-api-supporter/pip install rest-api-supporterSupported APIsbase64_encodefrom PIL import Image
from rest_api_supporter.utils.base64_encode_image import base64_encode_image

image = Image.open("rock.jpg")
base64_encoded = base64_encode_image(image)
print(base64_encoded) #data:image/png;base64,/9j/4AAQSkZJRgABAQ...2qjR37P/2Q==import datasets
from rest_api_supporter.utils.base64_encode_audio import base64_encode_audio

path = 'up.wav'
dataset = datasets.Dataset.from_dict({"audio": [path]})
dataset = dataset.cast_column("audio", datasets.Audio(sampling_rate=16_000)) #https://huggingface.co/blog/audio-datasets#1-resampling-the-audio-data
array = dataset[0]["audio"]["array"] #numpy array
#sampling_rate = dataset[0]["audio"]["sampling_rate"] #Wav2Vec2FeatureExtractor was trained using a sampling rate of 16000. Please make sure that the provided `raw_speech` input was sampled with 16000 and not 8000.
sampling_rate = 16000
base64_encoded = base64_encode_audio(array)
print(base64_encoded) #data:audio/wav;base64,UklGRiTuAgBXQVZFZm...At84WACNZGwA=from rest_api_supporter.utils.base64_encode_video import base64_encode_video

file = "video.mp4"
with open(file, "rb") as f:
    bytes_value = f.read() #bytes
base64_encoded = base64_encode_video(bytes_value)
print(base64_encoded) #data:video/mp4;base64,/9j/4AAQSkZJRgABAQ...2qjR37P/2Q==base64_decodefrom rest_api_supporter.utils.base64_decode_image import base64_decode_image

base64_encoded = "data:image/png;base64,/9j/4AAQSkZJRgABAQ...2qjR37P/2Q=="
#base64_encoded = "/9j/4AAQSkZJRgABAQ...2qjR37P/2Q==
base64_decoded = base64_decode_image(base64_encoded)
print(type(base64_decoded)) #<class 'PIL.JpegImagePlugin.JpegImageFile'>from rest_api_supporter.utils.base64_decode_audio import base64_decode_audio

base64_encoded = "data:audio/wav;base64,UklGRiTuAgBXQVZFZm...At84WACNZGwA="
#base64_encoded = "/9j/4AAQSkZJRgABAQ...2qjR37P/2Q=="
base64_decoded = base64_decode_audio(base64_encoded)
print(type(base64_decoded)) # #넘파이from rest_api_supporter.utils.base64_decode_video import base64_decode_video

base64_encoded = "data:video/mp4;base64,/9j/4AAQSkZJRgABAQ...2qjR37P/2Q=="
#base64_encoded = "/9j/4AAQSkZJRgABAQ...2qjR37P/2Q=="
base64_decoded = base64_decode_video(base64_encoded)
print(type(base64_decoded)) # #넘파이
Package: restAPY
# restAPYA python module for building Rest APIs## Example`python import restAPY api = restAPY.API(80, “0.0.0.0”)api.set_path(“/”,{“celsius”:5,“fahrenheit”:41})api.run() `Done! Start the python file and you’ve got a working rest API.## InstallationInside the terminal:`bash pip install restAPY `Inside your project:`python import restAPY `## Dependencies#### Python 3.6 (or higher) with the following modules:socketthreadingjsonsslAll of these are part of the default python install and therefore don’t need to be installed separately.## Documentationhttps://restapy.readthedocs.io/## ContributorsNiklas Ziermann## Copyright & License© Niklas ZiermannMIT License
Package: rest_arch
# :punch: Easier To Build Your RESTful App
A Restful Frame Based On Gunicorn## Develop With Me
1. Fork repo
2. Clone to your local
3. Add Remote as upstream
4. Do some change
5. Push to your origin
6. Pull request## Develop
> after you add some future or fix something, you should add unittest for your change>make unittest -sxto make sure test is pass>make pylintcan check your code with flake8>make bump ver=x.x.x.xto bump a new version## Installation
>pip install rest_arch## App struct├── app.yaml
├── foo
│   ├── __init__.py
│   ├── app.py
│   ├── models.py
│   ├── settings.py
├── requirements.txt## Usage
1.skt bootstrapto build a app.
2.cd your_app_pathrunskt serveto start app.
3.skt shellto run a client asc.
4.c.get(‘/ping’)to get a response.## APP&LOGimport logging
from rest_arch.skt.log import setup_loggers
from rest_arch.app import make_appapp = make_app(__name__)setup_loggers(__name__)
logger = logging.getLogger(__name__)logger.info(‘A Test Log Info’)## Contact
1.kiven.mr@gmail.com2. create issue or pull request
Package: restart-datasets
Restart DatasetsA Python package for offline access to data needed to runrestartInstallationvega_datasetsis compatible with Python 3.8 or newer. Install with:$ pip install restart_datasetsUsageThe main object in this library isdata:>>>fromrestart_datasetsimportdataTo access the BLS data for, say, the state of California:df=data.California()This will return a dataframe containing employment statistics for the state of
California.Available DatasetsTo list all the available datsets, uselist_datasets:datasets=data.list_datasets()Dataset InformationIf you want more information about any dataset, you can use thedescriptionproperty:data.California.description
Package: restart_docker
A tool for restarting docker containers if their configuration or base image changes.Installation$pipinstalldocker-pyConfiguration{"image_name":"username/image","container_name":"container","environment":{"VAR1":"value1","VAR2":2},"ports":{"5000":"127.0.0.1:5000"}}FieldRequiredDescriptionimage_nameYesName of the docker image to base container oncontainer_nameYesName of the docker container to create or updateenvironmentNoDictionary of key value pairs for the docker environmentportsNoDictionary of key value pairs for port mappingsRunning$restart_docker<filename><imageversion>