import requests
class GoogleImageAPI:
"""
A simple class to interact with the Google Image API.
"""
def __init__(self, base_url):
"""
Initialize the GoogleImageAPI with the base URL of the API.
Args:
base_url (str): The base URL of the API.
"""
self.base_url = base_url
def search_images(self, query):
"""
Retrieve images from Google Image API based on the query.
Args:
query (str): The search query for images.
Returns:
dict: A dictionary containing the API response.
"""
endpoint = f"{self.base_url}/googleimg?query={query}"
headers = {"accept": "application/json"}
response = requests.get(endpoint, headers=headers)
if response.status_code == 200:
return response.json()
else:
return {"error": f"Failed to retrieve images. Status code: {response.status_code}"}
# Instantiating the class
google_image_api = GoogleImageAPI(base_url="https://mukesh-api.vercel.app")
# Searching for images
result = google_image_api.search_images(query="Boy")
print(result)
Forwarded from ˹ᴍʀ sᴜᴋᴋᴜɴ˼ (Mᴜᴋᴇsʜ)
import requests
class Blackbox:
"""
A class to interact with the Blackbox API.
Attributes:
base_url (str): The base URL of the Blackbox API.
"""
def __init__(self):
self.base_url = "https://mukesh-api.vercel.app/blackbox"
def make_request(self, query):
"""
Makes a request to the Blackbox API with the provided query.
Args:
query (str): The query string to send to the API.
Returns:
dict: The JSON response from the API.
@mr_sukkun
"""
url = f"{self.base_url}?query={query}"
headers = {
"accept": "application/json"
}
response = requests.get(url, headers=headers)
return response.json()
# Example usage
box = Blackbox()
result = box.make_request("hi")
print(result)
# blackbox ai alternative of chatgpt using python
by : @mr_sukkun
❤1
What is the difference between GET and POST methods in HTTP?
Anonymous Quiz
22%
a) GET sends data visibly in the URL, POST hides it
33%
b) GET is for retrieving data, POST for sending data
11%
c) GET is faster, POST is more secure
33%
d) All of the above
What arithmetic operators cannot be used with strings in Python?
Anonymous Quiz
24%
*
13%
+
25%
-
38%
All of the mentioned
# INHERITANCE IN PYTHON
import requests
class GoogleImageAPI:
"""
A simple class to interact with the Google Image API.
"""
def __init__(self, base_url):
self.base_url = base_url
def search_images(self, query):
endpoint = f"{self.base_url}/googleimg?query={query}"
headers = {"accept": "application/json"}
response = requests.get(endpoint, headers=headers)
if response.status_code == 200:
return response.json()
else:
return {"error": f"Failed to retrieve images. Status code: {response.status_code}"}
class Blackbox(GoogleImageAPI):
def init(self,base_url):
super().__init__(base_url)
def blackbox_response(self,query):
endpoint = f"{self.base_url}/blackbox?query={query}"
response = requests.get(endpoint)
if response.status_code == 200:
return response.json()
else:
return {"error": f"Failed to retrieve images. Status code: {response.status_code}"}
bl=Blackbox(base_url="https://mukesh-api.vercel.app")
print(bl.blackbox_response(query="write simple python flask app"))
print(bl.search_images("boy"))
❤2👍2
Getter and Setters in Python
import requests
class MukeshAPI:
"""
A simple class to interact with the API.
"""
def __init__(self, base_url="https://mukesh-api.vercel.app",endpoint=""):
self._base_url = base_url
self._endpoint=endpoint
@property
def endpoint(self):
return self._endpoint
@endpoint.setter
def endpoint(self, new_endpoint):
self._endpoint = new_endpoint
def search(self, query):
url = f"{self._base_url}/{self.endpoint}?query={query}"
headers = {"accept": "application/json"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()["results"]
else:
return {"error": f"Failed to retrieve. Status code: {response.status_code}"}
def search2(self):
url = f"{self._base_url}/{self.endpoint}"
headers = {"accept": "application/json"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()["results"]
else:
return {"error": f"Failed to retrieve. Status code: {response.status_code}"}
def search3(self,api_key, query):
url = f"{self._base_url}/{self.endpoint}?query={query}"
headers = {"accept": "application/json","Api-Key":api_key}
response = requests.post(url, headers=headers)
if response.status_code == 200:
return response.json()
else:
return {"error": f"Failed to retrieve. Status code: {response.status_code}"}
bl=MukeshAPI(endpoint="bhagwatgita")
print(bl.endpoint)
print(bl.search3(api_key="get from @adventure_robot",query=1))
bl.endpoint="truth"
print(bl.endpoint)
print(bl.search2())
bl.endpoint = "chatgpt"
print(bl.endpoint)
print(bl.search("write basic website code using html and css"))
❤1
# Foundations of Hacking and Pentesting Android Apps
Run code to download video in ur system
source code : https://github.com/Noob-mukesh/Python-Projects/blob/main/hackingudemycourse.py
About this course
Learn how to hack Android apps, and find vulnerabilties
By the numbers
Skill level: Beginner Level
Students: 55064
Languages: English
Captions: Yes
Lectures: 15
Video: 1.5 total hours
Features
Available on iOS and Android
What you’ll learn
Setting up Android Studio and Emulators
Basics of adb
Decompiling apks
Insecure Logging
Hardcoding Issues
Insecure Data Storage
Input Valdiation Issues
Drozer
Finding Attack Surfaces
Access Control Issues
Content Provider Injections
General Bug Hunting Tips
Are there any course requirements or prerequisites?
A basic understanding of programming
Who this course is for:
Android developers looking to secure their applications
Hackers looking to learn common Android vulnerabilities
Run code to download video in ur system
source code : https://github.com/Noob-mukesh/Python-Projects/blob/main/hackingudemycourse.py
About this course
Learn how to hack Android apps, and find vulnerabilties
By the numbers
Skill level: Beginner Level
Students: 55064
Languages: English
Captions: Yes
Lectures: 15
Video: 1.5 total hours
Features
Available on iOS and Android
What you’ll learn
Setting up Android Studio and Emulators
Basics of adb
Decompiling apks
Insecure Logging
Hardcoding Issues
Insecure Data Storage
Input Valdiation Issues
Drozer
Finding Attack Surfaces
Access Control Issues
Content Provider Injections
General Bug Hunting Tips
Are there any course requirements or prerequisites?
A basic understanding of programming
Who this course is for:
Android developers looking to secure their applications
Hackers looking to learn common Android vulnerabilities
🔥2❤1👍1
Simple website using python #flask
Join :- @Python_Codes_Pro
Support group :- @python_group_pro
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return '@Legend_coder'
if __name__ == "__main__":
app.run()
Join :- @Python_Codes_Pro
Support group :- @python_group_pro
Python Tip for the day:
Use the "enumerate" function to iterate over a sequence and get the index of each element.
Sometimes when you're iterating over a list or other sequence in Python, you need to keep track of the index of the current element. One way to do this is to use a counter variable and increment it on each iteration, but this can be tedious and error-prone.
A better way to get the index of each element is to use the built-in "enumerate" function. The "enumerate" function takes an iterable (such as a list or tuple) as its argument and returns a sequence of (index, value) tuples, where "index" is the index of the current element and "value" is the value of the current element. Here's an example:
The output of this code would be:
Use the "enumerate" function to iterate over a sequence and get the index of each element.
Sometimes when you're iterating over a list or other sequence in Python, you need to keep track of the index of the current element. One way to do this is to use a counter variable and increment it on each iteration, but this can be tedious and error-prone.
A better way to get the index of each element is to use the built-in "enumerate" function. The "enumerate" function takes an iterable (such as a list or tuple) as its argument and returns a sequence of (index, value) tuples, where "index" is the index of the current element and "value" is the value of the current element. Here's an example:
#Iterate over a list of strings and print each string with its iIn this example, we use the "enumerate" function to iterate over a list of strings. On each iteration, the "enumerate" function returns a tuple containing the index of the current string and the string itself. We use tuple unpacking to assign these values to the variables "i" and "s", and then print out the index and string on a separate line.
strings = ['apple', 'banana', 'cherry', 'date']
for i, s in enumerate(strings):
print(f"{i}: {s}")
The output of this code would be:
appleUsing the "enumerate" function can make your code more concise and easier to read, especially when you need to keep track of the index of each element in a sequence.
1: banana
2: cherry
3: date
Number Guessing Game Using python..
Join :- @Python_Codes_Pro
Support group :- @python_group_pro
import random
def play_guessing_game():
print("Welcome to the Guessing Game!")
# by @mr_sukkun
# join : https://t.me/Python_Codes_Pro
secret_number = random.randint(1, 100)
attempts = 0
while True:
guess = int(input("Enter your guess (between 1 and 100): "))
attempts += 1
if guess < secret_number:
print("Too low! Try again.")
elif guess > secret_number:
print("Too high! Try again.")
else:
print(f"Congratulations! You've guessed the secret number {secret_number} in {attempts} attempts!")
break
play_guessing_game()
Join :- @Python_Codes_Pro
Support group :- @python_group_pro
👍3❤1
Which of the following concepts is not a part of Python?
Anonymous Quiz
50%
Pointers
13%
Loops
27%
Dynamic typing
10%
All of the above
# Pastebin Using Python
Join :- @Python_Codes_Pro
Support group :- @python_group_pro
import requests
def pastebin(content):
"""
Function to post content to a pastebin service and return the URL of the paste.
Args:
content (str): The content to be pasted
Returns:
str: The URL of the paste
"""
headers = {
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0"}
data = {"snippet":content}
response = requests.post(f'https://bin.kv2.dev/', json=data, headers=headers)
yield response.url
print(next(pastebin("hi")))
Join :- @Python_Codes_Pro
Support group :- @python_group_pro
❤2
❤1
What will be the output of the following Python code?
Anonymous Quiz
32%
a b c
19%
1 2 3
31%
0 a 1 b 2 c
18%
none