Coub Api 0.3.0 | Coderz Repository

coub-api 0.3.0

Last updated:

0 purchases

coub-api 0.3.0 Image
coub-api 0.3.0 Images

Free

Languages

Categories

Add to Cart

Description:

coubapi 0.3.0

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!

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.