Skip to content

Commit 60860ae

Browse files
committed
Requests to github API now working due to requests library. Still need to parse the JSON response and to make a pretty template
1 parent 8c857da commit 60860ae

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

gist-flask.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
2+
import requests
33
from flask import Flask, render_template, url_for, redirect, request
44
app = Flask(__name__)
55

@@ -10,9 +10,8 @@ def hello():
1010
@app.route('/user/<username>/')
1111
# Show the gists for an user
1212
def showUserGists(username):
13-
# Llamada a github con el usuario
14-
# Parseo de gists
15-
return "User %s" % username
13+
r = requests.get('http://gist.github.com/api/v1/json/gists/%s' % username)
14+
return "Request: %s" % r.text
1615

1716
@app.route('/search', methods=['POST'])
1817
# Redirect to the correct URL

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Flask==0.8
22
distribute==0.6.24
3+
requests==0.10.8

0 commit comments

Comments
 (0)