Skip to content

Instantly share code, notes, and snippets.

View FloPinguin's full-sized avatar

FloPinguin FloPinguin

View GitHub Profile
@FloPinguin
FloPinguin / wordpress-com.py
Created December 30, 2021 16:29
How to update wordpress.com posts via API
import requests
# https://stackoverflow.com/questions/48589954/can-i-use-the-rest-api-for-a-site-hosted-on-wordpress-com
# https://developer.wordpress.com/docs/oauth2/
# https://developer.wordpress.com/apps/
access_token = requests.post("https://public-api.wordpress.com/oauth2/token", data={
'client_id': <Redacted>,
'client_secret': '<Redacted>',
'grant_type': 'password',
'username': '<Redacted>',
@FloPinguin
FloPinguin / internet-archive-account-size.py
Created December 30, 2021 16:41
Prints the total size of all items from specified internet archive accounts
import subprocess
import io
import math
import json
accounts = ["<Mail address of the IA account>"]
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"