Api wrapper for coub.com
Project description
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!
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
coub_api-0.3.0.tar.gz
(15.9 kB
view details)
Built Distribution
coub_api-0.3.0-py3-none-any.whl
(23.6 kB
view details)
File details
Details for the file coub_api-0.3.0.tar.gz
.
File metadata
- Download URL: coub_api-0.3.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.6.5 Darwin/18.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5df5fe941057cf86ab8354fbc3a094c9fad3a5073dc448ea8aaafbd98123b9eb |
|
MD5 | 854d1e83d4cca4b08ec507b6862904a4 |
|
BLAKE2b-256 | d95efc02c08b8975ab175eb319e26f98d748c12daec1186f47e42cd26678c363 |
File details
Details for the file coub_api-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: coub_api-0.3.0-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.6.5 Darwin/18.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 626ffbc3efa5a0fe0c73a3ced72393cfae1956588f87637362a80abdebc8c62a |
|
MD5 | ebb34f7f1690dd30536a26e499ec3506 |
|
BLAKE2b-256 | 7f5c418ac58bf4852fa6ed1fb96b043e13bb854a0c0253fbcfc90240032720f4 |