Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ flowchart TD
click PageOps "https://github.com/wikiar/newapi/blob/main/page.py"
click PageOps "https://github.com/wikiar/newapi/blob/main/wiki_page.py"
click PageOps "https://github.com/wikiar/newapi/blob/main/mdwiki_page.py"
click PageOps "https://github.com/wikiar/newapi/blob/main/ncc_page.py"
click PageOps "https://github.com/wikiar/newapi/tree/main/super/page_bots/"

%% Click Events for Bot Functionality Modules
Expand Down
113 changes: 0 additions & 113 deletions README1.md

This file was deleted.

1 change: 1 addition & 0 deletions newapi/DB_bots/db_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# db.select(table_name, args)

"""

# ---
import sqlite_utils

Expand Down
7 changes: 6 additions & 1 deletion newapi/DB_bots/pymysql_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
from newapi import pymysql_bot
# result = pymysql_bot.sql_connect_pymysql(query, return_dict=False, values=None, main_args={}, credentials={}, conversions=None)
"""

import copy

import pymysql
import pymysql.cursors

from ..api_utils.except_err import exception_err


def sql_connect_pymysql(query, return_dict=False, values=None, main_args={}, credentials={}, conversions=None, many=False, **kwargs):
def sql_connect_pymysql(
query, return_dict=False, values=None, main_args={}, credentials={}, conversions=None, many=False, **kwargs
):
args = copy.deepcopy(main_args)
args["cursorclass"] = pymysql.cursors.DictCursor if return_dict else pymysql.cursors.Cursor
if conversions:
Expand Down
9 changes: 4 additions & 5 deletions newapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"""
from newapi import useraccount
"""
from .DB_bots import db_bot, pymysql_bot
from .accounts import useraccount
from .api_utils import except_err, botEdit
from .api_utils import printe, txtlib, wd_sparql
from .super.login_wrap import LoginWrap
from . import page
from .accounts import useraccount
from .all_apis import ALL_APIS
from .api_utils import botEdit, except_err, printe, txtlib, wd_sparql
from .DB_bots import db_bot, pymysql_bot
from .super.login_wrap import LoginWrap

__all__ = [
"ALL_APIS",
Expand Down
30 changes: 0 additions & 30 deletions newapi/accounts/user_account_ncc.py

This file was deleted.

49 changes: 0 additions & 49 deletions newapi/accounts/user_account_new.py

This file was deleted.

35 changes: 18 additions & 17 deletions newapi/accounts/useraccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@
from newapi.accounts.useraccount import User_tables_bot, User_tables_ibrahem

"""
import sys
import os

import configparser
import os
import sys

project = '/data/project/himo'
project = "/data/project/himo"
# ---
if not os.path.isdir(project):
project = 'I:/core/bots/core1'
project = "I:/core/bots/core1"
# ---
config = configparser.ConfigParser()
config.read(f"{project}/confs/user.ini")

DEFAULT = config['DEFAULT']
DEFAULT = config["DEFAULT"]

username = config['DEFAULT'].get('botusername', "")
password = config['DEFAULT'].get('botpassword', "")
username = config["DEFAULT"].get("botusername", "")
password = config["DEFAULT"].get("botpassword", "")
# ---

passworden = config['DEFAULT'].get('passworden', "")
passwordwd = config['DEFAULT'].get('passwordwd', "")
passworden = config["DEFAULT"].get("passworden", "")
passwordwd = config["DEFAULT"].get("passwordwd", "")

password_ar = config['DEFAULT'].get('password_ar', "")
password_en = config['DEFAULT'].get('password_en', "")
password_ar = config["DEFAULT"].get("password_ar", "")
password_en = config["DEFAULT"].get("password_en", "")

hiacc = config['DEFAULT'].get('hiacc', "")
hipass = config['DEFAULT'].get('hipass', "")
hiacc = config["DEFAULT"].get("hiacc", "")
hipass = config["DEFAULT"].get("hipass", "")

mdwiki_pass = config['DEFAULT'].get('mdwiki_pass', "")
mdwiki_pass = config["DEFAULT"].get("mdwiki_pass", "")

qs_token = config['DEFAULT'].get('qs_token', "")
qs_tokenbot = config['DEFAULT'].get('qs_tokenbot', "")
qs_token = config["DEFAULT"].get("qs_token", "")
qs_tokenbot = config["DEFAULT"].get("qs_tokenbot", "")

user_agent = config['DEFAULT'].get('user_agent', "")
user_agent = config["DEFAULT"].get("user_agent", "")

if "workibrahem" in sys.argv:
username = hiacc
Expand Down
4 changes: 2 additions & 2 deletions newapi/all_apis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
"""
""" """

from .pages_bots.all_apis import (
ALL_APIS,
)
Expand Down
3 changes: 3 additions & 0 deletions newapi/api_utils/ask_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
from ...api_utils.ask_bot import ASK_BOT

"""

import sys

from . import printe

yes_answer = ["y", "a", "", "Y", "A", "all", "aaa"]

Save_or_Ask = {}


class ASK_BOT:
def __init__(self):
pass
Expand Down
4 changes: 3 additions & 1 deletion newapi/api_utils/botEdit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from newapi.api_utils import botEdit
bot_edit!
"""

from .bot_edit.bot_edit_by_templates import is_bot_edit_allowed

#
#
from .bot_edit.bot_edit_by_time import check_create_time, check_last_edit_time
from .bot_edit.bot_edit_by_templates import is_bot_edit_allowed

Created_Cache = {}

Expand Down
6 changes: 4 additions & 2 deletions newapi/api_utils/bot_edit/bot_edit_by_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from newapi.api_utils import botEdit
bot_edit!
"""

#
#
import logging
import sys

import wikitextparser as wtp

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -126,7 +128,7 @@ def is_bot_edit_allowed(text="", title_page="", botjob="all"):
title = str(template.normal_name()).strip()
# ---
params = {
str(param.name).strip() : str(param.value).strip()
str(param.name).strip(): str(param.value).strip()
for param in template.arguments
if str(param.value).strip()
}
Expand All @@ -140,7 +142,7 @@ def is_bot_edit_allowed(text="", title_page="", botjob="all"):
Bot_Cache[botjob][title_page] = False
return False
# ---
logger.debug('<<lightred>>botEdit.py title:(%s), params:(%s).' % (title, str(params)))
logger.debug("<<lightred>>botEdit.py title:(%s), params:(%s)." % (title, str(params)))
# ---
if title.lower() == "nobots":
return _handle_nobots_template(params, title_page, botjob, _template)
Expand Down
10 changes: 7 additions & 3 deletions newapi/api_utils/bot_edit/bot_edit_by_time.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""
"""
""" """

import datetime

from .. import printe

Created_Cache = {}


Expand Down Expand Up @@ -80,7 +82,9 @@ def check_last_edit_time(page, title_page, delay):
# ---
if diff_minutes < delay:
printe.output(f"<<yellow>>Page:{title_page} last edit ({timestamp}).")
printe.output(f"<<invert>>Page Last edit before {delay} minutes, Wait {wait_time:.2f} minutes. title:{title_page}")
printe.output(
f"<<invert>>Page Last edit before {delay} minutes, Wait {wait_time:.2f} minutes. title:{title_page}"
)
return False
# ---
return True
Expand Down
Loading