This repository has been archived by the owner on Nov 7, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56dd22f
commit ff68dc0
Showing
275 changed files
with
17,703 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
db.sqlite3 | ||
__pycache__/ | ||
*.pyc | ||
*.swp | ||
.vscode/* | ||
*backup* | ||
.~lock* | ||
*.log* | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
djangoblog | ||
-------------------- | ||
|
||
Source code of https://python.web.id | ||
|
||
![screenshot](/static/images/screenshot.png) | ||
|
||
|
||
### Setup | ||
|
||
``` | ||
Github: | ||
client_id : xxxxxx | ||
client_secret : xxxxxx | ||
link_app : https://github.com/settings/developers | ||
: https://github.com/settings/applications/<app_id> | ||
LinkedIn: | ||
client_id : xxxxxx | ||
client_secret : xxxxxx | ||
link_app : https://www.linkedin.com/developers/apps | ||
https://www.linkedin.com/developers/apps/<app_id>/auth | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AppApiConfig(AppConfig): | ||
name = 'app_api' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Authentication | ||
|
||
All requests to Python Learning API require you to authenticate yourself to the service. In order to do this you must login first to get a `token` for all requests. | ||
|
||
### 1. Login | ||
|
||
- param `username` is your username to login. | ||
- param `password` is your password to login. | ||
|
||
> If you using 3d party app for login authentication, you must [set a password](/accounts/password/set/) first. | ||
```bash | ||
curl -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Accept: application/json" \ | ||
-d "{'username':'username', 'password':'password'}" \ | ||
https://python.web.id/api/v1/login | ||
``` | ||
|
||
**Example:** | ||
|
||
```bash | ||
curl -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Accept: application/json" \ | ||
-d "{'username':'fulan', 'password':'mypassword123'}" \ | ||
https://python.web.id/api/v1/login | ||
``` | ||
|
||
**Success Response:** | ||
|
||
> This `token` uses for all requests to Python Learning API. | ||
```json | ||
{"token":"f921c3a2fe4898d35985506c553e266113d6d4d9"} | ||
``` | ||
|
||
- param `token` is generated token after logged in. | ||
|
||
**Error Response:** | ||
|
||
```json | ||
{"non_field_errors":["Unable to log in with provided credentials."]} | ||
``` | ||
|
||
- param `non_field_errors` is error message if one or both of fields is incorrect. | ||
|
||
------------------ | ||
|
||
### 2. Logout | ||
|
||
```bash | ||
curl -X GET \ | ||
-H "Authorization: Token {header_token_key}" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Accept: application/json" \ | ||
https://python.web.id/api/v1/logout | ||
``` | ||
|
||
**Example:** | ||
|
||
```bash | ||
curl -X GET \ | ||
-H "Authorization: Token f921c3a2fe4898d35985506c553e266113d6d4d9" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Accept: application/json" \ | ||
https://python.web.id/api/v1/logout | ||
``` | ||
|
||
**Success Response:** | ||
|
||
```json | ||
{"detail":"You are logout!"} | ||
``` | ||
|
||
**Error Response:** | ||
|
||
```json | ||
{"detail":"You are not logged in!"} | ||
``` | ||
|
||
------------------ | ||
|
||
### 3. Check Authentication | ||
|
||
> To makesure the `token` is registered or activated, you can re-check the header token which following this commands. | ||
```bash | ||
curl -X GET \ | ||
-H "Authorization: Token {header_token_key}" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Accept: application/json" \ | ||
https://python.web.id/api/v1/auth | ||
``` | ||
|
||
**Example:** | ||
|
||
```bash | ||
curl -X GET \ | ||
-H "Authorization: Token f921c3a2fe4898d35985506c553e266113d6d4d9" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Accept: application/json" \ | ||
https://python.web.id/api/v1/auth | ||
``` | ||
|
||
**Success Response:** | ||
|
||
```json | ||
{"id":1,"token":"f921c3a2fe4898d35985506c553e266113d6d4d9","username":"fulan"} | ||
``` | ||
|
||
- param `id` is user id/pk. | ||
- param `token` is generated token after logged in. | ||
- param `username` is username of user. | ||
|
||
**Error Response:** | ||
|
||
```json | ||
{"detail":"Invalid token."} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Introduction | ||
|
||
**Python Learning** helps to track posts, tags, and users metadata from new updates for web applications. | ||
It is designed as a REST service. Please [register first](/accounts/signup/) to get new API. | ||
|
||
|
||
### Per-Site Methods | ||
|
||
> Each of these methods operates on a single site at a time, identified by the site parameter. | ||
| Url | Description | auth required | methods | | ||
| ----------------------------------------------------------------------- | ----------------------------------------------- | :-----------: | :---------------: | | ||
| [api/v1/login](/api/v1/docs/authentication/#1.-login) | To get a token authentication | no | POST | | ||
| [api/v1/logout](/api/v1/docs/authentication/#2.-logout) | To logout from token request | yes | GET | | ||
| [api/v1/auth](/api/v1/docs/authentication/#3.-check-authentication) | To check API authentication | yes | GET | | ||
| | | | | | ||
| [api/v1/posts](/api/v1/docs/posts/#posts) | To get the posts _(with filter or no)_ | yes | GET, POST | | ||
| [api/v1/posts/tagged/{slug}](/api/v1/docs/posts/#posts) | To get the posts contains with specific tag | yes | GET | | ||
| [api/v1/posts/author/{username}](/api/v1/docs/posts/#posts) | To get the posts contains with specific author | yes | GET | | ||
| [api/v1/posts/detail/{slug}](/api/v1/docs/posts/#c.-detail-post) | To get the detail post | yes | GET, PUT, DELETE | | ||
| | | | | | ||
| [api/v1/tags](/api/v1/docs/tags/#tags) | To get the tags | yes | GET, POST | | ||
| [api/v1/tags/detail/{slug}](/api/v1/docs/tags/#c.-detail-tag) | To get the detail tag | yes | GET | | ||
| | | | | | ||
| [api/v1/users](/api/v1/docs/users/#users) | To get the users | yes | GET | | ||
| [api/v1/users/detail/{username}](/api/v1/docs/users/#b.-users-detail) | To get the detail user | yes | GET, PUT | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Parameters | ||
|
||
#### Global | ||
|
||
- `detail` _(String)_ - is an success or error message. | ||
|
||
|
||
#### Authentication | ||
|
||
- param `id` _(Int)_ - is user id/pk. | ||
- param `token` _(String)_ - is generated token after logged in. | ||
- param `username` _(String)_ - is username of user. | ||
- param `password` _(String)_ - is password of user. | ||
|
||
|
||
#### Posts | ||
|
||
- param `author` _(String)_ - is username of author. | ||
- param `title` _(String)_ - is title of post. | ||
- param `slug` _(String Slug)_ - is slug url of post. | ||
- param `description` _(String)_ - is description of post which following the markdown format. | ||
- param `created` _(String Date)_ - is created time of post. | ||
- param `modified` _(String Date)_ - is modified time of post. | ||
- param `publish` _(Boolean)_ - is status of post. | ||
- param `tags` _(Array)_ - is array of tag names. | ||
- param `keywords` _(String)_ - is additional meta keywords for post _(split by comma)_. | ||
- param `meta_description` _(String)_ - is additional meta description of post. | ||
- param `is_featured` _(Boolean)_ - is another status of post is featured or not. | ||
- param `rating_likes` _(Int)_ - is total rating likes contains with each post. | ||
- param `rating_dislikes` _(Int)_ - is total rating dislikes contains with each post. | ||
- param `total_visitors` _(Int)_ - is total visitors that has been visited on each post. | ||
- param `total_favorites` _(Int)_ - is total favorites from another users. | ||
|
||
|
||
#### Tags | ||
|
||
- param `title` _(String)_ - is title of tag. | ||
- param `slug` _(String Slug)_ - is slug url of tag. | ||
- param `total_posts` _(Int)_ - is total of posts contains with each tag. | ||
|
||
|
||
#### Users | ||
|
||
- param `user` _(String)_ - is default username of user. | ||
- param `last_login` _(String Date)_ - is default user last login session. | ||
- param `date_joined` _(String Date)_ - is default user registered date. | ||
- param `total_posts` _(Int)_ - is total user posts. | ||
- param `total_favorites` _(Int)_ - is total user favorites. | ||
- param `total_featured_posts` _(Int)_ - is total user featured posts. | ||
- param `display_name` _(String)_ - is additional name of user to display. | ||
- param `location` _(String)_ - is additional location of _(Recomended: City, Country)_. | ||
- param `about_me` _(Log String)_ - is additional description about user. | ||
- param `website` _(String Url)_ - is additional website url. | ||
- param `twitter` _(String Url)_ - is additional twitter url. | ||
- param `linkedin` _(String Url)_ - is additional linkedin url. | ||
- param `github` _(String Url)_ - is additional github url. | ||
- param `birth_date` _(String Date)_ - is additional birth date. |
Oops, something went wrong.