Instapy: Feature Request: Instapy terminal output suggestion

Created on 21 Nov 2018  ยท  4Comments  ยท  Source: timgrossmann/InstaPy

At the end of a successful run, instaPy outputs the following

INFO [2018-11-21 10:26:57] [codingnaija]  Session ended!
INFO:codingnaija:Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooo

Proposed Solution (optional)

it would be convenient to know the start and end time of each run so I can iterate with scripts that run for different amounts of time.

for example

INFO [2018-11-21 10:26:57] [codingnaija]  Session ended!
INFO [Run Time - start time and end time]
INFO:codingnaija:Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooo

or

INFO [2018-11-21 10:26:57] [codingnaija]  Session ended!
INFO [Run time - 45mins]
INFO:codingnaija:Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooo

now I know that I could check the logs and get this data myself. but I feel seeing it on the terminal makes it faster as that's the last output.

as to why i need that data, i usually gain more success from short-run scripts that run on a schedule, so i will usually iterate with my numbers till I can get a runtime of 30-45 minutes

@converge @uluQulu @sionking @ilmetu what do you guys think?

feature request

Most helpful comment

I have implemented this in all my scripts with other random logs/helpers.

Maybe the following can help you.

Just add/import:

from datetime import datetime
from datetime import timedelta

At the start of the script use this:

"""SESSION START TIME"""
yourname_session_startime = datetime.now()

At the end use this:

"""PRINT RUNTIME"""
yourname_session_runtime = datetime.now() - yourname_session_startime
print("INFO - Session run time:", yourname_session_runtime)

You can also print this to a txt file. I usually log my followers/following and runtime for each session on a separate file (easier to read and use). ;)

Edit:
Correction, you don't even need to import timedelta, i use it for timing my loops. Just import datetime. ;)

All 4 comments

I have no opinion about your suggestion but I really don't get why all my outputs are double like your ones:

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2018-11-21 10:26:57] [codingnaija] Session ended!
INFO:codingnaija:Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooo

How can I stop that double print() ?

Very interesting idea, @Areahints!

Actually, I hardly understood how you will be going to benefit from that addition.
In its simplest form, the information on runtime interval will be so good for everybody.
People like statistics โ˜•

Can you write it out as you wish and open a pull request?
So that we can see what you mean more clearly, agree on a format and so add to upstream.

@JoeFertig, @Areahints
The issue with duplicate log messages is being discussed at #3311 and please, provide your [helpful] feedback in there to solve that problem.


Cheers ๐Ÿ˜

I have implemented this in all my scripts with other random logs/helpers.

Maybe the following can help you.

Just add/import:

from datetime import datetime
from datetime import timedelta

At the start of the script use this:

"""SESSION START TIME"""
yourname_session_startime = datetime.now()

At the end use this:

"""PRINT RUNTIME"""
yourname_session_runtime = datetime.now() - yourname_session_startime
print("INFO - Session run time:", yourname_session_runtime)

You can also print this to a txt file. I usually log my followers/following and runtime for each session on a separate file (easier to read and use). ;)

Edit:
Correction, you don't even need to import timedelta, i use it for timing my loops. Just import datetime. ;)

@Areahints @visualheroes

See https://github.com/timgrossmann/InstaPy/pull/3460/commits/19db8a902f57df9924491cb44fc9cc08b6f7803d at #3460 for the feature described here.

Thanks to @Areahints for the idea ๐Ÿ‘๐Ÿผ


Cheers ๐Ÿ˜

Was this page helpful?
0 / 5 - 0 ratings

Related issues

v77v picture v77v  ยท  3Comments

tibor picture tibor  ยท  3Comments

ghost picture ghost  ยท  3Comments

rahulkapoor90 picture rahulkapoor90  ยท  3Comments

deronsizemore picture deronsizemore  ยท  3Comments