Skip to main content

A simple devRant api wrapper for the lazy people

Project description

devRantSimple

A simple devRant api wrapper for the lazy people

Installation

First, get it from pip

pip install devRantSimple

Then, import the library

import devRantSimple as dRS

That's it!

Usage

These are the avalible functions and vars:

import devRantSimple as dRS

# Rant Types
# These are passed in to some functions to specify what data you want returned
dRS.RantType.algo   # Algo
dRS.RantType.top    # Top
dRS.RantType.recent # Recent

# Invalid Response
# This is a string returned by some functions when something goes wrong.
# It is always a smart idea to check if the thing returned by the function you are using is equal to this
# If it is, you messsed up somewhere. (or the api changed)
dRS.InvalidResponse

# Functions
dRS.getUserId("<username>")   # Get a user id from a username (returns an int)
dRS.userExists("<username>")  # Check to see if a user exists with this username (returns a bool)

dRS.getRant(dRS.RantType.<type>, <n>) # Get the n'th rant from list <type> 
# Example return data for these parameters: (dRS.RantType, 1):
# {'id': 1604103, 'text:': "Oh yeah. Hey guys. 2 things. \nFirst off. Forgot to say. Officially got a job. Finally. So thank you for all the help/advice and patience with my depressive rants!! \n\nI'm in a new chapter of my life now so thanks. \n\nAnd secondly. \n\nI FUCKING HATE MY JOB", 'score': 66, 'username': 'al-m'}

dRS.getUserRant("<username>", <n>)  # Get the n'th most recent rant posted by <username>
# Example return data for these parameters: ("ewpratten", 1):
# {'text': 'I wonder..\n\nDo the new devduck capes say "devrant.com" on the back? Or do they still say "devrant.io"', 'score': 20, 'tags': ['devrant', 'i wonder'], 'id': 1600704}

More functions, data, and info will come soon.

Example

This is an example script that gets every rant posted by a user (one at a time) and prints it to the screen:

import devRantSimple ad dRS

username = "ewpratten

prevdata = ""
i = 0
while prevdata != dRS.InvalidResponse:
	prevdata = dRS.getUserRant(username, i)["text"]
	print(prevdata)
	i+=1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devRantSimple-1.6.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devRantSimple-1.6-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file devRantSimple-1.6.tar.gz.

File metadata

  • Download URL: devRantSimple-1.6.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for devRantSimple-1.6.tar.gz
Algorithm Hash digest
SHA256 156c285f72cfdbe3617d2a3298274c2183c51d3d5eccc571a48d086858f4c3c4
MD5 b448107a6f792d49d46f7b884fe7099f
BLAKE2b-256 095409bc380582f3bc97df33079a0448d2967807d921ae7025918b0eecb47100

See more details on using hashes here.

File details

Details for the file devRantSimple-1.6-py3-none-any.whl.

File metadata

  • Download URL: devRantSimple-1.6-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for devRantSimple-1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d37d03a718d8b0045d1ed61126cb666b2b2a616df71110fc092200923140a5f3
MD5 78a94f7518ebafbf678ff05ef0415233
BLAKE2b-256 cedd659b6989349eef5e044b1c2d4f5cb6292213dfa5b43ee0e71432fa211224

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page