You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
432 B
14 lines
432 B
1 month ago
|
import requests
|
||
|
|
||
|
class ObjSender:
|
||
|
def __init__(self, ip, port):
|
||
|
self.ip = ip
|
||
|
self.port = port
|
||
|
self.server_url = f"http://{self.ip}:{self.port}/upload"
|
||
|
print(f"Files will be send to {self.server_url}!")
|
||
|
|
||
|
def send_file(self, file_path):
|
||
|
with open(file_path, 'rb') as file:
|
||
|
response = requests.post(self.server_url, files={'file': file})
|
||
|
print(response.text)
|