File size: 457 Bytes
e390907
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import requests

# Read from file
response = requests.get('http://localhost:5000/file')
print(response.json())

# Write to file (overwrite)
response = requests.post('http://localhost:5000/file', 
                        json={'content': 'Hello, World!'})
print(response.json())

# Append to file
response = requests.post('http://localhost:5000/file', 
                        json={'content': '\nNew line', 'mode': 'a'})
print(response.json())