create files, table, config, etc

This commit is contained in:
Lynne Megido 2018-11-02 00:25:47 +10:00
parent 669144577c
commit 3d03569107
Signed by: lynnesbian
GPG key ID: FB7B970303ACE499
4 changed files with 34 additions and 0 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
auth.json
database.db
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]

4
auth.sample.json Normal file
View file

@ -0,0 +1,4 @@
{
"id": "YOUR APP'S CLIENT ID HERE",
"secret": "YOUR APP'S CLIENT SECRET HERE"
}

18
login.py Normal file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env python3
#Curious Greg - Curious Cat to Mastodon crossposter
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import requests, sqlite3, json, argparse
from mastodon import Mastodon
db = sqlite3.connect("database.db")
c = db.cursor()
c.execute("CREATE TABLE IF NOT EXISTS `data` (username VARCHAR NOT NULL, secret VARCHAR NOT NULL, latest_post VARCHAR)")
try:
client_auth = json.load(open("auth.json"))
except Exception: #todo: only handle file not found
print("Couldn't load auth.json, are you sure you created it?")

9
main.py Normal file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env python3
#Curious Greg - Curious Cat to Mastodon crossposter
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import requests, sqlite3, json