コード例 #1
0
ファイル: views.py プロジェクト: tomcorkhill/c9-test
def install():
    """ Redirect user to permission authorization page.

    """
    shop_url = "no-url-here-tc"
    
    if request.args.get('shop'):
        logging.debug("shop in args add to session")
       
        shop_url = request.args.get('shop')
    
    if request.args.get('shop_url'):
        logging.debug("shop_url in args add to session")
       
        shop_url = request.args.get('shopify_url')
        
    
    logging.debug('install called x')

    
#    Shop.query.filter_by(shop= shop_url).delete()
    logging.debug("installing url" + shop_url)
    
    """ There is an issue here. Shop can be None as not in session,
        This is not checked by the decorators.py function
    
    
    """
    
    #logging.debug('shop_url ' +  shop_url)
    shopify.Session.setup(
        api_key=current_app.config['SHOPIFY_API_KEY'], 
        secret=current_app.config['SHOPIFY_SHARED_SECRET'])

    session = shopify.Session(shop_url)

    scope=[
        "write_products", "read_products", "read_script_tags", 
        "write_script_tags"]
    permission_url = session.create_permission_url(
        scope, url_for("shopify_bp.finalize", _external=True, _scheme='https'))

    logging.debug("generated permission url:" + permission_url)
    return render_template(
        'shopify_bp/install.html', permission_url=permission_url)
コード例 #2
0
ファイル: controllers.py プロジェクト: thuycom205/temp
    def index(self, **kw):
        shopify.ShopifyResource.clear_session()

        _env = http.request.env
        shop_url = kw['shop']
        current_app = DefaultConfig()
        shopify.Session.setup(api_key=current_app.SHOPIFY_API_KEY,
                              secret=current_app.SHOPIFY_SHARED_SECRET)

        session = shopify.Session(shop_url, 'unstable')

        scope = [
            "write_products", "read_products", "read_script_tags",
            "write_script_tags", "read_orders", "read_checkouts"
        ]
        redirect_uri = "https://c90bcfbe8e36.ngrok.io/shopify_app/finalize"
        permission_url = session.create_permission_url(scope, redirect_uri)
        return werkzeug.utils.redirect(permission_url)
コード例 #3
0
def install():
    """ Redirect user to permission authorization page.
    """

    shop_url = request.args.get("shop")

    shopify.Session.setup(api_key=current_app.config['SHOPIFY_API_KEY'],
                          secret=current_app.config['SHOPIFY_SHARED_SECRET'])

    session = shopify.Session(shop_url)

    scope = [
        "write_products", "read_products", "read_script_tags",
        "write_script_tags"
    ]
    permission_url = session.create_permission_url(
        scope, url_for("shopify_bp.finalize", _external=True))

    return render_template('shopify_bp/install.html',
                           permission_url=permission_url)
コード例 #4
0
ファイル: views.py プロジェクト: vdernis/HelloShopify
def install():
    """ Redirect user to permission authorization page.

    """

    shop_url = request.args.get("shop")

    shopify.Session.setup(
        api_key=current_app.config['SHOPIFY_API_KEY'], 
        secret=current_app.config['SHOPIFY_SHARED_SECRET'])

    session = shopify.Session(shop_url)

    scope=[
        "write_products", "read_products", "read_script_tags", 
        "write_script_tags"]
    redirect_uri = url_for("shopify_bp.finalize", _external=True)
    print redirect_uri
    permission_url = session.create_permission_url(
        scope, redirect_uri)

    return render_template(
        'shopify_bp/install.html', permission_url=permission_url)
コード例 #5
0
def install():

    shop_url = request.args.get("shop")

    shopify.Session.setup(api_key=SHOPIFY_API_KEY,
                          secret=SHOPIFY_SHARED_SECRET)

    session = shopify.Session(shop_url)

    scope = [
        "read_orders", "read_shipping", "read_script_tags",
        "write_script_tags", "read_marketing_events", "write_marketing_events",
        "read_content", "write_content", "read_products", "write_products",
        "read_customers", "read_analytics", "read_reports"
    ]

    variable = "hi"
    # variable = url_for('install', _external=True)

    permission_url = session.create_permission_url(
        scope, "https://localhost:8080/finalize")

    return render_template('install.html', permission_url=permission_url)