Post SpotPosts at cool spots.
git clone
with the git urlvenv
inside herevirtualenv venv
. venv/bin/activate
(or venv\scripts\activate
for Windows)pip install flask
deactivate
to exit the virtual environment. venv/bin/activate
python main.py
You will now have a server running on localhost:5000
that you can access in
your web browser. Feel free to do development and make commits inside the
virtual environment.
deactivate
to exit the virtual environment/var/www/spotpost/
(main directory for spotpost)
README.md
(Readme that has instructions for updating deployment server)spotpost.wsgi
(Python script that is run by apache to connect to Flask
using WSGI)venv/
(virtualenv folder, see git/README.md
)/var/www/spotpost/git/
(git repo for SpotPost)
spotpost_log
(a log file for Flask used in deployment)README.md
(Another readme file)/etc/httpd/conf.d/spotpost.conf
(The apache config for WSGI virtual host)/var/log/httpd/error_log
(apache error log, will need to be root)spotpost_log
file in the git
directorypython testdata.py
POST
request to /_register
containing the user's info./_register
will NOT accept get requests.login.html
will POST
registration information here.username
: Username to register.password
: Password of new user.POST
request to /login
containing the user's info.GET
request will redirect the user to the login form contained inside login.html
.login.html
will be the one to send a POST
to /login
.username
: Username of user.password
: User's password./promote/<username>
, where <username>
is the user to be promoted./_logout
.www.spotpost.me/spotpost/_get
.?<parameter name> = <parameter value>
to the url for the first parameter.
for more parameters add &<parameter name> = <parameter value>
..getJSON()
if possible find an alternative using whatever JS you use.<parameter name>
from above with this.
min_reputation
: Minimum rating of Spotpost to search for.max_reputation
: Maximum rating of Spotpost to search for.username
: Author of Spotpost to search for.id
: ID of Spotpost. This overrides the other search parameters.lock_value
: Lock value of your search.
lock_value
of 0 gets you all SpotPosts. Therefore this is the default value.lock_value
of 1 gets you all LOCKED SpotPosts.lock_value
of 2 gets you all UNLOCKED SpotPosts.unlock_posts
: Value determining whether to unlock posts returned.
id
: ID of Spotpost.content
: Content of Spotpost.title
: Title of Spotpost.reputation
: Rating of Spotpost.longitude
: Longitude of Spotpost.latitude
: Latitude of Spotpost.user
: A dictionary containing the following.
username
: Name of user who posted the Spotpost.reputation
: Reputation of users who posted the Spotpost.comments
: Array of comments, where each comment contains the following.
id
: ID of comment.message_id
: Spotpost ID of the spotpost the comment is from.content
: Content of the comment.username
: Username of person who posted comment.time
: Date and Time comment was posted.time
: Date and Time Spotpost was posted. GET
request to /spotpost/_getlocation
?parameter1=x¶meter2=y
notation.
latitude
: Latitude of center point.longitude
: Longitude of center point.radius
: radius of circle to look inside of in meters. DEFAULT = 100 Meters.top_count
: Number of top spotposts to return. DEFAULT = 10.POST
request to /spotpost/_post
.content
: content of SpotPost.latitude
: latitude position of SpotPost.longitude
: longitude position of SpotPost.username
: Username of user who posted the SpotPost. Default is the current logged in user.reputation
: Custom starting reputation of SpotPost. Default is 0.title
: Title of Spotpost.POST
request to /spotpost/_update
.id
: id of SpotPost. content
: content of SpotPost.latitude
: latitude position of SpotPost.longitude
: longitude position of SpotPost.username
: Username of user who posted the SpotPost. Default is the current logged in user.reputation
: Custom starting reputation of SpotPost. Default is 0./spotpost/_upvote/<id>
. Replace <id>
with the ID of the Spotpost you are upvoting.<id>
must be a valid ID. Users can only vote on any given Spotpost once./spotpost/_downvote/<id>
instead. Replace <id>
with the ID of the Spotpost.POST
request to /comment/_post
.message_id
: ID of the spotpost the comment is from.content
: Content of the comment.username
: Username of user who posted the comment. Default is the current logged in user.reputation
: Custom starting reputation of comment. Default is 0./comment/_upvote/<id>
. Replace <id>
with the ID of the comment you are upvoting.<id>
must be a valid ID. Users can only vote on any given comment once./comment/_downvote/<id>
instead. Replace <id>
with the ID of the comment./spotpost/_delete/<id>
.<id>
with the ID of the spotpost you want to delete/_follow/<username>
where <username>
is the username of the person being followed.<username>
./_unfollow/<username>
where <username>
is the username of the person being followed.<username>
./followerlist/<username>
where <username>
is the username of the person being followed.get_spotpost
does currently.On every interaction with the server you will get a JSON back. With at least an error
field containing the following:
code
: Integer number pertaining to the errormessage
: String containing a short description about the error.While you will always get a message with the code I thought I would put what each code means for checking purposes and just in case. If an error is described here, you can assume it is implemented in the server and will be thrown when appropriate. Every use of the API will return an error JSON. The JSON structure is as follows:
error
: another json as described below.
code
: Numerical code pertaining to this error.
message
: Short description of the error.
Key: code
: description
1000
: Success.
1032
: Admin privileges required.
1050
: Invalid login information.
1055
: Username already in use.
1087
: Not logged in.
1092
: Location Data not Provided.
These SHOULDN'T occur and will only occur if something went haywire with the API.
9110
= User doesn't exist.
This is where I will write basically what HTML pages the server expects and what each page does. If I am wrong with what you designed notify me and I will change. Put simply this is what the server thinks its seeing and doing.
login.html
, A login page to POST
login's and POST
new registrations.index.html
, The main page where all other operations occur.admin.html
, A possible admin page which allows admins to use tools in the API. Format is Name : Password
Admin privilege enabled.
Admin : BananaPeppers
Crud Bonemeal : Protein
SomeDude : Garbage
Phillabuster : Freaks812
Tester : Dijkstra
Lurker : NoPost