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
I'd suggest to do something like this ^
2018-02-27T11:39:59.000818
Aleida
pythondev_help_Aleida_2018-02-27T11:39:59.000818
1,519,731,599.000818
36,324
pythondev
help
You can implement a similar context manager that would log the error instead of just suppressing it
2018-02-27T11:40:38.000537
Aleida
pythondev_help_Aleida_2018-02-27T11:40:38.000537
1,519,731,638.000537
36,325
pythondev
help
<@Aleida> mmm now that does look less ugly
2018-02-27T11:49:35.000344
Kieth
pythondev_help_Kieth_2018-02-27T11:49:35.000344
1,519,732,175.000344
36,326
pythondev
help
doh.. but we’re stuck on python 2.7
2018-02-27T11:50:57.000086
Kieth
pythondev_help_Kieth_2018-02-27T11:50:57.000086
1,519,732,257.000086
36,327
pythondev
help
<https://pythondev.slack.com/archives/C07EFN21K/p1519750215000653?thread_ts=1519749974.000667&amp;cid=C07EFN21K>
2018-02-27T11:50:58.000353
Ariane
pythondev_help_Ariane_2018-02-27T11:50:58.000353
1,519,732,258.000353
36,328
pythondev
help
:{
2018-02-27T11:50:58.000728
Kieth
pythondev_help_Kieth_2018-02-27T11:50:58.000728
1,519,732,258.000728
36,329
pythondev
help
yeah
2018-02-27T11:51:05.000249
Adell
pythondev_help_Adell_2018-02-27T11:51:05.000249
1,519,732,265.000249
36,330
pythondev
help
Can you be more specific about what you dont get? What would you like help with?
2018-02-27T11:51:22.000056
Ariane
pythondev_help_Ariane_2018-02-27T11:51:22.000056
1,519,732,282.000056
36,331
pythondev
help
<@Adell>
2018-02-27T11:51:26.000238
Ariane
pythondev_help_Ariane_2018-02-27T11:51:26.000238
1,519,732,286.000238
36,332
pythondev
help
although that’s only a problem if we want to extend `contextlib.suppress`
2018-02-27T11:51:57.000533
Kieth
pythondev_help_Kieth_2018-02-27T11:51:57.000533
1,519,732,317.000533
36,333
pythondev
help
if it’s not insane to reimplement it, that syntax does not suck
2018-02-27T11:52:07.000293
Kieth
pythondev_help_Kieth_2018-02-27T11:52:07.000293
1,519,732,327.000293
36,334
pythondev
help
class properties
2018-02-27T11:53:20.000067
Adell
pythondev_help_Adell_2018-02-27T11:53:20.000067
1,519,732,400.000067
36,335
pythondev
help
:thinking_face:
2018-02-27T11:53:43.000782
Adell
pythondev_help_Adell_2018-02-27T11:53:43.000782
1,519,732,423.000782
36,336
pythondev
help
properties, as in `myclass.name`?
2018-02-27T11:53:52.000693
Ariane
pythondev_help_Ariane_2018-02-27T11:53:52.000693
1,519,732,432.000693
36,337
pythondev
help
``` joe = Person(name='joe') bob = Person(name='bob') joe.name == 'joe'` bob.name == 'bob'```
2018-02-27T11:54:47.000075
Ariane
pythondev_help_Ariane_2018-02-27T11:54:47.000075
1,519,732,487.000075
36,338
pythondev
help
what dont you get? What is confusing to you
2018-02-27T11:55:04.000507
Ariane
pythondev_help_Ariane_2018-02-27T11:55:04.000507
1,519,732,504.000507
36,339
pythondev
help
setter and getter methods , how to implement them
2018-02-27T11:56:33.000516
Adell
pythondev_help_Adell_2018-02-27T11:56:33.000516
1,519,732,593.000516
36,340
pythondev
help
<@Kieth> extending `contextlib.suppress` would be an overkill. It is easier to implement what you need from scratch, probably using `contextlib.contextmanager` decorator
2018-02-27T11:56:35.000295
Aleida
pythondev_help_Aleida_2018-02-27T11:56:35.000295
1,519,732,595.000295
36,341
pythondev
help
yeah that makes sense, and is the only option in 2.7 anyway
2018-02-27T11:56:57.000612
Kieth
pythondev_help_Kieth_2018-02-27T11:56:57.000612
1,519,732,617.000612
36,342
pythondev
help
it might still be a little awkward passing the logger object
2018-02-27T11:57:09.000582
Kieth
pythondev_help_Kieth_2018-02-27T11:57:09.000582
1,519,732,629.000582
36,343
pythondev
help
but at least that would be the only awkward bit
2018-02-27T11:57:15.000260
Kieth
pythondev_help_Kieth_2018-02-27T11:57:15.000260
1,519,732,635.00026
36,344
pythondev
help
good afternoon all
2018-02-27T12:05:14.000094
Shad
pythondev_help_Shad_2018-02-27T12:05:14.000094
1,519,733,114.000094
36,345
pythondev
help
Anyone have experience with the requests library? I would like to use the is_partial_data flag and it doesn't look like requests is capable of doing so in a POST method?
2018-02-27T12:05:55.000279
Shad
pythondev_help_Shad_2018-02-27T12:05:55.000279
1,519,733,155.000279
36,346
pythondev
help
what flag is that? can’t find it in the docs?
2018-02-27T12:08:28.000785
Floy
pythondev_help_Floy_2018-02-27T12:08:28.000785
1,519,733,308.000785
36,347
pythondev
help
Yeah I wasn't able to find it so far. I saw an older post that suggested I man up and forge my own header, but this is something I have to put in front of a customer to manage, who doesn't code...so maybe not the best idea.
2018-02-27T12:10:01.000116
Shad
pythondev_help_Shad_2018-02-27T12:10:01.000116
1,519,733,401.000116
36,348
pythondev
help
maybe its been removed?
2018-02-27T12:11:15.000382
Floy
pythondev_help_Floy_2018-02-27T12:11:15.000382
1,519,733,475.000382
36,349
pythondev
help
what’s your use case?
2018-02-27T12:11:26.000232
Floy
pythondev_help_Floy_2018-02-27T12:11:26.000232
1,519,733,486.000232
36,350
pythondev
help
(facepalm) I think that I am just "that guy" today. I appended the flag to the end of the URL and everything is smooth sailing
2018-02-27T12:11:44.000444
Shad
pythondev_help_Shad_2018-02-27T12:11:44.000444
1,519,733,504.000444
36,351
pythondev
help
I was about to ask if this was something API-specific as that flag doesn’t exist in requests
2018-02-27T12:12:05.000314
Brande
pythondev_help_Brande_2018-02-27T12:12:05.000314
1,519,733,525.000314
36,352
pythondev
help
Thanks all. Glad it was something so simple.
2018-02-27T12:12:59.000402
Shad
pythondev_help_Shad_2018-02-27T12:12:59.000402
1,519,733,579.000402
36,353
pythondev
help
cool. Great question
2018-02-27T12:13:45.000133
Ariane
pythondev_help_Ariane_2018-02-27T12:13:45.000133
1,519,733,625.000133
36,354
pythondev
help
just create a function for each, call them whatever, and annotate them with `@property` and `@{propname}.setter` an example is here: <http://blog.humrich.us/2015/moving-to-python#can-i-get-that>
2018-02-27T12:17:10.000310
Ariane
pythondev_help_Ariane_2018-02-27T12:17:10.000310
1,519,733,830.00031
36,355
pythondev
help
I'm parsing a ton of JSON into a giant string, can I set all of this in a variable? `"%s,id=%s,host=%s,cluster=cassandra,environment=prod percentage=%s %i" % (measure, id, host, cpu_whole, unix_nano_time)`
2018-02-27T12:50:31.000241
Lorrine
pythondev_help_Lorrine_2018-02-27T12:50:31.000241
1,519,735,831.000241
36,356
pythondev
help
I'm trying to pass all of that into a <http://requests.post|requests.post>
2018-02-27T12:51:00.000616
Lorrine
pythondev_help_Lorrine_2018-02-27T12:51:00.000616
1,519,735,860.000616
36,357
pythondev
help
are you planning on breaking each peice into it's own variable?
2018-02-27T12:59:31.000646
Elisha
pythondev_help_Elisha_2018-02-27T12:59:31.000646
1,519,736,371.000646
36,358
pythondev
help
or are you passing that whole thing as a single variable?
2018-02-27T12:59:42.000191
Elisha
pythondev_help_Elisha_2018-02-27T12:59:42.000191
1,519,736,382.000191
36,359
pythondev
help
So I parse a json file into a bunch of variables for the data I want, but I had to format them all into one giant line so I could pass the data to influxdb
2018-02-27T13:00:13.000409
Lorrine
pythondev_help_Lorrine_2018-02-27T13:00:13.000409
1,519,736,413.000409
36,360
pythondev
help
And I need to post it via <http://requests.post|requests.post>
2018-02-27T13:00:31.000770
Lorrine
pythondev_help_Lorrine_2018-02-27T13:00:31.000770
1,519,736,431.00077
36,361
pythondev
help
So I wasn't sure if I could set a single variable to be that entire line I quotes above, or if I have to use that as my data for requests
2018-02-27T13:01:16.000139
Lorrine
pythondev_help_Lorrine_2018-02-27T13:01:16.000139
1,519,736,476.000139
36,362
pythondev
help
Like so: `<http://requests.post|requests.post>('<http://server:8092/write>', data="%s,id=%s,host=%s,cluster=cassandra,environment=prod percentage=%s %i" % (measure, id, host, str(cpu_whole), unix_nano_time), timeout=5)`
2018-02-27T13:01:41.000186
Lorrine
pythondev_help_Lorrine_2018-02-27T13:01:41.000186
1,519,736,501.000186
36,363
pythondev
help
you could probably encode that string then send it along
2018-02-27T13:01:53.000726
Elisha
pythondev_help_Elisha_2018-02-27T13:01:53.000726
1,519,736,513.000726
36,364
pythondev
help
seems a bit gnarly though
2018-02-27T13:02:45.000120
Elisha
pythondev_help_Elisha_2018-02-27T13:02:45.000120
1,519,736,565.00012
36,365
pythondev
help
post probably html encodes anyway
2018-02-27T13:03:13.000345
Elisha
pythondev_help_Elisha_2018-02-27T13:03:13.000345
1,519,736,593.000345
36,366
pythondev
help
you could always just try and see what happens :wink:
2018-02-27T13:03:22.000373
Elisha
pythondev_help_Elisha_2018-02-27T13:03:22.000373
1,519,736,602.000373
36,367
pythondev
help
encodes to what?
2018-02-27T13:03:35.000758
Lorrine
pythondev_help_Lorrine_2018-02-27T13:03:35.000758
1,519,736,615.000758
36,368
pythondev
help
errr http not html
2018-02-27T13:03:56.000287
Elisha
pythondev_help_Elisha_2018-02-27T13:03:56.000287
1,519,736,636.000287
36,369
pythondev
help
or whatever
2018-02-27T13:04:04.000509
Elisha
pythondev_help_Elisha_2018-02-27T13:04:04.000509
1,519,736,644.000509
36,370
pythondev
help
&gt;encodes to what? the post method probably applies some encoding so that your special characters don't bork the http request
2018-02-27T13:04:46.000413
Elisha
pythondev_help_Elisha_2018-02-27T13:04:46.000413
1,519,736,686.000413
36,371
pythondev
help
i dunno that it is sufficient to keep that string in tact though
2018-02-27T13:05:02.000251
Elisha
pythondev_help_Elisha_2018-02-27T13:05:02.000251
1,519,736,702.000251
36,372
pythondev
help
Is there a way I can view how it's being posted?
2018-02-27T13:05:31.000769
Lorrine
pythondev_help_Lorrine_2018-02-27T13:05:31.000769
1,519,736,731.000769
36,373
pythondev
help
you could monitor what comes out on the other end
2018-02-27T13:05:49.000049
Elisha
pythondev_help_Elisha_2018-02-27T13:05:49.000049
1,519,736,749.000049
36,374
pythondev
help
you could get real tricky and capture the packet with wireshark
2018-02-27T13:06:07.000497
Elisha
pythondev_help_Elisha_2018-02-27T13:06:07.000497
1,519,736,767.000497
36,375
pythondev
help
if you cant access that endpoint though you could always post to some endpoint you can monitor
2018-02-27T13:06:41.000102
Elisha
pythondev_help_Elisha_2018-02-27T13:06:41.000102
1,519,736,801.000102
36,376
pythondev
help
I believe you can tap your <http://requests.post|requests.post> object for the status_code attribute.
2018-02-27T13:09:47.000164
Shad
pythondev_help_Shad_2018-02-27T13:09:47.000164
1,519,736,987.000164
36,377
pythondev
help
like so: ``` r = <http://request.post|request.post>("YourInfluxDBpost etc.") print(r.status_code) ``` assuming status is what you mean, when you ask if you can view how its posting.
2018-02-27T13:10:35.000278
Shad
pythondev_help_Shad_2018-02-27T13:10:35.000278
1,519,737,035.000278
36,378
pythondev
help
yeah
2018-02-27T13:12:43.000071
Lorrine
pythondev_help_Lorrine_2018-02-27T13:12:43.000071
1,519,737,163.000071
36,379
pythondev
help
problem is i dont think it makes it to print
2018-02-27T13:12:51.000104
Lorrine
pythondev_help_Lorrine_2018-02-27T13:12:51.000104
1,519,737,171.000104
36,380
pythondev
help
nvm it was error 111
2018-02-27T13:13:19.000430
Lorrine
pythondev_help_Lorrine_2018-02-27T13:13:19.000430
1,519,737,199.00043
36,381
pythondev
help
Anyone know why this returns `TypeError: the JSON object must be str, not 'bytes'` in python3 for data = json.loads(jsonFile.content) ``` url = <http://site.com|site.com> jsonFile = requests.get(url, auth=HTTPBasicAuth(username, password)) data = json.loads(jsonFile.content) ```
2018-02-27T16:24:29.000400
Lorrine
pythondev_help_Lorrine_2018-02-27T16:24:29.000400
1,519,748,669.0004
36,382
pythondev
help
`content` returns bytes
2018-02-27T16:25:28.000643
Micki
pythondev_help_Micki_2018-02-27T16:25:28.000643
1,519,748,728.000643
36,383
pythondev
help
If the response body is JSON you should be able to do `jsonFile.json()` to convert the JSON to the python equivalent.
2018-02-27T16:25:49.000144
Genevie
pythondev_help_Genevie_2018-02-27T16:25:49.000144
1,519,748,749.000144
36,384
pythondev
help
I believe (but not sure) you can do `jsonFile.json()` to get the deserialize json data
2018-02-27T16:25:57.000781
Micki
pythondev_help_Micki_2018-02-27T16:25:57.000781
1,519,748,757.000781
36,385
pythondev
help
that did work, thank you
2018-02-27T16:30:15.000088
Lorrine
pythondev_help_Lorrine_2018-02-27T16:30:15.000088
1,519,749,015.000088
36,386
pythondev
help
silly question. we are upgrading our underlying OS on saas or haas-like appliances from ancient Ubuntu Precise to ancient Ubuntu Trusty, and updated twistd 11.1.0 to 13.2.0. We had service startup scripts that were activating a virtualenv that has `flask` in it and then starting services with `twistd`. Now `twistd` ...
2018-02-27T17:29:29.000344
Kieth
pythondev_help_Kieth_2018-02-27T17:29:29.000344
1,519,752,569.000344
36,387
pythondev
help
When parsing json that has many of the same key names, how can I parse them apart? I want to set all of the cpu metrics into variables like `cpu_value = check['payload'][0]['values'][0]['value']` and `do disk_space_value` as another Example: ``` { "id": "123456789", "payload": [ { "metric": "cpuU...
2018-02-27T18:23:54.000387
Lorrine
pythondev_help_Lorrine_2018-02-27T18:23:54.000387
1,519,755,834.000387
36,388
pythondev
help
<@Lorrine> just a heads up, you can’t count on those metrics all being in the same order. JSON doesn’t maintain order
2018-02-27T18:26:23.000361
Brande
pythondev_help_Brande_2018-02-27T18:26:23.000361
1,519,755,983.000361
36,389
pythondev
help
Even if this JSON I am grabbing is an API?
2018-02-27T18:27:38.000242
Lorrine
pythondev_help_Lorrine_2018-02-27T18:27:38.000242
1,519,756,058.000242
36,390
pythondev
help
Oh it's python that doesnt keep the order?
2018-02-27T18:28:20.000456
Lorrine
pythondev_help_Lorrine_2018-02-27T18:28:20.000456
1,519,756,100.000456
36,391
pythondev
help
right, the JSON you get from the API will never be in a guaranteed order
2018-02-27T18:29:12.000395
Brande
pythondev_help_Brande_2018-02-27T18:29:12.000395
1,519,756,152.000395
36,392
pythondev
help
What would be a better option to parse those values into vars then? Do a search for them then parse?
2018-02-27T18:30:27.000012
Lorrine
pythondev_help_Lorrine_2018-02-27T18:30:27.000012
1,519,756,227.000012
36,393
pythondev
help
That's good to know about ordering though, thank you for that!
2018-02-27T18:31:25.000314
Lorrine
pythondev_help_Lorrine_2018-02-27T18:31:25.000314
1,519,756,285.000314
36,394
pythondev
help
think of a representation of the metrics you would like and load into it while looping through the `payload`
2018-02-27T18:31:31.000370
Brande
pythondev_help_Brande_2018-02-27T18:31:31.000370
1,519,756,291.00037
36,395
pythondev
help
So if I am loading them in, how can I differentiate between the example above `cpu` vs `disk` and assign the metrics under them?
2018-02-27T18:35:19.000098
Lorrine
pythondev_help_Lorrine_2018-02-27T18:35:19.000098
1,519,756,519.000098
36,396
pythondev
help
if metric == diskutilization then set vars type of thing?
2018-02-27T18:35:40.000273
Lorrine
pythondev_help_Lorrine_2018-02-27T18:35:40.000273
1,519,756,540.000273
36,397
pythondev
help
or make those the keys of your dictionary if that works for you
2018-02-27T18:37:12.000360
Brande
pythondev_help_Brande_2018-02-27T18:37:12.000360
1,519,756,632.00036
36,398
pythondev
help
Which gets you an output like this ```{ 'cpuUtilization': { 'metric': 'cpuUtilization', 'type': 'percentage', 'unit': '1', 'values': [ { 'time': '2018-02-27T23:16:26.000Z', 'value': '32.3607...
2018-02-27T18:41:19.000045
Brande
pythondev_help_Brande_2018-02-27T18:41:19.000045
1,519,756,879.000045
36,399
pythondev
help
Interesting. And from there I can pull those values out?
2018-02-27T18:52:03.000105
Lorrine
pythondev_help_Lorrine_2018-02-27T18:52:03.000105
1,519,757,523.000105
36,400
pythondev
help
Yep. If you run this and look at each `item` in the for loop you’ll see it’s each element of the `payload` JSON. You can pull out what you need and transform the data from there
2018-02-27T19:02:57.000159
Brande
pythondev_help_Brande_2018-02-27T19:02:57.000159
1,519,758,177.000159
36,401
pythondev
help
`id` is a built-in function. Probably don't want to use that
2018-02-27T19:35:35.000025
Garrett
pythondev_help_Garrett_2018-02-27T19:35:35.000025
1,519,760,135.000025
36,402
pythondev
help
to be pressie (TypeError: __init__() takes 1 positional argument but 6 were given) ok
2018-02-27T19:36:11.000220
Vinita
pythondev_help_Vinita_2018-02-27T19:36:11.000220
1,519,760,171.00022
36,403
pythondev
help
let me change
2018-02-27T19:36:18.000100
Vinita
pythondev_help_Vinita_2018-02-27T19:36:18.000100
1,519,760,178.0001
36,404
pythondev
help
You'll have to show more code before we can help debug a calling error
2018-02-27T19:36:54.000063
Garrett
pythondev_help_Garrett_2018-02-27T19:36:54.000063
1,519,760,214.000063
36,405
pythondev
help
what are you asking?
2018-02-27T19:39:32.000225
Kacie
pythondev_help_Kacie_2018-02-27T19:39:32.000225
1,519,760,372.000225
36,406
pythondev
help
also whats with your mangled DB_URL
2018-02-27T19:39:43.000041
Kacie
pythondev_help_Kacie_2018-02-27T19:39:43.000041
1,519,760,383.000041
36,407
pythondev
help
could just do ```localhost``` no?
2018-02-27T19:40:17.000228
Kacie
pythondev_help_Kacie_2018-02-27T19:40:17.000228
1,519,760,417.000228
36,408
pythondev
help
it's not problem it is working fine ,problem is (TypeError: __init__() takes 1 positional argument but 6 were given) with constructer
2018-02-27T19:41:06.000275
Vinita
pythondev_help_Vinita_2018-02-27T19:41:06.000275
1,519,760,466.000275
36,409
pythondev
help
What is throwing the TypeError? Can we see the entire traceback?
2018-02-27T19:41:32.000075
Garrett
pythondev_help_Garrett_2018-02-27T19:41:32.000075
1,519,760,492.000075
36,410
pythondev
help
its your
2018-02-27T19:42:13.000133
Kacie
pythondev_help_Kacie_2018-02-27T19:42:13.000133
1,519,760,533.000133
36,411
pythondev
help
model
2018-02-27T19:42:15.000172
Kacie
pythondev_help_Kacie_2018-02-27T19:42:15.000172
1,519,760,535.000172
36,412
pythondev
help
why are you trying to override the constructor for db.Model
2018-02-27T19:42:56.000093
Kacie
pythondev_help_Kacie_2018-02-27T19:42:56.000093
1,519,760,576.000093
36,413
pythondev
help
from the docs ``` Note how we never defined a __init__ method on the User class? That’s because SQLAlchemy adds an implicit constructor to all model classes which accepts keyword arguments for all its columns and relationships. If you decide to override the constructor for any reason, make sure to keep accepting **kwar...
2018-02-27T19:44:34.000020
Kacie
pythondev_help_Kacie_2018-02-27T19:44:34.000020
1,519,760,674.00002
36,414
pythondev
help
<http://flask-sqlalchemy.pocoo.org/2.3/quickstart/>
2018-02-27T19:44:39.000217
Kacie
pythondev_help_Kacie_2018-02-27T19:44:39.000217
1,519,760,679.000217
36,415
pythondev
help
so <@Vinita> unless you have good reasons you want to customize it do not
2018-02-27T19:45:17.000139
Kacie
pythondev_help_Kacie_2018-02-27T19:45:17.000139
1,519,760,717.000139
36,416
pythondev
help
thanks sir,i am new and following a tutorial
2018-02-27T19:47:21.000294
Vinita
pythondev_help_Vinita_2018-02-27T19:47:21.000294
1,519,760,841.000294
36,417
pythondev
help
so how can we add or delete in database ?
2018-02-27T19:47:52.000237
Vinita
pythondev_help_Vinita_2018-02-27T19:47:52.000237
1,519,760,872.000237
36,418
pythondev
help
great! im starting out with flask too :slightly_smiling_face:
2018-02-27T19:47:58.000256
Kacie
pythondev_help_Kacie_2018-02-27T19:47:58.000256
1,519,760,878.000256
36,419
pythondev
help
add or delete certain objects/things you just added or entire tables?
2018-02-27T19:48:18.000393
Kacie
pythondev_help_Kacie_2018-02-27T19:48:18.000393
1,519,760,898.000393
36,420
pythondev
help
``` &gt;&gt;&gt; db.session.add(admin) &gt;&gt;&gt; db.session.add(guest) &gt;&gt;&gt; db.session.commit() ```
2018-02-27T19:49:15.000024
Kacie
pythondev_help_Kacie_2018-02-27T19:49:15.000024
1,519,760,955.000024
36,421
pythondev
help
thats from the quickstart guide
2018-02-27T19:49:29.000167
Kacie
pythondev_help_Kacie_2018-02-27T19:49:29.000167
1,519,760,969.000167
36,422
pythondev
help
in that link
2018-02-27T19:49:37.000122
Kacie
pythondev_help_Kacie_2018-02-27T19:49:37.000122
1,519,760,977.000122
36,423