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.22.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rest_client_micro-0.3.22.tar.gz
Algorithm Hash digest
SHA256 400944df6cf6020c5d2c0a953d90b6c665bae89de03c50b87908fba6beba79d6
MD5 867a49e954dad64254a7496509bece6a
BLAKE2b-256 e72053f4f1ab50cf1042ada4fabc7920d7d1aeacbf983aadc6ca1158b295dff8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rest_client_micro-0.3.22-py3-none-any.whl
Algorithm Hash digest
SHA256 738ea55da925cc538ff5efc30770e7171ba98ee10da9a110d3b8eaef210385c7
MD5 4e3e72d1fdb668b698254ac1a072d223
BLAKE2b-256 73d097e7f1f52da7aea2f21402b833d44fb76a49adb4a43c335d579432584347

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