| 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()) |