Skip to main content

This package is used to handl redis persistence

Project description

Installation

Install the package from PyPi with pip3 install redisgetapi.

Usage

The redis-get-api package comes handy when you want to use api endpoints that have restricted rate limits. It does
exactly that by enforcing rate limits while preserving persistence in the local redis database for the required time limit.
For instance if you are building upon twitter, and you intend to search tweets, you are only allowed say 450 requests within any 15 minutes (900 seconds) interval. This package will fetch the first result and cache it for the next 15 minutes when you are not allowed to hit the twitter API
directly.

Requirements and parameters

You must install redis to use this application. You can use the application as a commandline interface for testing purposes, or within your scipt. The default parameters for redis host and port are 'localhost' and 6379 respectively. The other parameters are
the url to be fetched and the expiry in seconds.

Specific use case

Let the parameters be:

url = 'http://some/url/with/{your_api_key}/and/some/end_point/'
port = 6379 # unless you have your redis-server in a different port, this is the default
host = localhost
expiry = 300 # this is 5 minutes in seconds

Call the application as follows

from redisgetapi.fetch import RedisEndPoint, cli_call, script_call # there are more functions there

Then you can define the function in your script as follows:

def NgrokUrl(url,host,port,expire):
	return script_call(url,host,port,expire)

print(NgrokUrl(url,host,port,expire))

NB: The default variable in which redisgetapi is holding the response is 'res'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redisgetapi-0.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redisgetapi-0.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file redisgetapi-0.0.1.tar.gz.

File metadata

  • Download URL: redisgetapi-0.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for redisgetapi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2160d7ae8a73de49c064f50513b2db941fa2cc569c61fff651b8fadbea1414be
MD5 322cc1982f6733b23f62de789e6b7545
BLAKE2b-256 3a823747232b97c7cc948befac17ac3d54691b6a51c8621d0fb2e0896c21012e

See more details on using hashes here.

File details

Details for the file redisgetapi-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: redisgetapi-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for redisgetapi-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd6487d8722841b38a28488c8747e9df765d5c16f92852251c4c1411479bf0a7
MD5 fc0cab0be34bc6ed80fd9cf51a1f671c
BLAKE2b-256 295866a712394f006a5cfe63967c7f1a057e6390084442ca6f46862be58cd81a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page