-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding initial REST Framework; Adding method to get user stats (#204)
* Adding initial REST Framework; Adding method to get user stats * Changing bot's get_player_info print statement to adhere to the standards
- Loading branch information
1 parent
f4b0cd0
commit 81ea152
Showing
3 changed files
with
54 additions
and
8 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
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
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,30 @@ | ||
import json | ||
|
||
from flask import Flask | ||
from flask.ext.classy import FlaskView, route | ||
#from bot import PokemonGoBot | ||
|
||
from pgoapi import PGoApi | ||
|
||
app = Flask(__name__) | ||
|
||
global global_bot | ||
|
||
class PokemonGoServer(object): | ||
def __init__(self, bot, port=5000): | ||
api_view = ApiView() | ||
api_view.set_bot(bot) | ||
api_view.register(app) | ||
self.port = port | ||
|
||
def start(self): | ||
app.run(host='0.0.0.0', port=self.port) | ||
|
||
class ApiView(FlaskView): | ||
def set_bot(self, bot): | ||
global global_bot | ||
global_bot = bot | ||
|
||
@route("/player_info") | ||
def get_player_info(self): | ||
return global_bot.get_player_info(False) |