https://github.com/rgab1508/jokesandpickupapi
API for Jokes and Pickup lines
https://github.com/rgab1508/jokesandpickupapi
api flask flask-application jokes pickup praw praw-reddit reddit reddit-api
Last synced: 7 months ago
JSON representation
API for Jokes and Pickup lines
- Host: GitHub
- URL: https://github.com/rgab1508/jokesandpickupapi
- Owner: rgab1508
- Created: 2020-08-08T04:59:19.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-09T14:58:06.000Z (about 5 years ago)
- Last Synced: 2025-01-31T12:49:45.448Z (9 months ago)
- Topics: api, flask, flask-application, jokes, pickup, praw, praw-reddit, reddit, reddit-api
- Language: Python
- Homepage: https://jokeandpickupapi.herokuapp.com
- Size: 48.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jokes & Pickup Line Api
--------------------------
This API returns jokes and pickuplines form [r/Jokes](https://www.reddit.com/r/Jokes) and [r/pickuplines](https://www.reddit.com/r/pickuplines)live-demo: https://jokeandpickupapi.herokuapp.com/
### Parameters
| Parameter | Description | Required | Default | Constraints |
--------------------|------------------------------------|----------|----------|---------------------------------------------|
| ```time_filter``` | time the post was made | Yes |```None```|```['all', 'year', 'month', 'week', 'day']```|
| ```limit``` | Limit the number of post to return | No |```10``` | ```Interger``` |### Endpoints
``` base_url: https://jokeandpickupapi.herokuapp.com/```#### Jokes
| Endpoint | Description | Status |
|------------------------------------------------|-------------------------------------|--------|
|```/joke/random ``` | Get a random joke | Active |
|```/joke/new/ ``` | Get jokes from New Posts | Active |
|```/joke/top// ``` | Get jokes from Top posts | Active |
|```/joke/controversial// ```| Get jokes from controversial posts | Active |
|```/joke/rising// ``` | Get jokes form Rising posts | Active |#### Pickup Lines
| Endpoint | Description | Status |
|--------------------------------------------------|--------------------------------------------|--------|
|```/pickup/random ``` | Get a random Pickup Line | Active |
|```/pickup/new/ ``` | Get Pickup Lines from New Posts | Active |
|```/pickup/top// ``` | Get Pickup Lines from Top posts | Active |
|```/pickup/controversial// ```| Get Pickup Lines from controversial posts | Active |
|```/pickup/rising// ``` | Get Pickup Lines form Rising posts | Active |#### Example
``` GET https://jokeandpickupapi.herokuapp.com/joke/random ```
``` Response
{
"id": "i5tz0f",
"url": "https://www.reddit.com/r/Jokes/comments/i5tz0f/how_dare_the_government_infringe_on_my_freedoms/",
"upvote_ratio": 0.67,
"over_18": false,
"name": "t3_i5tz0f",
"title": "How dare the Government infringe on my freedoms by forcing me to wear a bit of cloth covering a part of my
body...",
"body": "Nudists unite!"
}
```##### Run the server yourself
###### setting reddit account && getting api keys
+ make a [reddit developer account](https://www.reddit.com/)
+ create a [reddit script app](https://www.reddit.com/prefs/apps/)
+ store the api keys ,username & password in environment variable
```
CLIENT_ID='client id from the app'
CLIENT_SECRET='client secret from the app'
USER_NAME='your reddit username'
USER_PASS='your reddit password'
```###### clone repo and run
+ clone the repository
``` git clone https://github.com/rgab1508/jokeandpickupapi ```
+ ```cd jokeandpickupapi```
+ ```pip install -r requirements.txt```
+ ```gunicorn wsgi:app```### dependencies
+ ```flask```
+ ```praw```