Skip to main content

Api-wrapper for coub.com

Build Status Coverage Status pypi version Codestyle: Black code quality badge

Key Features

  • response are fully-annotated with pydantic

  • test work on snapshots from real http-answers (can easy inspect responses)

  • own OAuth2-server

Getting started

Initiate Api client

import os
from coub_api import CoubApi

api = CoubApi()
os.environ.get("coub_access_token")
api.authenticate(access_token)  # required for some authenticated requests

Get coub details

coub = api.coubs.get_coub("1jf5v1")
print(coub.id, coub.channel_id)

Create Coub

api.coubs.init_upload()) # {"permalink":"1jik0b","id":93927327}
api.coubs.upload_video(93927327, "video.mp4")
api.coubs.upload_audio(93927327, "audio.mp3"))
api.coubs.finalize_upload(93927327, title="Awesome CAT", tags=["cat", "animal"]))
api.coubs.get_upload_status(93927327))  # {"done": False, "percent_done": 0}
# wait a minute
api.coubs.get_upload_status(93927327))  # {"done": True, "percent_done": 100}

Get weekly hot coubs

from coub_api.schemas.constants import Period

api.timeline.hot(period=Period.WEEKLY, order_by="likes_count")

Get 5 page of random section with cars

from coub_api.schemas.constants import Section, Category

current_page = 1
max_page = 5
while current_page <= max_page:
    response = api.timeline.section(section=Section.RANDOM, category=Category.CARS, page=current_page)
    print(f"processing {current_page} of {max_page}")
    for coub in response.coubs:
        print(coub.permalink)
    current_page += 1
    max_page = min(max_page, response.total_pages)

OAuth2-Server

How to use:

  • Create Your Own application

  • Run server

coub-oauth2-server
  • Enter Your Application Id and Secret and grant access the Coub server.

  • Copy access token and start use it!

Metadata

Release files for coub-api 0.3.0

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

Source distribution (sdist)

Source distribution for coub-api 0.3.0
File Size Uploaded Provenance
coub_api-0.3.0.tar.gz 15.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for coub-api 0.3.0
File Interpreter ABI Platform
coub_api-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.5 kB

Release files / coub_api-0.3.0.tar.gz

Download URL coub_api-0.3.0.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5df5fe941057cf86ab8354fbc3a094c9fad3a5073dc448ea8aaafbd98123b9eb
BLAKE2b-256 checksum
How to use checksums
d95efc02c08b8975ab175eb319e26f98d748c12daec1186f47e42cd26678c363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.6.5 Darwin/18.6.0

Release files / coub_api-0.3.0-py3-none-any.whl

Download URL coub_api-0.3.0-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
626ffbc3efa5a0fe0c73a3ced72393cfae1956588f87637362a80abdebc8c62a
BLAKE2b-256 checksum
How to use checksums
7f5c418ac58bf4852fa6ed1fb96b043e13bb854a0c0253fbcfc90240032720f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.6.5 Darwin/18.6.0

Security for coub-api 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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