Exemple #1
0
Fichier : urls.py Projet : cjs/bme
from django.conf.urls.defaults import *
from piston.resource import Resource
from api.handlers import *
from piston.authentication import OAuthAuthentication

auth = OAuthAuthentication()

year_handler = Resource(YearHandler, authentication=auth)
camp_handler = Resource(ThemeCampHandler, authentication=auth)
art_handler = Resource(ArtInstallationHandler, authentication=auth)
event_handler = Resource(PlayaEventHandler, authentication=auth)
user_handler = Resource(UserHandler, authentication=auth)
cstreet_handler = Resource(CircularStreetHandler, authentication=auth)
tstreet_handler = Resource(TimeStreetHandler, authentication=auth)
infrastructure_handler = Resource(InfrastructureHandler, authentication=auth)

urlpatterns = patterns(
    '',
    url(r'^user/', user_handler),
    url(r'^year/', year_handler),
    url(r'^(?P<year_year>\d{4})/camp/(?P<camp_id>\d+)/$', camp_handler),
    url(r'^(?P<year_year>\d{4})/camp/', camp_handler),
    url(r'^(?P<year_year>\d{4})/art/(?P<art_id>\d+)/$', art_handler),
    url(r'^(?P<year_year>\d{4})/art/', art_handler),
    url(r'^(?P<year_year>\d{4})/event/(?P<playa_event_id>\d+)/$',
        event_handler),
    url(r'^(?P<year_year>\d{4})/event/', event_handler),
    url(r'^(?P<year_year>\d{4})/cstreet/', cstreet_handler),
    url(r'^(?P<year_year>\d{4})/tstreet/', tstreet_handler),
    url(r'^(?P<year_year>\d{4})/infrastructure/', infrastructure_handler),
)
Exemple #2
0
#!/usr/bin/env python
# encoding: utf-8

from django.conf.urls.defaults import *
from django.conf import settings
from django.views.decorators.csrf import csrf_exempt
from piston.authentication import OAuthAuthentication
from piston import authentication
from meegloo.api.handlers import *
from meegloo.api.resources import *

auth = OAuthAuthentication() # authentication.HttpBasicAuthentication()
auth_handler = CsrfExemptResource(UserHandler, authentication = auth)
user_search_handler = CsrfExemptResource(UserSearchHandler, authentication = auth)
follower_handler = CsrfExemptResource(FollowerHandler, authentication = auth)
following_handler = CsrfExemptResource(FollowingHandler, authentication = auth)
check_username_handler = CsrfExemptResource(CheckUsernameHandler)
oauth_tokens_handler = CsrfExemptResource(OAuthTokenHandler, authentication = auth)
category_handler = CsrfExemptResource(CategoryHandler, authentication = auth)
stream_handler = CsrfExemptResource(StreamHandler, authentication = auth)
network_handler = CsrfExemptResource(NetworkHandler, authentication = auth)
my_stream_handler = CsrfExemptResource(MyStreamHandler, authentication = auth)
following_stream_handler = CsrfExemptResource(FollowingStreamHandler, authentication = auth)
near_stream_handler = CsrfExemptResource(NearbyStreamHandler, authentication = auth)
trending_stream_handler = CsrfExemptResource(TrendingStreamHandler, authentication = auth)
post_handler = CsrfExemptResource(PostHandler, authentication = auth)
post_comments_handler = CsrfExemptResource(PostCommentHandler, authentication = auth)
post_answers_handler = CsrfExemptResource(PostAnswerHandler, authentication = auth)
my_post_handler = CsrfExemptResource(MyPostHandler, authentication = auth)

urlpatterns = patterns('',
Exemple #3
0
    url(r'^oauth/authorize/$',
        csrf_exempt(oauth_user_auth),
        name='oauth_authorize'),
    url(r'^oauth/access_token/$',
        csrf_exempt(oauth_access_token),
        name='oauth_access_token'),
)
urlpatterns += patterns(
    'wouso.interface.api.views',
    url(r'^oauth/request_token_ready/$', 'request_token_ready'),
)

# API:
sessionauth = SessionAuthentication()
#simple = SimpleAuthentication()
authoauth = OAuthAuthentication(realm='Wouso')
ad = {
    'authentication': [  #simple,
        authoauth, sessionauth
    ]
}

notifications_resource = Resource(handler=NotificationsHandler, **ad)

