Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Values in date URL
#1
Hi
First time here and newbie learning Python, so hope you can help me ?

This is the amended url, which works internally only and will return 5 seconds of data

http://monitoring/dashboards/php/feed/liveviewership.php?graphdata=true&startday=20180415%2007:00&endday=20180415%2007:05

How can I ask the user for the startday and endday values, check its correct date and time format and use the user date/time for checking the data ?

From the data returned I have to put it into fields to look for the min and max and amount of data.

Any help or advice would be very gratefully received

Thanks
Reply
#2
5 seconds of what?
min and max of what?
what are the fields?
To get help, you need to help us!
Reply
#3
this is a sample data


Output:
{"statusCode":200,"data":{ "entryStamp":[1523775900,1523776200,1523776500,1523776800,1523777100,1523777400,1523777700,1523778000,1523778300,1523778600,1523778900], "Viewers":[80276,83172,86424,88654,90414,93423,96539,97587,100604,99532,82549], "VodViewers":[9342,9702,10047,10380,10623,10875,11294,11626,11910,12149,12488], "LinViewers":[70934,73470,76377,78274,79791,82548,85245,85961,88694,87383,70061], "tvViewers":[64854,67255,69471,71630,73699,75851,78000,80212,82438,83706,83533], "tvVodViewers":[34709,36485,38144,39760,41329,42895,44449,46065,47744,49100,50595], "tvLinViewers":[30145,30770,31327,31870,32370,32956,33551,34147,34694,34606,32938], "storeVodViewers":[147,145,148,156,163,170,181,181,167,184,181], "appVodViewers":[2281,2367,2407,2422,2486,2569,2643,2607,2608,2622,2648], "qViewers":[5683,5996,6204,6391,6474,6788,6872,7009,7338,6126,5561], "qVodViewers":[1993,2087,2117,2192,2232,2297,2363,2421,2495,2472,2504], "qLinViewers":[3690,3909,4087,4199,4242,4491,4509,4588,4843,3654,3057], "iViewers":[302,320,325,343,353,368,377,385,402,400,413], "iVodViewers":[122,136,143,158,167,179,187,192,202,206,222], "iLinViewers":[180,184,182,185,186,189,190,193,200,194,191], "vodViewers":[48594,50922,53006,55068,57000,58985,61117,63092,65126,66733,68638], "linearViewers":[104949,108333,111973,114528,116589,120184,123495,124889,128431,125837,106247], "totalViewers":[153559,159267,164993,169617,173614,179205,184629,187994,193575,192589,174912], "peak":[8516,8594,8804,9008,9203,9348,9593,9739,9947,10174,9033],
Reply
#4
Ive had no help or suggestions on this.

Just to be clear I Was looking how I ask a user for the start date put it in startday=20180415%2007:00, checking it is a valid date and the same for endday=20180415%2007:05.

So the url might look like

http://monitoring/dashboards/php/feed/liveviewership.php?graphdata=true&startday=cust_startdate&endday=cust_enddate

I can do the rest.

Thanks
Reply
#5
>>> startday = '20180415%2007:00'
>>> endday = '20180415%2007:05'
>>> print(f'http://monitoring/dashboards/php/feed/liveviewership.php?graphdata=true&{startday}=cust_startdate&{endday}=cust_enddate')
http://monitoring/dashboards/php/feed/liveviewership.php?graphdata=true&20180415%2007:00=cust_startdate&20180415%2007:05=cust_enddate

>>> # Not using 3.6,use format()
>>> print('http://monitoring/dashboards/php/feed/liveviewership.php?graphdata=true&{}=cust_startdate&{}=cust_enddate'.format(startday, endday))
http://monitoring/dashboards/php/feed/liveviewership.php?graphdata=true&20180415%2007:00=cust_startdate&20180415%2007:05=cust_enddate
Reply
#6
thank you snippsat

I will try this overnight.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare current date on calendar with date format file name Fioravanti 1 199 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
  Python date format changes to date & time 1418 4 574 Jan-20-2024, 04:45 AM
Last Post: 1418
  Date format and past date check function Turtle 5 4,198 Oct-22-2021, 09:45 PM
Last Post: deanhystad
  How to add previous date infront of every unique customer id's invoice date ur_enegmatic 1 2,219 Feb-06-2021, 10:48 PM
Last Post: eddywinch82
  How to add date and years(integer) to get a date NG0824 4 2,841 Sep-03-2020, 02:25 PM
Last Post: NG0824
  Substracting today's date from a date in column of dates to get an integer value firebird 1 2,124 Jul-04-2019, 06:54 PM
Last Post: Axel_Erfurt
  How to change existing date to current date in a filename? shankar455 1 2,286 Apr-17-2019, 01:53 PM
Last Post: snippsat
  Date format conversion "/Date(158889600000)/" lbitten 2 2,823 Nov-29-2018, 02:14 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020