workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
If include isn't an empty list then the entry is included if not in exclude. If include has entries and the entry matches one of the items in include then the entry is included if not in exclude.
2017-07-10T23:30:21.686079
Meghan
pythondev_help_Meghan_2017-07-10T23:30:21.686079
1,499,729,421.686079
84,603
pythondev
help
So, if whitelist then only include entry if it is in whilelist (and also not in blacklist). If only blacklist include everything not in blacklist.
2017-07-10T23:32:23.706777
Meghan
pythondev_help_Meghan_2017-07-10T23:32:23.706777
1,499,729,543.706777
84,604
pythondev
help
brb
2017-07-10T23:32:29.707812
Deedee
pythondev_help_Deedee_2017-07-10T23:32:29.707812
1,499,729,549.707812
84,605
pythondev
help
The first if is necessary as well, because without it the code would see if entry is in an empty list, which it never will be and the lack of whitelist means nothing gets through.
2017-07-10T23:33:31.718196
Meghan
pythondev_help_Meghan_2017-07-10T23:33:31.718196
1,499,729,611.718196
84,606
pythondev
help
It might be better if I changed those variables names to whiltelist and blacklist.
2017-07-10T23:36:40.749052
Meghan
pythondev_help_Meghan_2017-07-10T23:36:40.749052
1,499,729,800.749052
84,607
pythondev
help
<@Meghan> Check this out: ``` def _query_filter(entry: str, include: list = None, exclude: list = None): if include: if entry in include and entry not in exclude: return True else: if entry not in exclude: return True return False print("Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever']: " + str(_query_filter('test', ['this', 'is', 'a', 'test'], ['whatever']))) print("Entry: 'test', include is [], exclude is ['whatever']: " + str(_query_filter('test', [], ['whatever']))) ``` output: ``` Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever']: True Entry: 'test', include is [], exclude is ['whatever']: True ```
2017-07-10T23:52:05.895262
Deedee
pythondev_help_Deedee_2017-07-10T23:52:05.895262
1,499,730,725.895262
84,608
pythondev
help
`if include` has no value b/c the very next line you are checking for the exact same thing that the `else` checks
2017-07-10T23:53:17.907228
Deedee
pythondev_help_Deedee_2017-07-10T23:53:17.907228
1,499,730,797.907228
84,609
pythondev
help
as it is written, `_query_filter()` returns True if `entry` is NOT in `exclude` and False for anything else
2017-07-10T23:54:29.919040
Deedee
pythondev_help_Deedee_2017-07-10T23:54:29.919040
1,499,730,869.91904
84,610
pythondev
help
I think you misunderstand the meaning of include.
2017-07-10T23:55:50.932237
Meghan
pythondev_help_Meghan_2017-07-10T23:55:50.932237
1,499,730,950.932237
84,611
pythondev
help
``` def _query_filter(entry: str, include: list = None, exclude: list = None): if include: if entry in include and entry not in exclude: return True else: if entry not in exclude: return True return False print("Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever']: " + str(_query_filter('test', ['this', 'is', 'a', 'test'], ['whatever']))) print("Entry: 'test', include is [], exclude is ['whatever']: " + str(_query_filter('test', [], ['whatever']))) print("Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever', 'test']: " + str(_query_filter('test', ['this', 'is', 'a', 'test'], ['whatever', 'test']))) print("Entry: 'test', include is [], exclude is ['whatever', 'test']: " + str(_query_filter('test', [], ['whatever', 'test']))) ``` output: ``` Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever']: True Entry: 'test', include is [], exclude is ['whatever']: True Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever', 'test']: False Entry: 'test', include is [], exclude is ['whatever', 'test']: False ```
2017-07-10T23:55:52.932589
Deedee
pythondev_help_Deedee_2017-07-10T23:55:52.932589
1,499,730,952.932589
84,612
pythondev
help
Here is one set of my tests for it. The first test shows what the raw data is. ``` def test_counts_query_unfiltered(self): counts = pypihole.counts_query(self.test_log) self.assertEqual(counts['unifi'], 2) self.assertEqual(counts['openvpn'], 2) self.assertEqual(counts['<http://docs.google.com|docs.google.com>'], 1) def test_counts_query_include(self): counts = pypihole.counts_query(self.test_log, ['unifi']) self.assertEqual(counts['unifi'], 2) self.assertEqual(counts['openvpn'], 0) def test_counts_query_exclude(self): counts = pypihole.counts_query(self.test_log, exclude=['openvpn']) self.assertEqual(counts['unifi'], 2) self.assertEqual(counts['openvpn'], 0) self.assertEqual(counts['<http://docs.google.com|docs.google.com>'], 1) def test_counts_query_include_and_exclude(self): counts = pypihole.counts_query(self.test_log, include=['unifi', '<http://docs.google.com|docs.google.com>'], exclude=['openvpn']) self.assertEqual(counts['unifi'], 2) self.assertEqual(counts['openvpn'], 0) self.assertEqual(counts['<http://docs.google.com|docs.google.com>'], 1) ```
2017-07-10T23:56:54.942595
Meghan
pythondev_help_Meghan_2017-07-10T23:56:54.942595
1,499,731,014.942595
84,613
pythondev
help
All of the tests pass as it is currently.
2017-07-10T23:58:04.953938
Meghan
pythondev_help_Meghan_2017-07-10T23:58:04.953938
1,499,731,084.953938
84,614
pythondev
help
Include is a whitelist, but only used if it isn't an empty list. If include is an empty list then it is ignored.
2017-07-10T23:58:37.959317
Meghan
pythondev_help_Meghan_2017-07-10T23:58:37.959317
1,499,731,117.959317
84,615
pythondev
help
Your example is the intended result.
2017-07-10T23:59:29.969157
Meghan
pythondev_help_Meghan_2017-07-10T23:59:29.969157
1,499,731,169.969157
84,616
pythondev
help
It works similarly to the include used on some routers, or like grep in a way. If include isn't specified everything is returned True. If include is populated then it acts as a whiltelist. And exclude works as a blacklist.
2017-07-11T00:01:18.990208
Meghan
pythondev_help_Meghan_2017-07-11T00:01:18.990208
1,499,731,278.990208
84,617
pythondev
help
output: ``` 'Entry: 'test' NOT IN exclude: Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever']: True Entry: 'test', include is [], exclude is ['whatever']: True Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever']: True Entry: 'test', include is [], exclude is ['whatever']: True Entry: 'test' IN exclude: Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever', 'test']: False Entry: 'test', include is [], exclude is ['whatever', 'test']: False Entry: 'test', include is ['this', 'is', 'a', 'test'], exclude is ['whatever', 'test']: False Entry: 'test', include is [], exclude is ['whatever', 'test']: False ```
2017-07-11T00:05:04.028027
Deedee
pythondev_help_Deedee_2017-07-11T00:05:04.028027
1,499,731,504.028027
84,618
pythondev
help
&gt; If include isn't specified everything is returned True That's not what is happening.
2017-07-11T00:05:32.032697
Deedee
pythondev_help_Deedee_2017-07-11T00:05:32.032697
1,499,731,532.032697
84,619
pythondev
help
Sorry, that should say if include isn't specified, and exclude doesn't trigger, then it is returned True.
2017-07-11T00:06:14.039710
Meghan
pythondev_help_Meghan_2017-07-11T00:06:14.039710
1,499,731,574.03971
84,620
pythondev
help
but I could be wrong. Probably best to wait for someone else to chime in
2017-07-11T00:06:15.040007
Deedee
pythondev_help_Deedee_2017-07-11T00:06:15.040007
1,499,731,575.040007
84,621
pythondev
help
There is no problem with that code, it tests perfectly.
2017-07-11T00:06:26.041876
Meghan
pythondev_help_Meghan_2017-07-11T00:06:26.041876
1,499,731,586.041876
84,622
pythondev
help
ok
2017-07-11T00:06:31.042682
Deedee
pythondev_help_Deedee_2017-07-11T00:06:31.042682
1,499,731,591.042682
84,623
pythondev
help
Sorry if I was unclear on that.
2017-07-11T00:06:43.044598
Meghan
pythondev_help_Meghan_2017-07-11T00:06:43.044598
1,499,731,603.044598
84,624
pythondev
help
My question is about the namedtuple.
2017-07-11T00:06:50.045769
Meghan
pythondev_help_Meghan_2017-07-11T00:06:50.045769
1,499,731,610.045769
84,625
pythondev
help
Rather than sending entry[index] I am wondering, short of a dict or a class, if there is a better way, that is closer to sending entry.query.
2017-07-11T00:07:31.052417
Meghan
pythondev_help_Meghan_2017-07-11T00:07:31.052417
1,499,731,651.052417
84,626
pythondev
help
<@Deedee>, here you go: <https://github.com/TomFaulkner/pypihole>
2017-07-11T00:09:15.068809
Meghan
pythondev_help_Meghan_2017-07-11T00:09:15.068809
1,499,731,755.068809
84,627
pythondev
help
Posting this b/c it got pushed up a ways. In case anyone else wants to give it a shot.
2017-07-11T00:09:31.071251
Deedee
pythondev_help_Deedee_2017-07-11T00:09:31.071251
1,499,731,771.071251
84,628
pythondev
help
Thanks.
2017-07-11T00:09:41.072900
Meghan
pythondev_help_Meghan_2017-07-11T00:09:41.072900
1,499,731,781.0729
84,629
pythondev
help
Full code to the above: <https://github.com/TomFaulkner/pypihole>
2017-07-11T00:09:58.075628
Meghan
pythondev_help_Meghan_2017-07-11T00:09:58.075628
1,499,731,798.075628
84,630
pythondev
help
<@Meghan> the easy answer is that you should never change the indexes/order on a named tuple
2017-07-11T00:32:03.287987
Signe
pythondev_help_Signe_2017-07-11T00:32:03.287987
1,499,733,123.287987
84,631
pythondev
help
Thats a breaking change. If your concerned about that, you should probably use a class or dictionary and not let people use indexes
2017-07-11T00:32:50.295851
Signe
pythondev_help_Signe_2017-07-11T00:32:50.295851
1,499,733,170.295851
84,632
pythondev
help
Yeah, I think I probably have to agree there. As nice as namedtuples are, that does make it easy to break things should the data being analyzed changed.
2017-07-11T00:34:04.308359
Meghan
pythondev_help_Meghan_2017-07-11T00:34:04.308359
1,499,733,244.308359
84,633
pythondev
help
<@Meghan> Are you trying to get the index of the property, when you first defined it? `Query._fields.index('client')`
2017-07-11T00:37:07.337114
Kiersten
pythondev_help_Kiersten_2017-07-11T00:37:07.337114
1,499,733,427.337114
84,634
pythondev
help
Not sure if I understood correctly
2017-07-11T00:38:05.346138
Kiersten
pythondev_help_Kiersten_2017-07-11T00:38:05.346138
1,499,733,485.346138
84,635
pythondev
help
You did, that works well.
2017-07-11T00:39:07.356138
Meghan
pythondev_help_Meghan_2017-07-11T00:39:07.356138
1,499,733,547.356138
84,636
pythondev
help
However, it also starts with an underscore. I can't imagine standard lib changing that, but...
2017-07-11T00:39:58.364088
Meghan
pythondev_help_Meghan_2017-07-11T00:39:58.364088
1,499,733,598.364088
84,637
pythondev
help
Actually, in the case of a namedtuple, it might make sense to do the underscore to avoid someone naming one of their fields 'fields' and breaking things.
2017-07-11T00:40:45.371478
Meghan
pythondev_help_Meghan_2017-07-11T00:40:45.371478
1,499,733,645.371478
84,638
pythondev
help
I know we already went over this but I really think that: ``` if include: if entry in include and entry not in exclude: return True else: if entry not in exclude: return True return False ``` Should read be: ``` if include and entry in include and entry not in exclude: return True else: return False ```
2017-07-11T00:42:47.390382
Deedee
pythondev_help_Deedee_2017-07-11T00:42:47.390382
1,499,733,767.390382
84,639
pythondev
help
Except then if include is empty it returns false, which is not the desired effect.
2017-07-11T00:43:19.395330
Meghan
pythondev_help_Meghan_2017-07-11T00:43:19.395330
1,499,733,799.39533
84,640
pythondev
help
It is an optional whitelist.
2017-07-11T00:43:35.397907
Meghan
pythondev_help_Meghan_2017-07-11T00:43:35.397907
1,499,733,815.397907
84,641
pythondev
help
ok
2017-07-11T00:43:45.399526
Deedee
pythondev_help_Deedee_2017-07-11T00:43:45.399526
1,499,733,825.399526
84,642
pythondev
help
<@Meghan> Just checked the docs, it says "In addition to the methods inherited from tuples, named tuples support three additional methods and two attributes. To prevent conflicts with field names, the method and attribute names start with an underscore."
2017-07-11T00:44:21.405140
Kiersten
pythondev_help_Kiersten_2017-07-11T00:44:21.405140
1,499,733,861.40514
84,643
pythondev
help
Nice. :smile:
2017-07-11T00:44:29.406619
Meghan
pythondev_help_Meghan_2017-07-11T00:44:29.406619
1,499,733,869.406619
84,644
pythondev
help
Thank you!
2017-07-11T00:44:45.409027
Meghan
pythondev_help_Meghan_2017-07-11T00:44:45.409027
1,499,733,885.409027
84,645
pythondev
help
Ended up using getattr for this on the namedtuple. getattr(mytuple, 'fieldname') :slightly_smiling_face:
2017-07-11T01:15:15.708007
Meghan
pythondev_help_Meghan_2017-07-11T01:15:15.708007
1,499,735,715.708007
84,646
pythondev
help
<@Meghan> Wouldn't that be the same as mytuple.fieldname ?
2017-07-11T01:29:40.852117
Kiersten
pythondev_help_Kiersten_2017-07-11T01:29:40.852117
1,499,736,580.852117
84,647
pythondev
help
That's what I've been wondering the whole time, I feel like the point of a named tuple is to be able to use the `.` operator.
2017-07-11T01:36:32.920262
Beula
pythondev_help_Beula_2017-07-11T01:36:32.920262
1,499,736,992.920262
84,648
pythondev
help
<@Beula> also, a nice repr
2017-07-11T01:38:15.937244
Collette
pythondev_help_Collette_2017-07-11T01:38:15.937244
1,499,737,095.937244
84,649
pythondev
help
But today we have `attrs`
2017-07-11T01:38:22.938419
Collette
pythondev_help_Collette_2017-07-11T01:38:22.938419
1,499,737,102.938419
84,650
pythondev
help
And it be immutable, etc
2017-07-11T01:38:58.944492
Beula
pythondev_help_Beula_2017-07-11T01:38:58.944492
1,499,737,138.944492
84,651
pythondev
help
i need help this following code is not working list1 = [1, 2, 3, 4, 5] list2 = ["a", "b", "c","d", "e"] dict1 = {} for index1 in xrange(len(list1)): dict1[list1[index1]] = list2[index1] print(dict1)
2017-07-11T02:31:28.550532
Reina
pythondev_help_Reina_2017-07-11T02:31:28.550532
1,499,740,288.550532
84,652
pythondev
help
error -&gt; NameError: name 'xrange' is not defined
2017-07-11T02:31:46.554417
Reina
pythondev_help_Reina_2017-07-11T02:31:46.554417
1,499,740,306.554417
84,653
pythondev
help
<@Reina> I guess you are using Python3. Python3 does not have xrange, instead you can use range.
2017-07-11T02:32:40.567015
Shelly
pythondev_help_Shelly_2017-07-11T02:32:40.567015
1,499,740,360.567015
84,654
pythondev
help
<@Shelly> yes sir i am using python3
2017-07-11T02:35:14.603140
Reina
pythondev_help_Reina_2017-07-11T02:35:14.603140
1,499,740,514.60314
84,655
pythondev
help
now problem solved :smile:
2017-07-11T02:35:34.607800
Reina
pythondev_help_Reina_2017-07-11T02:35:34.607800
1,499,740,534.6078
84,656
pythondev
help
Thanks
2017-07-11T02:35:37.608370
Reina
pythondev_help_Reina_2017-07-11T02:35:37.608370
1,499,740,537.60837
84,657
pythondev
help
I would prefer a :taco: :wink:
2017-07-11T02:36:39.623444
Shelly
pythondev_help_Shelly_2017-07-11T02:36:39.623444
1,499,740,599.623444
84,658
pythondev
help
<@Shelly> sir now i am doing this exercise Use the dictionary, port1 = {21: "FTP", 22:"SSH", 23: "telnet", 80: "http"}, and make a new dictionary in which keys become values and values become keys, as shown: Port2 = {“FTP":21, "SSH":22, “telnet":23, "http": 80 my ans is --&gt; port1 = {21:"FTP",22:"SSH",23:"Telnet",80:"HTTP"} port2 = {} for v,k in port1.items(): port2.append(v + " : " + k) but showing error
2017-07-11T02:57:46.933836
Reina
pythondev_help_Reina_2017-07-11T02:57:46.933836
1,499,741,866.933836
84,659
pythondev
help
Python supports dictionary comprehensions, `port2 = {value:key for key, value in port1.items()}` so iterating the `key, value` pair from each item of the dictionary, and switching their positions for the comprehension will work
2017-07-11T03:09:04.119817
Carri
pythondev_help_Carri_2017-07-11T03:09:04.119817
1,499,742,544.119817
84,660
pythondev
help
thanks this is what i did res = dict((v,k) for k,v in port1.items()) print(res) and works fine
2017-07-11T03:13:51.198852
Reina
pythondev_help_Reina_2017-07-11T03:13:51.198852
1,499,742,831.198852
84,661
pythondev
help
<@Reina> You can also use `zip` to build a dictionary from a sequence of keys and a sequence of values:
2017-07-11T04:59:17.392678
Ruben
pythondev_help_Ruben_2017-07-11T04:59:17.392678
1,499,749,157.392678
84,662
pythondev
help
```ports = [21, 22, 80] services = ["ftp", "sftp", "http"] port_to_service = dict(zip(ports, services)) print port_to_service ```
2017-07-11T04:59:22.394436
Ruben
pythondev_help_Ruben_2017-07-11T04:59:22.394436
1,499,749,162.394436
84,663
pythondev
help
<@Ruben> thanks i got it :smile:
2017-07-11T06:02:59.850021
Reina
pythondev_help_Reina_2017-07-11T06:02:59.850021
1,499,752,979.850021
84,664
pythondev
help
I need help, I have ```while True:``` and I need to restart script for 2 hours How to do that ?
2017-07-11T07:44:26.751079
Tristan
pythondev_help_Tristan_2017-07-11T07:44:26.751079
1,499,759,066.751079
84,665
pythondev
help
crontab?
2017-07-11T07:52:35.904111
Meg
pythondev_help_Meg_2017-07-11T07:52:35.904111
1,499,759,555.904111
84,666
pythondev
help
no, this is python script witch provision some API request and I have ```while True: time.sleep(15)``` but I need to restart script every two hours because API security keys expires after two hours, and then I need to again generate that key
2017-07-11T07:58:03.010579
Tristan
pythondev_help_Tristan_2017-07-11T07:58:03.010579
1,499,759,883.010579
84,667
pythondev
help
ok
2017-07-11T07:59:48.046016
Meg
pythondev_help_Meg_2017-07-11T07:59:48.046016
1,499,759,988.046016
84,668
pythondev
help
then so have your script execute
2017-07-11T07:59:53.047870
Meg
pythondev_help_Meg_2017-07-11T07:59:53.047870
1,499,759,993.04787
84,669
pythondev
help
and then use crontab to execute it from the OS every two hours
2017-07-11T08:00:04.051741
Meg
pythondev_help_Meg_2017-07-11T08:00:04.051741
1,499,760,004.051741
84,670
pythondev
help
that would be the easiest way to do it
2017-07-11T08:00:22.058817
Meg
pythondev_help_Meg_2017-07-11T08:00:22.058817
1,499,760,022.058817
84,671
pythondev
help
yes, script is execute but I wish to restart itself scipt if posible :slightly_smiling_face:
2017-07-11T08:03:55.131864
Tristan
pythondev_help_Tristan_2017-07-11T08:03:55.131864
1,499,760,235.131864
84,672
pythondev
help
????
2017-07-11T08:07:50.213467
Meg
pythondev_help_Meg_2017-07-11T08:07:50.213467
1,499,760,470.213467
84,673
pythondev
help
``` from threading import Timer def get_new_api_keys(): # do some thing t = Timer(20 * 60, get_new_api_keys) t.start() ```
2017-07-11T08:08:14.221558
Carri
pythondev_help_Carri_2017-07-11T08:08:14.221558
1,499,760,494.221558
84,674
pythondev
help
you could set a timer for example to refresh your API keys
2017-07-11T08:08:35.229443
Carri
pythondev_help_Carri_2017-07-11T08:08:35.229443
1,499,760,515.229443
84,675
pythondev
help
You’re better off using `crontab` over keeping script running. Better chances of it running successfully because a long-running process can die for a lot of reasons
2017-07-11T08:09:31.249459
Patty
pythondev_help_Patty_2017-07-11T08:09:31.249459
1,499,760,571.249459
84,676
pythondev
help
or a slightly more complete example for a recurring timer <https://stackoverflow.com/a/24488061/69893>
2017-07-11T08:09:50.256181
Carri
pythondev_help_Carri_2017-07-11T08:09:50.256181
1,499,760,590.256181
84,677
pythondev
help
if you really want to get complex, you can write a daemon
2017-07-11T08:10:03.260541
Meg
pythondev_help_Meg_2017-07-11T08:10:03.260541
1,499,760,603.260541
84,678
pythondev
help
and hook into systemd or something to run
2017-07-11T08:10:13.264192
Meg
pythondev_help_Meg_2017-07-11T08:10:13.264192
1,499,760,613.264192
84,679
pythondev
help
other options could be using signals, and trapping `SIGHUP`, and using a cronjob to send a `kill -HUP $(pgrep APPNAME)`
2017-07-11T08:11:12.284711
Carri
pythondev_help_Carri_2017-07-11T08:11:12.284711
1,499,760,672.284711
84,680
pythondev
help
and have your signal handle in your python app to refresh API keys on receiving a HUP
2017-07-11T08:11:40.294252
Carri
pythondev_help_Carri_2017-07-11T08:11:40.294252
1,499,760,700.294252
84,681
pythondev
help
at that point may as well just run the script with cron itself ¯\_(ツ)_/¯
2017-07-11T08:12:20.308101
Patty
pythondev_help_Patty_2017-07-11T08:12:20.308101
1,499,760,740.308101
84,682
pythondev
help
cron isn't going to kill your script if it runs perpetually, it'll just spawn another instance
2017-07-11T08:13:16.328252
Carri
pythondev_help_Carri_2017-07-11T08:13:16.328252
1,499,760,796.328252
84,683
pythondev
help
Ah, sorry should have added that if you run it with cron to kill using `Timer`
2017-07-11T08:13:36.335389
Patty
pythondev_help_Patty_2017-07-11T08:13:36.335389
1,499,760,816.335389
84,684
pythondev
help
But what if he wants to run it on Windows? Task Scheduler?
2017-07-11T08:14:23.352084
Ruben
pythondev_help_Ruben_2017-07-11T08:14:23.352084
1,499,760,863.352084
84,685
pythondev
help
No, linux
2017-07-11T08:14:30.354442
Tristan
pythondev_help_Tristan_2017-07-11T08:14:30.354442
1,499,760,870.354442
84,686
pythondev
help
I put my script in cron for test, but I think cron don’t close old script ?
2017-07-11T08:14:54.363099
Tristan
pythondev_help_Tristan_2017-07-11T08:14:54.363099
1,499,760,894.363099
84,687
pythondev
help
Your script should terminate when it is done. If you make it loop forever, you have a problem.
2017-07-11T08:15:21.372601
Ruben
pythondev_help_Ruben_2017-07-11T08:15:21.372601
1,499,760,921.372601
84,688
pythondev
help
yes, loop forever, because export some data for monitoring over API
2017-07-11T08:15:52.383718
Tristan
pythondev_help_Tristan_2017-07-11T08:15:52.383718
1,499,760,952.383718
84,689
pythondev
help
Maybe it's better to use the Timer-based solutions suggested above, and use `supervisord` to make sure the script always runs (and is restarted if it ends for whatever reason). In that case you don't have to use a cron job.
2017-07-11T08:17:36.420591
Ruben
pythondev_help_Ruben_2017-07-11T08:17:36.420591
1,499,761,056.420591
84,690
pythondev
help
Also, do the API keys expire on certain fixed times, or exactly two hours after they have been generated?
2017-07-11T08:18:15.434653
Ruben
pythondev_help_Ruben_2017-07-11T08:18:15.434653
1,499,761,095.434653
84,691
pythondev
help
API expires after 2 hours of starting script
2017-07-11T08:18:47.446095
Tristan
pythondev_help_Tristan_2017-07-11T08:18:47.446095
1,499,761,127.446095
84,692
pythondev
help
How does the API provider know when you start your script? Does the script ask for keys when it starts for the first time?
2017-07-11T08:19:49.468415
Ruben
pythondev_help_Ruben_2017-07-11T08:19:49.468415
1,499,761,189.468415
84,693
pythondev
help
Yes, script do first get request and then give some code which I use in params when doing new request to API. After 2 hours this code expires and my export of data stop.
2017-07-11T08:21:19.501216
Tristan
pythondev_help_Tristan_2017-07-11T08:21:19.501216
1,499,761,279.501216
84,694
pythondev
help
are you continually hitting an API and just need the re-register of the API key to run every 2 hours?
2017-07-11T08:25:43.600091
Patty
pythondev_help_Patty_2017-07-11T08:25:43.600091
1,499,761,543.600091
84,695
pythondev
help
Yes, but I have while loop forever !
2017-07-11T08:32:01.745084
Tristan
pythondev_help_Tristan_2017-07-11T08:32:01.745084
1,499,761,921.745084
84,696
pythondev
help
<@Tristan> but between getting the new API keys you are running other requests, correct? Also, what site is this? There may be a way to get longer API keys
2017-07-11T10:04:44.624343
Patty
pythondev_help_Patty_2017-07-11T10:04:44.624343
1,499,767,484.624343
84,697
pythondev
help
Joe, I get this code from api and then I request one api every 15 seconds in ```while True: ``` loop and parsing response. After 2 hours code expires and my loop don’t have response. This is proxmox KVM virtualization.
2017-07-11T10:07:41.734959
Tristan
pythondev_help_Tristan_2017-07-11T10:07:41.734959
1,499,767,661.734959
84,698
pythondev
help
ah okay, yeah then the previous mentions of daemonizing the process is probably your best bet
2017-07-11T10:09:28.801213
Patty
pythondev_help_Patty_2017-07-11T10:09:28.801213
1,499,767,768.801213
84,699
pythondev
help
Hey, versioning and giving my commits build numbers is something I've neglected for a while. How should I go about it? I'm using Mercurial + Kiln currently, and I know there is a tag system which can help out with that but I'm just not sure where to begin. Isn't the best practice to have something like `&lt;major&gt;.&lt;minor&gt;.&lt;hotfix&gt;.&lt;build&gt;`? Also, is there a way to make this automatically generated?
2017-07-11T10:44:42.173773
Tami
pythondev_help_Tami_2017-07-11T10:44:42.173773
1,499,769,882.173773
84,700
pythondev
help
I prefer to make my versioning explicit... at least the major/minor/hotfix slots. It's not usually practical for an automated system to know whether a given change is API-breaking or not, after all
2017-07-11T10:47:00.263918
Gabriele
pythondev_help_Gabriele_2017-07-11T10:47:00.263918
1,499,770,020.263918
84,701
pythondev
help
It really depends on what you're making. If it's a web app or API, then build numbers should be fine. However for a library you do want explicit versioning. Some ci solutions allow you to have a manual intervention point
2017-07-11T10:52:31.484783
Beula
pythondev_help_Beula_2017-07-11T10:52:31.484783
1,499,770,351.484783
84,702