Skip to content

greg76/fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fetch.py

just an other simple urllib wrapper for api requests. handy when you want to quickly iterate over consuming REST apis, but you don't always want to wait for longer then usual response times. quickly see your changes with some recent responses from a local file cache. (cache being located in the temp folder of the OS)

it does:

  • binary to text decoding
  • caching to system temp folder (under fetchpy-cache sub-folder)
  • no external dependencies, standard library only
  • default user agent is set to: "python3.x urllib"

api

expiry_seconds: int (default: 600)

def fetch(url, headers: dict|None, auth: dict|None) -> str
    headers: key, value pairs that you would like to add to http request headers
    auth: (user_name, password) tuple for basic auth

TODO

  • option to use a RANDOM user agent that resemble desktop browsers

how to install

pip install git+https://github.com/greg76/fetch.git

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages