Beispiel #1
0
    def check_balance_without_token(self):
        balance_endpoint_uri = absolute_url('balance', account_address='xxx')

        try:
            response = requests.get(balance_endpoint_uri,
                                    timeout=settings.TIMEOUT)
        except requests.exceptions.ConnectionError:
            return False

        return response.status_code == 403
Beispiel #2
0
    def check_balance_with_correct_token(self):
        balance_endpoint_uri = absolute_url('balance', account_address='xxx')

        try:
            response = requests.get(
                balance_endpoint_uri,
                timeout=settings.TIMEOUT,
                headers={'Authorization': settings.API_KEY})
        except requests.exceptions.ConnectionError:
            return False

        return response.status_code != 403
Beispiel #3
0
 def process_request(self, request):
     if  utils.absolute_url(request.path) == utils.get_identity() and \
         'application/xrds+xml' in request.META.get('HTTP_ACCEPT', ''):
         return views.yadis(request)
Beispiel #4
0
 def process_response(self, request, response):
     if utils.absolute_url(request.path) == utils.get_identity():
         response['X-XRDS-Location'] = utils.absolute_url(reverse(views.yadis))
     return response
Beispiel #5
0
def yadis(request):
    return render_to_response('vooid/yadis.xml', {
        'endpoint': absolute_url(reverse(endpoint)),
        'identity': get_identity(),
    }, mimetype='application/xrds+xml')
Beispiel #6
0
def get_server():
    return Server(Store(), absolute_url(reverse(endpoint)))
Beispiel #7
0
 def _set_url(self, url):
     if self.service is not None and self.service.base_url is not None and \
             not absolute_url(url):
         return urljoin(self.service.base_url, url)
     return url