You most explain better and show some data.
Is DATE that you mention a Python datetime object?
It's not hard to convert a date back and forth.
Often can use Requests with POST parameter to server(has often a API).
Eg:
Is DATE that you mention a Python datetime object?
It's not hard to convert a date back and forth.
>>> from datetime import datetime >>> >>> dt = datetime.now() >>> # It's now a datetime object >>> dt datetime.datetime(2018, 11, 6, 19, 27, 40, 618447) >>> type(dt) <class 'datetime.datetime'> >>> >>> # To string >>> date_string = dt.strftime('%B %d, %Y') >>> date_string 'November 06, 2018' >>> >>> # f-string 3.6 --> >>> date_string = f'{dt:%B %d, %Y}' >>> date_string 'November 06, 2018'
Quote:QUESTION IS:HOW do I accept a simple date into a program, then turn around and feed that date into a long URL string with ONE parameter being that date?It dependents on what server will take in as data,can construct a url with a date parameter.
Often can use Requests with POST parameter to server(has often a API).
Eg:
from datetime import datetime import requests dt = datetime.now() date_string = f'{dt:%B %d, %Y}' payload = {'user_name': 'admin', 'date': date_string} r = requests.post("http://httpbin.org/post", json=payload) print(r.text) json_data = r.json() print(json_data['json']['date'])
Output:{
"args": {},
"data": "{\"user_name\": \"admin\", \"date\": \"November 06, 2018\"}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Content-Length": "51",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.19.1"
},
"json": {
"date": "November 06, 2018",
"user_name": "admin"
},
"origin": "46.246.118.243",
"url": "http://httpbin.org/post"
}
November 06, 2018