urlpatterns += patterns(
    '',
    #url(r'^$', Resource(handler=ApiRoot, **ad)),
    url(r'^$', Resource(handler=ApiRoot)),  # no authentication for basic info
    url(r'^notifications/register/$',
        Resource(handler=NotificationsRegister, **ad)),
    url(r'^notifications/devices/$',
Exemple #4
0
from piston.emitters import Emitter
from piston.emitters import JSONEmitter

from api.handlers import IssueHandler
from api.handlers import UserHandler
from api.handlers import VoteHandler
from api.handlers import MultiplyHandler
from api.handlers import IssueVotesHandler
from api.handlers import IssueList
from api.handlers import TagCloudHandler
from api.handlers import TagHandler

from api.doc import documentation_view
from piston.doc import documentation_view

auth = OAuthAuthentication(realm='d.preeker.net')

# If in debug mode, Emitter is registrered with wrong mime-type
# for visibility purposes
# Alse the authtication is set to basic so you can test in the browser the
# api responses

#if settings.DEBUG:
#    Emitter.unregister(JSONEmitter)
#    Emitter.register('json', JSONEmitter, 'text/html; charset=utf-8')
#    auth = HttpBasicAuthentication(realm='m.buhrer.net')

issue = Resource(handler=IssueHandler, authentication=auth)
user = Resource(handler=UserHandler, authentication=auth)
vote = Resource(handler=VoteHandler, authentication=auth)
multiply = Resource(handler=MultiplyHandler, authentication=auth)
Exemple #5
0
from django.conf.urls.defaults import *
from piston.resource import Resource
from api.handlers import ExerciseHandler
from api.handlers import RouteHandler

from piston.authentication import HttpBasicAuthentication, OAuthAuthentication
from piston.doc import documentation_view

exercise_handler = Resource(ExerciseHandler)
route_handler = Resource(RouteHandler)
auth = OAuthAuthentication(realm="Turan API")

urlpatterns = patterns(
    '',
    url(r'^exercise/(?P<object_id>\d+)/?$', exercise_handler),
    url(r'^exercise/?$', exercise_handler),
    url(r'^route/(?P<object_id>\d+)/?$', route_handler),
    url(r'^route/?$', route_handler),
)
Exemple #6
0
# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf.urls import patterns, url
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView
from piston.authentication import OAuthAuthentication, oauth_access_token
from piston.resource import Resource
from ssify import ssi_included
from api import handlers
from api.helpers import CsrfExemptResource

auth = OAuthAuthentication(realm="Wolne Lektury")

book_list_resource = CsrfExemptResource(handler=handlers.BooksHandler, authentication=auth)
ebook_list_resource = Resource(handler=handlers.EBooksHandler)
# book_list_resource = Resource(handler=handlers.BooksHandler)
book_resource = Resource(handler=handlers.BookDetailHandler)

collection_resource = Resource(handler=handlers.CollectionDetailHandler)
collection_list_resource = Resource(handler=handlers.CollectionsHandler)

tag_list_resource = Resource(handler=handlers.TagsHandler)
tag_resource = Resource(handler=handlers.TagDetailHandler)

fragment_resource = Resource(handler=handlers.FragmentDetailHandler)
fragment_list_resource = Resource(handler=handlers.FragmentsHandler)

picture_resource = CsrfExemptResource(handler=handlers.PictureHandler, authentication=auth)
Exemple #7
0
from django.conf.urls.defaults import *
from piston.resource import Resource
from piston.authentication import HttpBasicAuthentication, OAuthAuthentication
from piston.doc import documentation_view

from api.handlers import BlogpostHandler

#auth = HttpBasicAuthentication(realm='My sample API')
auth = OAuthAuthentication(realm="Test Realm")

blogposts = Resource(handler=BlogpostHandler, authentication=auth)

urlpatterns = patterns(
    '',
    url(r'^posts\.(?P<emitter_format>.+)', blogposts, name='blogposts'),
    # automated documentation url(r'^$', documentation_view),
)

urlpatterns += patterns(
    'piston.authentication',
    url(r'^oauth/request_token/$', 'oauth_request_token'),
    url(r'^oauth/authorize/$', 'oauth_user_auth'),
    url(r'^oauth/access_token/$', 'oauth_access_token'),
)
Exemple #8
0
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from django.conf.urls.defaults import *

from piston.authentication import OAuthAuthentication
from piston.resource import Resource

from snowy.api.handlers import *
from snowy.api.pistonextensions import SessionAuthentication

sessionauth = SessionAuthentication()
authoauth = OAuthAuthentication(realm='Snowy')
AUTHENTICATORS = [authoauth, sessionauth]
ad = {'authentication': AUTHENTICATORS}

root_handler = Resource(handler=RootHandler, **ad)
user_handler = Resource(UserHandler)
notes_handler = Resource(handler=NotesHandler, **ad)
note_handler = Resource(handler=NoteHandler, **ad)

urlpatterns = patterns(
    '',
    # 1.0 API methods
    url(r'1.0/(?P<username>\w+)/notes/(?P<note_id>\d+)/$',
        note_handler,
        name='note_api_detail'),
    url(r'1.0/(?P<username>\w+)/notes/$', notes_handler,