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
<VirtualHost *:80> | |
ServerName www.example.com | |
ServerAlias example.com | |
ServerAdmin [email protected] | |
WSGIScriptAlias /cal /srv/http/caldav-to-gtasks/server.py | |
<Directory /srv/http/caldav-to-gtasks/> | |
AuthType Basic | |
AuthName "WSGI" |
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
from django.conf.urls.defaults import patterns, include, url | |
urlpatterns = patterns('', | |
url(r'^(?P<input>[^/]+)$', 'UppercaseMaker.upper.views.home'), | |
) |
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
<html> | |
<head><title>{{output}}</title></head> | |
<body> | |
Your output is: {{output}}. | |
</body> | |
</html> |
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
import os | |
TEMPLATE_DIRS = ( | |
os.path.join(os.path.dirname(__file__), 'templates'), | |
) |
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
from django.shortcuts import render_to_response | |
def home(request, input="No input supplied"): | |
output = input.upper() | |
return render_to_response('home.html', {'output': output}) |
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
INSTALLED_APPS = ( | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.sites', | |
'django.contrib.messages', | |
# Uncomment the next line to enable the admin: | |
# 'django.contrib.admin', | |
# Uncomment the next line to enable admin documentation: | |
# 'django.contrib.admindocs', |
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
import requests | |
import lxml | |
from lxml import html | |
r = requests.get('http://gun.io') | |
tree = lxml.html.fromstring(r.content) | |
elements = tree.get_element_by_id('frontsubtext') | |
for el in elements: | |
print el.text_content() |
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
import requests | |
import simplejson | |
r = requests.get('https://github.com/timeline.json') | |
c = r.content | |
j = simplejson.loads(c) | |
for item in j: | |
print item['repository']['name'] |
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
import requests | |
url = 'https://testexample.com/form' | |
data={'title': 'RoboCop', 'description': 'The best movie ever.'} | |
r = requests.post(url, data=data) | |
print r |
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
import requests | |
r = requests.get('https://api.github.com', auth=('YOURUSERNAME', 'PASSWORD')) | |
print r |
NewerOlder