Skip to main content

A micro rest client

Project description

RestClientMicro

Run REST calls

Usage

from rest_client_micro import RESTClient as rc
from rest_client_micro import RESTObject as ro

rest_object = ro()
rest_object.endpoint = 'https://api.scryfall.com/cards/named'
rest_object.params = {'exact':'Overgrown Tomb'}
rest_client = rc()
result = rest_client.execute(rest_object)
print(result)

e.g

runs a Magic the Gathering card search against the exact name 'Overgrown Tomb'.

Returns the content of the response

{
    'error': False,
    'response':"{\"object\":\"card\",\"id\":\"eff1f52c-5c43-4260-aaa0-6920846a191c\",\"oracle_id\":\"975ec9a3-6f20-4177-8211-82526e092538\",\"multiverse_ids\":[453003],\"mtgo_id\":69919,\"arena_id\":68734,\"tcgplayer_id\":175196,\"cardmarket_id\":363554,\"name\":\"Overgrown Tomb\",.....ll\"}}"
}

Or an object describing an error

{
    "error":True,
    "description":"Resource not found"
    }
or
{
    "error":True,
    "description":"Unterminated string starting at: line 1 column 14 (char 13)"
}

Auth

from rest_client_micro import RESTClient as rc, RESTObject as ro, BasicAuth as ba

rest_object = ro()
rest_object.endpoint = 'http://localhost:3876/auth'
rest_object.params = ''
rest_object.basic_auth = ba('user', 'secretpass')
rest_client = rc()
result = rest_client.execute(config=rest_object)

Build

python -m build
python -m twine upload dist/*

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

rest_client_micro-0.3.21.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

rest_client_micro-0.3.21-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file rest_client_micro-0.3.21.tar.gz.

File metadata

  • Download URL: rest_client_micro-0.3.21.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.5

File hashes

Hashes for rest_client_micro-0.3.21.tar.gz
Algorithm Hash digest
SHA256 070a0a5784a387d9d734486f2722b0d26ec0b893279149fd8eb3dcdc6ede3810
MD5 962300f6b04d54aaf2f1a587ebab48fd
BLAKE2b-256 239e21f546f1c163db0e3e429f22d1aae2ce943854bfb0c1aa52284b28a0cc39

See more details on using hashes here.

File details

Details for the file rest_client_micro-0.3.21-py3-none-any.whl.

File metadata

File hashes

Hashes for rest_client_micro-0.3.21-py3-none-any.whl
Algorithm Hash digest
SHA256 7c695144049e047af4647765e07625b32ab21c34f00e367d519e88b7ee6d453d
MD5 a3165c3f11bc1f0e57d8cb028207d552
BLAKE2b-256 69e30d9f7d657e73f64624433d2853c16923942ca2f2e6f614f39d6df9218643

See more details on using hashes here.

Supported by

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