User Tools

Site Tools


informatica:linux:python

PUT

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import requests, json, sys

url = 'http://tomcat-1.dev.local.jamgo.org:8080/location-server/resources/category'
data = {
   "id": 1,
   "name": "Textil, calcat i moda update update 6",
   "description": "",
   "type": None,
   "parent": None,
   "customerCount": 94,
   "iconPath": None
}
headers = {'content-type': 'application/json'}

r = requests.put(url, data=json.dumps(data), headers=headers)
print r.status_code
print(r.text)

Fecha

Python 3

import datetime
f"{datetime.datetime.now():%Y%m%d_%H%M%S}"

'20191015_212507'

Python 2

from datetime import datetime
fecha = datetime.now() 
print(fecha.strftime("%Y/%m/%d_%H:%M:%S"))
informatica/linux/python.txt · Last modified: 2022/10/25 21:39 by jose