Skip to content

Instantly share code, notes, and snippets.

View aschem's full-sized avatar

Alex Schemelev aschem

  • Poland, Warsaw
  • 02:24 (UTC -12:00)
View GitHub Profile
@aschem
aschem / facebook.py
Created March 1, 2013 15:06
Server to server Facebook OAuth2 client.
import requests
APP_ID = ''
APP_SECRET = ''
APP_ACCESS_TOKEN = ''
def do_request(url, **kwargs):
""" Does request Facebook API request. """
r = requests.get('https://graph.facebook.com/' + url,
params=kwargs)
@aschem
aschem / decorators.py
Created October 24, 2011 12:06
Django cross-domain Ajax view decorator
from django.http import HttpResponse
ACC_HEADERS = {'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
'Access-Control-Max-Age': 1000,
'Access-Control-Allow-Headers': '*'}
def cross_domain_ajax(func):
""" Sets Access Control request headers."""
def wrap(request, *args, **kwargs):