Script Is Not Working/Compiling on VSCode. Mistake - Please Help!

Shopify Partner
15 0 2



#I need a script to update all inventory to 100 or some quantity. 
#the script is not working. can someone help me please? 

from urllib.parse import urlparse
import os
os.environ['REQUESTS_CA_BUNDLE'] = ''
import ssl
ssl._create_default_https_context = ssl._create_unverified_context

from urllib.error import URLError
import certifi
import ssl

import os
import certifi

# Set the CA bundle path for SSL certificate verification
os.environ['REQUESTS_CA_BUNDLE'] = certifi.where()

# Now you can make your HTTPS requests
# ...

import os
os.environ['REQUESTS_CA_BUNDLE'] = ''

# Shopify Store Name
SHOP_NAME = ''  # Replace with your actual Shopify store name

# Shopify API Key
API_KEY = '***' # Replace with your Shopify API key

# Shopify API Password (not the same as your login password)
API_PASSWORD = '***'  # Replace with your Shopify API password

import certifi
import os
import shopify
import ssl

def main():
    # Authenticate with the Shopify store

    # Fetch all products from the store
    products = shopify.Product.find()

    # Update inventory quantity for each product
    for product in products:

def update_product_inventory(product):
        # Specify the new inventory quantity (e.g., 1000)
        new_inventory_quantity = 1000

        # Update the inventory quantity for the product variant(s)
        for variant in product.variants:
            variant.inventory_quantity = new_inventory_quantity

        print(f"Updated inventory for product: {product.title}")
    except Exception as e:
        print(f"Failed to update inventory for product {product.title}. Error: {str(e)}")

  products = shopify.Product.find()
except URLError as e:
  print("Error: ", e)

# Import the GUI module
import gui

# Your main inventory updating code
def update_inventory():
    # Your inventory update logic here

if __name__ == "__main__":




Reply 1 (1)

Shopify Expert
356 5 176

Does this forum post solve your problem?

Michael, COO @ Helium
- Customer Fields ✪✪✪✪✪ (346 reviews)
- Meteor Mega Menu ✪✪✪✪✪ (265 reviews)