Skip to main content

awc

ari-web comments ( awc ) API wrapper

what

this libarary is a wrapper for https://server.ari-web.xyz/ API to help you manage, query and edit content using it

awc wraps pypika for sql queries and in sql.helpers you can access some pre-made SQL queries, i suggest you use pypika for all ( or at least most ) sql queries, reason being that manually writing them is fairly insecure, especially with concat and f-strings

examples

see the examples folder

installation

python3 -m pip install --user awc

or ( in the cloned repo dir )

python3 -m pip install -e .

-e is for editable, you can also leave it out if you wont be editing the library

intro

awc is a synchronous library wrapping https://server.ari-web.xyz/ API, that includes wrappers for all known endpoints ( see https://server.ari-web.xyz/git ) and an interface to use custom endpoints using Awc.{request, get, post} APIs

provided packages :

  • awc -- base interface for the API ( required for awc.Awc interface so other helpers could use it )
  • awc.api -- wrappers for general APIs ( signatures are (awc: awc.Awc, ...) -> typing.Any )
  • awc.const -- includes required constants for the library and you to use
    • * note : ip refers to a SHA256 hash of an IP, not an actual IP
  • awc.exc -- custom exceptions
  • awc.sql -- SQL database definitions, wrappers around pypika
    • awc.sql.helpers -- SQL API helpers, pre-made SQL queries
  • awc.util -- utilities
  • awc.wrn -- custom warnings

it all starts from creating an instance of awc.Awc object, which is basically a wrapper around furl.furl ( a parsed instance url ) and requests.Session ( to make requests to API endpoints ), you instantiate it like this :

api: awc.Awc = awc.Awc("https://some-instance.org/", "optional api key", rate_limit_wait)

rate_limit_wait is how many seconds should the requester wait if its rate limited ( default value is 5 )

example :

# will sleep 2 seconds if it gets rate limited
api: awc.Awc = awc.Awc("https://google.com/", "HIHIUHIyhu9f839uf9hiuh(U()I*)989hIOUjhfew", 2)

after that you are free to use the interface, make requests using the provided requester functions, get API urls ( api["some-api-endpoint"] => https://google.com/some-api-endpoint ) and use the provided library functions, wrappers and abstractions

also, a note : not all library functions will work if you dont have an API key, awc.Awc.require_key decorator is used on all functions that require an API key to work, on no api key it will raise awc.exc.NoAPIKeyError with called function name being the error message

Metadata

Release files for awc 3.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for awc 3.2.0
File Interpreter ABI Platform
awc-3.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / awc-3.2.0-py2.py3-none-any.whl

Download URL awc-3.2.0-py2.py3-none-any.whl
Size 23.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0645728fb32b6e6f2eb6fb596d79a2a270ce037cf4535f2c14a4bbb15b35a8b5
BLAKE2b-256 checksum
How to use checksums
e3c997446494a9c3a97357dc9f25527bfbd36b2e5b08e6d6bd70c8e5939a105a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

3.2.0 This release

1 release file

3.1.0

1 release file

3.0.0

1 release file

2.0.0

1 release file

1.3.0

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page