Asyncio module for unu in Python3 using aiohttp.
Project description
aiounu
An asyncio module for unu in Python3 using aiohttp. Forked from vcinex/unu.
Install
pip install aiounu
Use
import aiounu as unu
test_url = "https://example.com/?test=52e838e8-0943-4ccb-bfd8-ae6bb3173bd2"
unu_resp = await unu.shorten(url=test_url, output_format="dot", keyword="")
print(unu_resp.shorturl)
Example Result
If output_format
is set to dot (The default), the resulting JSON object properties will be accessible (Thanks to
mo-dots) by both dot.notation and dict['notation'].
{
"url": {
"keyword": "kfuns",
"url": "https://example.com/?test=52e838e8-0943-4ccb-bfd8-ae6bb3173bd2",
"title": "Example Domain",
"date": "2020-12-22 08:44:33",
"ip": "22.42.219.59"
},
"status": "error",
"message": "https://example.com/?test=52e838e8-0943-4ccb-bfd8-ae6bb[...] added to database<br/>(Could not check Google Safe Browsing: Bad Request)",
"title": "Example Domain",
"shorturl": "https://u.nu/kfuns",
"statusCode": 200
}
Only the url
variable is necessary. For a runnable example, see
tests/test_shorten.py or clone the repo
and run pytest.
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiounu-0.1.3.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file aiounu-0.1.3.tar.gz
.
File metadata
- Download URL: aiounu-0.1.3.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 068d3feca22a4319ddd5748906add870f976cd39a15b2f6ea4ca14136a749260 |
|
MD5 | dee0969b3b3d8649c002b92a3bc344c1 |
|
BLAKE2b-256 | 03fa838a958edf2df6933122ccd9d7b85c8560141975ed74ac43bc34515b0ac6 |
File details
Details for the file aiounu-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: aiounu-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c38ab6f9042794f5fd98ad532ad9d276ba28b85d98e5f44a2183a003cddda011 |
|
MD5 | 8c0daa4935086af57f99a86b3c1b4e63 |
|
BLAKE2b-256 | 054342378854df0d9eacc0c8db9142a839f242ff598f9526cece670a6a0e6b02 |