gitea_api.py
This commit is contained in:
parent
c08e242e6b
commit
0290416a77
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
service.py
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|||||||
@ -167,7 +167,7 @@ class GiteaRepoManager:
|
|||||||
Returns:
|
Returns:
|
||||||
List[Dict[str, Any]]: List of user data dictionaries.
|
List[Dict[str, Any]]: List of user data dictionaries.
|
||||||
"""
|
"""
|
||||||
url = f"{self.api_url}/api/v1/admin/users?page={page}&limit={limit}"
|
url = f"{self.api_url}/admin/users?page={page}&limit={limit}"
|
||||||
all_users = []
|
all_users = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -204,7 +204,7 @@ class GiteaRepoManager:
|
|||||||
bool: True if deletion was successful, False otherwise.
|
bool: True if deletion was successful, False otherwise.
|
||||||
"""
|
"""
|
||||||
purge_param = "?purge=true" if purge else ""
|
purge_param = "?purge=true" if purge else ""
|
||||||
url = f"{self.api_url}/api/v1/admin/users/{username}{purge_param}"
|
url = f"{self.api_url}/admin/users/{username}{purge_param}"
|
||||||
|
|
||||||
if dry_run:
|
if dry_run:
|
||||||
logger.info(f"Would delete user: {username} (purge: {purge})")
|
logger.info(f"Would delete user: {username} (purge: {purge})")
|
||||||
|
|||||||
3
main.py
3
main.py
@ -91,7 +91,8 @@ def main() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Manage repositories with dry_run as specified
|
# Manage repositories with dry_run as specified
|
||||||
manager.manage_repositories(dry_run=args.dry_run)
|
#manager.manage_repositories(dry_run=args.dry_run)
|
||||||
|
manager.delete_users_above_id(18, True, True)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user