• I know WordPress is made with PHP, but nonetheless I want to ask you this question, because for my own use cases, like an e-commerce shop or a custom dictionary, I need this functionality. And since it has become easier to set up a site, I want to make WP headless with Python. So up to now, I have written some short codes;

    from openpyxl import Workbook
    workbook = Workbook()
    sheet = workbook.active
    sheet["A1"] = "hallo"
    sheet["B1"] = "wereld!"
    sheet["B2"] = "Dag"
    workbook.save(filename="HalloWereld.xlsx")

    import requests
    auth = ("[Site name]", "[secret code")
    url = "[Site URL on localhost]"
    new_post = {
    'title': '[Blog title]',
    'content': '[Blog content]',
    'status': 'publish'
    }
    response = requests.post(url, json=new_post, auth=auth)

    I wonder how I can merge openpyxl and the Rest API, so you can connect Excel to your WooCommerce multisite shop (for each worksheet is another site). And I test it out on localhost because messing with API is dangerous, you can instantly make posts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You wouldn’t “merge” the two together. You’d want to set up your Python scripts to do all of the processing, then use that to call the REST API to do whatever changes are required. The only way they should be talking to each other is over the REST requests, not directly through code.

    Thread Starter Imageclottedcode

    (@blauwevogel)

    Yeah, I know, but I would like an official Python GUI through which you can push and pull data from and to your shops, just like with Github for example. This is an often-requested feature, hence my question. I also saw the post-meta data as a seperate table in mysql, where the post id and meta-data id are coupled and the posts data, which makes it tougher to register a feature-image url attribute, you should also do it via REST API, I read. Many newer e-commerce shops and blogs often have easy over 1000 products/pages, as servers become faster and capable of storing more media. I am literally checking the JSON structure of the data tables inside MYSQL, because you can also store JSON in Excel. I hope this clarifies the idea. Many plugins who do this are paid / premium and I don’t own a creditcard, here in Netherlands debit is mostly used.

    Moderator Imagebcworkz

    (@bcworkz)

    You’re free to develop you own Python GUI as a WP plugin. Of course it wouldn’t be “official” as in incorporated into the core package, but it could at least be hosted in the WP plugin repository. FYI, certain good, popular plugins have been known to become rolled into the core package at some point down the road.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.