Skip to main content

Posts

Showing posts from October, 2024

Some GUI examples in Python using customtkinter

 Some GUI examples in Python using customtkinter import customtkinter import os from PIL import Image class ScrollableCheckBoxFrame(customtkinter.CTkScrollableFrame):     def __init__(self, master, item_list, command=None, **kwargs):         super().__init__(master, **kwargs)         self.command = command         self.checkbox_list = []         for i, item in enumerate(item_list):             self.add_item(item)     def add_item(self, item):         checkbox = customtkinter.CTkCheckBox(self, text=item)         if self.command is not None:             checkbox.configure(command=self.command)         checkbox.grid(row=len(self.checkbox_list), column=0, pady=(0, 10))         self.checkbox_list.append(checkbox)     def remove_item(self, it...

File Compare Tool in Python and tkinter

 Below is the desktop application developed in Python to compare 2 files and find out the differences. Here is the code: import tkinter as tk from tkinter import filedialog from tkinter import ttk import time import threading class TextComparerApp:     def __init__(self, root):         self.root = root         self.root.title("Text Compare: by Vinayak")         self.root.geometry("800x730")  # Set default window size to 800x730 pixels         # Frame to hold upload buttons         self.upload_frame = tk.Frame(root)         self.upload_frame.pack(pady=10)         # First file upload button         self.upload_button1 = tk.Button(self.upload_frame, activebackground="#99e0aa", text="<--- Insert File 1 --->",                             ...

Add worklog in Jira using Python

 Below is the Python code to add the worklog in Jira. You need to install a request library for this. Here is the code: import requests from requests.auth import HTTPBasicAuth import json url = "https://your jira address here/rest/api/2/issue/ticket_number/worklog" auth = HTTPBasicAuth("username", "jira access token") headers = {     "Accept": "application/json",     "Content-Type": "application/json" } payload = json.dumps({     "comment": {         "content": [             {                 "content": [                     {                         "text": "This is for QA Testing",                         "type": "text"                     } ...

create a groups in Jira API using Python

 Below is the Python code to get create a groups in Jira. You need to install a request library for this. Here is the code: import requests from requests.auth import HTTPBasicAuth import json url = "https://your jira address here/rest/api/3/group" headers = {   "Accept": "application/json",   "Content-Type": "application/json" } payload = json.dumps( {   "name": "QA" } ) response = requests.request(    "POST",    url,    data=payload,    headers=headers,    auth=auth ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

Python code to get the groups in Jira

 Below is the Python code to get the groups in Jira. You need to install a request library for this. Here is the code: import requests url = "https://your jira address here/rest/api/2/user/groups?Name=jira name " \       "&accountId=account-id&username=username " payload={} headers = {    'User-Agent': 'Apidog/1.0.0 (https://apidog.com)' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) ============================================================= import requests from requests.auth import HTTPBasicAuth import json url = "https://your jira address here/rest/api/3/group" auth = HTTPBasicAuth("username", "jira access token") headers = {     "Accept": "application/json" } query = {     'groupId': 'groupId' } response = requests.request(     "GET",     url,     headers=headers,     params=query,     auth=auth ) print(js...

Get all the users from a group in Jira using Python

 Below is the Python code to get all the users from a group in Jira. You need to install a request library for this. Here is the code: import requests from requests.auth import HTTPBasicAuth import json url = "https://your jira address here/rest/api/3/group/member" auth = HTTPBasicAuth("username", "jira token mention here") headers = {   "Accept": "application/json" } query = {   'groupId': '6078c76f-bf47-4573-a150-b9f0285ac8aa' } response = requests.request(    "GET",    url,    headers=headers,    params=query,    auth=auth ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

Create worklog in Jira using Python

Below is the Python code to Create worklog in Jira. You need to install a request library for this. import requests from requests.auth import HTTPBasicAuth import json url = "https://your jira address here/worklog" auth = HTTPBasicAuth("username", "jira token mention here") headers = {   "Accept": "application/json" } response = requests.request(    "GET",    url,    headers=headers,    auth=auth ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

Capture Network Traffic in Python

  Below is the code to capture a network traffic in python import requests def check_web_traffic (url): try : response = requests.get(url) if response.status_code == 200 : print ( f"Web traffic for { url } is good." ) else : print ( f"Web traffic for { url } is not as expected. Status code: { response.status_code } " ) except requests.RequestException as e: print ( f"An error occurred: { e } " ) if __name__ == "__main__" : url = 'Put website url here' check_web_traffic(url)

Create Progress bar in Python

Following is the code to create a  Progress bar in Python. For that you need to install  tqdm package Here is the code: from tqdm import tqdm from time import sleep pbar = tqdm( total = 100 ) for i in range ( 10 ): sleep( 0.2 ) pbar.update( 10 ) pbar.close()