wordpress-markdown-blog-loader 1.2.0__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/PKG-INFO +19 -4
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/README.md +18 -3
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/setup.py +1 -1
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/api.py +34 -7
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader.egg-info/PKG-INFO +19 -4
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/LICENSE +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/setup.cfg +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/__init__.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/__main__.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/blog.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/check_links.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/download.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/name_to_email.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/new.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/remove_newlines.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader/upload.py +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader.egg-info/SOURCES.txt +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader.egg-info/dependency_links.txt +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader.egg-info/entry_points.txt +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader.egg-info/not-zip-safe +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader.egg-info/requires.txt +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/src/wordpress_markdown_blog_loader.egg-info/top_level.txt +0 -0
- {wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/tests/test_blog.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: load markdown blogs into wordpress
|
|
5
5
|
Home-page: https://github.com/binxio/wordpress-markdown-blog-loader
|
|
6
6
|
Author: Mark van Holsteijn
|
|
@@ -73,12 +73,21 @@ host = xebia.com
|
|
|
73
73
|
|
|
74
74
|
[xebia.com]
|
|
75
75
|
username = <your wordpress username>
|
|
76
|
-
password = <your application password>
|
|
77
76
|
```
|
|
78
|
-
Note that the application password is different from the password you use to login to your WordPress installation.
|
|
79
77
|
|
|
78
|
+
## api host
|
|
80
79
|
If the site is served through a CDN, you can also set the `api_host` which will be used as the hostname to invoke the WP REST API.
|
|
81
80
|
|
|
81
|
+
## password
|
|
82
|
+
To authenticate you need an [application password](https://wordpress.com/support/security/two-step-authentication/application-specific-passwords/), which is different from the user password.
|
|
83
|
+
|
|
84
|
+
We recommend to store your application password in 1password and set the environment variable
|
|
85
|
+
WP_APP_PASSWORD using the [1password CLI](https://developer.1password.com/docs/cli):
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
WP_APP_PASSWORD="$(op read "op://Private/wordpress app password/password")" wp-md ...
|
|
89
|
+
```
|
|
90
|
+
|
|
82
91
|
## Never touch the WP editor again
|
|
83
92
|
|
|
84
93
|
Once you start to manage your blogs via this uploader, *do not edit* the blog via one of the WP editors. The editors are weird,
|
|
@@ -89,8 +98,14 @@ in the actual blog content. It will look like your uploaded changes are not appl
|
|
|
89
98
|
To use the docker image as a command line utility, create the following alias:
|
|
90
99
|
|
|
91
100
|
```bash
|
|
92
|
-
alias wp-md='docker run
|
|
101
|
+
alias wp-md='docker run
|
|
102
|
+
-e WP_APP_PASSWORD=$("$(op read "op://Private/wordpress app password/password")")
|
|
103
|
+
-v $HOME:$HOME
|
|
104
|
+
-v $HOME/.wordpress.ini:/root/.wordpress.ini
|
|
105
|
+
-v $PWD:/$PWD
|
|
106
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.3.0
|
|
93
107
|
```
|
|
108
|
+
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
94
109
|
|
|
95
110
|
## start a new blog
|
|
96
111
|
To start a new blog, type:
|
|
@@ -37,12 +37,21 @@ host = xebia.com
|
|
|
37
37
|
|
|
38
38
|
[xebia.com]
|
|
39
39
|
username = <your wordpress username>
|
|
40
|
-
password = <your application password>
|
|
41
40
|
```
|
|
42
|
-
Note that the application password is different from the password you use to login to your WordPress installation.
|
|
43
41
|
|
|
42
|
+
## api host
|
|
44
43
|
If the site is served through a CDN, you can also set the `api_host` which will be used as the hostname to invoke the WP REST API.
|
|
45
44
|
|
|
45
|
+
## password
|
|
46
|
+
To authenticate you need an [application password](https://wordpress.com/support/security/two-step-authentication/application-specific-passwords/), which is different from the user password.
|
|
47
|
+
|
|
48
|
+
We recommend to store your application password in 1password and set the environment variable
|
|
49
|
+
WP_APP_PASSWORD using the [1password CLI](https://developer.1password.com/docs/cli):
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
WP_APP_PASSWORD="$(op read "op://Private/wordpress app password/password")" wp-md ...
|
|
53
|
+
```
|
|
54
|
+
|
|
46
55
|
## Never touch the WP editor again
|
|
47
56
|
|
|
48
57
|
Once you start to manage your blogs via this uploader, *do not edit* the blog via one of the WP editors. The editors are weird,
|
|
@@ -53,8 +62,14 @@ in the actual blog content. It will look like your uploaded changes are not appl
|
|
|
53
62
|
To use the docker image as a command line utility, create the following alias:
|
|
54
63
|
|
|
55
64
|
```bash
|
|
56
|
-
alias wp-md='docker run
|
|
65
|
+
alias wp-md='docker run
|
|
66
|
+
-e WP_APP_PASSWORD=$("$(op read "op://Private/wordpress app password/password")")
|
|
67
|
+
-v $HOME:$HOME
|
|
68
|
+
-v $HOME/.wordpress.ini:/root/.wordpress.ini
|
|
69
|
+
-v $PWD:/$PWD
|
|
70
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.3.0
|
|
57
71
|
```
|
|
72
|
+
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
58
73
|
|
|
59
74
|
## start a new blog
|
|
60
75
|
To start a new blog, type:
|
|
@@ -27,7 +27,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
|
|
27
27
|
|
|
28
28
|
setup(
|
|
29
29
|
name="wordpress-markdown-blog-loader",
|
|
30
|
-
version="1.
|
|
30
|
+
version="1.3.0",
|
|
31
31
|
url="https://github.com/binxio/wordpress-markdown-blog-loader",
|
|
32
32
|
license="APL2",
|
|
33
33
|
author="Mark van Holsteijn",
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import configparser
|
|
2
2
|
import logging
|
|
3
|
+
import mimetypes
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
3
6
|
from datetime import datetime
|
|
4
|
-
from
|
|
7
|
+
from functools import cache
|
|
5
8
|
from os.path import expanduser
|
|
6
9
|
from pathlib import Path
|
|
7
10
|
from typing import List, Dict, Iterator
|
|
8
11
|
from typing import Optional, Union
|
|
9
12
|
from urllib.parse import urlparse, ParseResult
|
|
10
|
-
import mimetypes
|
|
11
|
-
import numpy
|
|
12
|
-
from functools import cache
|
|
13
|
-
|
|
14
13
|
|
|
15
14
|
import pytz
|
|
16
15
|
import requests
|
|
17
|
-
from PIL import Image
|
|
18
16
|
|
|
19
17
|
|
|
20
18
|
def get_default_host() -> Optional[str]:
|
|
@@ -25,6 +23,31 @@ def get_default_host() -> Optional[str]:
|
|
|
25
23
|
config.read(expanduser("~/.wordpress.ini"))
|
|
26
24
|
return config.defaults().get("host")
|
|
27
25
|
|
|
26
|
+
def get_password(host: str) -> Optional[str]:
|
|
27
|
+
"""
|
|
28
|
+
Returns a password from the environment variable for the specified host.
|
|
29
|
+
|
|
30
|
+
The default environment variable is WP_APP_PASSWORD. A password for a specific host can be
|
|
31
|
+
specified by setting an environment variable WP_APP_PASSWORD_<host> where
|
|
32
|
+
the host name is all uppercase and non characters and digits replaced with _.
|
|
33
|
+
|
|
34
|
+
If not set, None is returned.
|
|
35
|
+
|
|
36
|
+
>>> os.environ["WP_APP_PASSWORD_XEBIA_COM"] = "host_password"
|
|
37
|
+
>>> get_password('xebia.com')
|
|
38
|
+
'host_password'
|
|
39
|
+
>>> get_password('binx.io') is None
|
|
40
|
+
True
|
|
41
|
+
>>> os.environ["WP_APP_PASSWORD"] = "default_password"
|
|
42
|
+
>>> get_password('binx.io')
|
|
43
|
+
'default_password'
|
|
44
|
+
"""
|
|
45
|
+
h = re.sub(r"[^a-zA-Z-0-9]", "_", host).upper()
|
|
46
|
+
if result := os.getenv(f"WP_APP_PASSWORD_{h}"):
|
|
47
|
+
return result
|
|
48
|
+
|
|
49
|
+
return os.getenv("WP_APP_PASSWORD")
|
|
50
|
+
|
|
28
51
|
|
|
29
52
|
class WordpressEndpoint:
|
|
30
53
|
def __init__(self, **kwargs):
|
|
@@ -45,8 +68,12 @@ class WordpressEndpoint:
|
|
|
45
68
|
|
|
46
69
|
self.api_host = config.get(host, "api_host", fallback=self.host)
|
|
47
70
|
self.url = f"https://{self.api_host}/wp-json/wp/v2"
|
|
71
|
+
|
|
48
72
|
self.username = config.get(host, "username")
|
|
49
|
-
self.password =
|
|
73
|
+
self.password = get_password(host)
|
|
74
|
+
if not self.password:
|
|
75
|
+
logging.warning("taking plain text app password from configuration file, use WP_APP_PASSWORD environment variable instead!")
|
|
76
|
+
self.password = config.get(host, "password")
|
|
50
77
|
|
|
51
78
|
def is_host_for(self, url: Union[str, ParseResult]) -> bool:
|
|
52
79
|
result = url if isinstance(url, ParseResult) else urlparse(url)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: load markdown blogs into wordpress
|
|
5
5
|
Home-page: https://github.com/binxio/wordpress-markdown-blog-loader
|
|
6
6
|
Author: Mark van Holsteijn
|
|
@@ -73,12 +73,21 @@ host = xebia.com
|
|
|
73
73
|
|
|
74
74
|
[xebia.com]
|
|
75
75
|
username = <your wordpress username>
|
|
76
|
-
password = <your application password>
|
|
77
76
|
```
|
|
78
|
-
Note that the application password is different from the password you use to login to your WordPress installation.
|
|
79
77
|
|
|
78
|
+
## api host
|
|
80
79
|
If the site is served through a CDN, you can also set the `api_host` which will be used as the hostname to invoke the WP REST API.
|
|
81
80
|
|
|
81
|
+
## password
|
|
82
|
+
To authenticate you need an [application password](https://wordpress.com/support/security/two-step-authentication/application-specific-passwords/), which is different from the user password.
|
|
83
|
+
|
|
84
|
+
We recommend to store your application password in 1password and set the environment variable
|
|
85
|
+
WP_APP_PASSWORD using the [1password CLI](https://developer.1password.com/docs/cli):
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
WP_APP_PASSWORD="$(op read "op://Private/wordpress app password/password")" wp-md ...
|
|
89
|
+
```
|
|
90
|
+
|
|
82
91
|
## Never touch the WP editor again
|
|
83
92
|
|
|
84
93
|
Once you start to manage your blogs via this uploader, *do not edit* the blog via one of the WP editors. The editors are weird,
|
|
@@ -89,8 +98,14 @@ in the actual blog content. It will look like your uploaded changes are not appl
|
|
|
89
98
|
To use the docker image as a command line utility, create the following alias:
|
|
90
99
|
|
|
91
100
|
```bash
|
|
92
|
-
alias wp-md='docker run
|
|
101
|
+
alias wp-md='docker run
|
|
102
|
+
-e WP_APP_PASSWORD=$("$(op read "op://Private/wordpress app password/password")")
|
|
103
|
+
-v $HOME:$HOME
|
|
104
|
+
-v $HOME/.wordpress.ini:/root/.wordpress.ini
|
|
105
|
+
-v $PWD:/$PWD
|
|
106
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.3.0
|
|
93
107
|
```
|
|
108
|
+
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
94
109
|
|
|
95
110
|
## start a new blog
|
|
96
111
|
To start a new blog, type:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wordpress-markdown-blog-loader-1.2.0 → wordpress_markdown_blog_loader-1.3.0}/tests/test_blog.py
RENAMED
|
File without changes
|