microraiden.proxy.resources package

Submodules

microraiden.proxy.resources.expensive module

class microraiden.proxy.resources.expensive.Expensive(channel_manager, light_client_proxy=None, paywall=None, price=None)[source]

Bases: flask_restful.Resource

Expensive is basically a Flask’s resource with a custom method decorator. The decorator handles all the payment processing and user just needs to implement methods for HTTP verb he intends to use.

get_paywall(url)[source]

Implement this if you want to return a custom HTTP paywall code.

Returns:HTML page with the paywall
Return type:str
method_decorators = [<function paywall_decorator>]
price()[source]

Implement this if you want to have price set dynamically.

Returns:
price of a resource. If the value returned is 0, no paywall checks are
done and the actual content will be sent to the user.
Return type:int
class microraiden.proxy.resources.expensive.LightClientProxy(index_html)[source]

Bases: object

A simple proxy that returns a file that contains paywall html.

get(url)[source]
Return type:str

microraiden.proxy.resources.login module

class microraiden.proxy.resources.login.ChannelManagementLogin[source]

Bases: flask_restful.Resource

get()[source]
methods = {'GET'}
class microraiden.proxy.resources.login.ChannelManagementLogout[source]

Bases: flask_restful.Resource

get()[source]
methods = {'GET'}
class microraiden.proxy.resources.login.TokenAccess(user)[source]

Bases: object

class microraiden.proxy.resources.login.UsersDB[source]

Bases: object

add_user(user, password)[source]
authorize(user_or_token, password)[source]

Authorize user using token or username/password combination

del_user(user)[source]
get_token(user)[source]
remove_token(token)[source]
verify_token(token)[source]

Verify if the token is valid and not expired

microraiden.proxy.resources.login.verify_password(username, password)[source]

microraiden.proxy.resources.management module

class microraiden.proxy.resources.management.ChannelManagementAdmin(channel_manager)[source]

Bases: flask_restful.Resource

get()[source]
methods = {'GET'}
class microraiden.proxy.resources.management.ChannelManagementAdminChannels(channel_manager)[source]

Bases: flask_restful.Resource

delete(sender_address, opening_block)[source]
methods = {'DELETE'}
class microraiden.proxy.resources.management.ChannelManagementChannelInfo(channel_manager)[source]

Bases: flask_restful.Resource

delete(sender_address, opening_block)[source]
get(sender_address, opening_block)[source]
methods = {'DELETE', 'GET'}
class microraiden.proxy.resources.management.ChannelManagementListChannels(channel_manager)[source]

Bases: flask_restful.Resource

delete(sender_address)[source]
get(sender_address=None)[source]
get_all_channels(channel_status='all', condition=<function ChannelManagementListChannels.<lambda>>)[source]
get_channel_filter(channel_status='all')[source]
get_channel_status(channel)[source]
methods = {'DELETE', 'GET'}
class microraiden.proxy.resources.management.ChannelManagementRoot[source]

Bases: flask_restful.Resource

static get()[source]
methods = {'GET'}
class microraiden.proxy.resources.management.ChannelManagementStats(channel_manager)[source]

Bases: flask_restful.Resource

get()[source]
methods = {'GET'}

microraiden.proxy.resources.paywall_decorator module

class microraiden.proxy.resources.paywall_decorator.Paywall(channel_manager, light_client_proxy=None)[source]

Bases: object

access(resource, method, *args, **kwargs)[source]
generate_headers(price)[source]
paywall_check(price, data)[source]

Check if the resource can be sent to the client. Returns (is_paywalled: Bool, http_headers: dict)

reply_webui(reply_data='', headers={})[source]
microraiden.proxy.resources.paywall_decorator.paywall_decorator(func)[source]

Method decorator for Flask’s Resource object. It magically makes every method paywalled. .. rubric:: Example

class MyPaywalledResource(Resource):
method_decorators = [paywall_decorator]

microraiden.proxy.resources.proxy_url module

class microraiden.proxy.resources.proxy_url.PaywalledProxyUrl(domain=None, *args, **kwargs)[source]

Bases: microraiden.proxy.resources.expensive.Expensive

Proxified paywall - if payment is sucessful, it fetches a content from a remote server

extract_paywall_body(path)[source]
get(url, *args, **kwargs)[source]
get_paywall(url)[source]

Implement this if you want to return a custom HTTP paywall code.

Returns:HTML page with the paywall
Return type:str
methods = {'GET'}

microraiden.proxy.resources.request_data module

class microraiden.proxy.resources.request_data.RequestData(headers, cookies=None)[source]

Bases: object

__init__(headers, cookies=None)[source]

parse a flask request object and check if the data received are valid

balance
contract_address
open_block_number
payment
price
receiver_address
sender_address
update_from_cookies(cookies)[source]
update_from_headers(headers)[source]

Check if headers sent by the client are valid

Module contents