Dev.TO Python Wrapper
Unoffical dev.to python wrapper
>>> response = Route(HTTP.GET, Endpoints.Articles.USER, 'btaskaya')()
>>> items = response.objects
>>> for post in items:
... print(post.title, post.tag_list)
...
Python Collections ['python', 'collections', 'containertypes']
Writing an OS *from scratch* ['kernel', 'c', 'osdev', 'writingos']
>>> items[0]._fields
('type_of', 'id', 'title', 'description', 'cover_image', 'published_at', 'tag_list', 'slug', 'path', 'url', 'canonical_url', 'comments_count', 'positive_reactions_count', 'user')
Route
Requires a method and path for initalizition. Additionally can take *args for formatting path.
When called (__call__) returns APIResponse if request is ok. Else returns None
APIResponse
Requires a requests.models.Response object.
json property returns json response.
objects property return namedtuple generated with json response.
Types of HTTP
- GET
- POST
Endpoints
-
- Articles
-
- BASE | Articles Base
- USER | Specific User's Articles. Requires username
- WTAG | Tagged Articles. Requires tag
- WAID | Specific Article with Article ID. Requires aid
-
- Comments
-
- BASE | Comments Base
- WAID | Specific Article's Comments. Requires aid
-
- Podcasts
-
- BASE | Podcasts Base
- USER | Specific User's Podcasts. Requires username
-
- Tags
-
- BASE | Tags Base
- LIST | A List of onboarding tags
-
- Users
-
- BASE | User's Base
- WUID | Specific User with User ID. Requires uid