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
okk
2019-04-04T06:04:13.393600
Sharee
pythondev_help_Sharee_2019-04-04T06:04:13.393600
1,554,357,853.3936
16,921
pythondev
help
what if we say globally ?
2019-04-04T06:04:21.394100
Sharee
pythondev_help_Sharee_2019-04-04T06:04:21.394100
1,554,357,861.3941
16,922
pythondev
help
After you get the grasp of it and also along the way, it'd be easier for you to understand the concepts of Data Science
2019-04-04T06:04:46.394500
Virgil
pythondev_help_Virgil_2019-04-04T06:04:46.394500
1,554,357,886.3945
16,923
pythondev
help
As per my understanding of Data Science, it is more of an analytical branch. Whereas ML is dependant on your Programming and Algorithm skill, if you look at it from Top Down approach. In case of Bottom Up approach, you need to be good with Maths.
2019-04-04T06:07:10.397300
Virgil
pythondev_help_Virgil_2019-04-04T06:07:10.397300
1,554,358,030.3973
16,924
pythondev
help
can anyone explain how does cumsum() be used in pandas.Dataframe.groupby()
2019-04-04T06:11:31.398400
Malika
pythondev_help_Malika_2019-04-04T06:11:31.398400
1,554,358,291.3984
16,925
pythondev
help
<#C07EFMZ1N|help>
2019-04-04T06:11:37.398600
Malika
pythondev_help_Malika_2019-04-04T06:11:37.398600
1,554,358,297.3986
16,926
pythondev
help
thanks asif bhai
2019-04-04T06:12:35.399100
Sharee
pythondev_help_Sharee_2019-04-04T06:12:35.399100
1,554,358,355.3991
16,927
pythondev
help
and also can dates from one column be compared with dates from other column when both are put in a tuple inside two totally different column. PS: All part of same dataframe
2019-04-04T06:14:01.400400
Malika
pythondev_help_Malika_2019-04-04T06:14:01.400400
1,554,358,441.4004
16,928
pythondev
help
<#C07EFMZ1N|help>
2019-04-04T06:14:05.400600
Malika
pythondev_help_Malika_2019-04-04T06:14:05.400600
1,554,358,445.4006
16,929
pythondev
help
Anytime brother
2019-04-04T06:17:45.400800
Virgil
pythondev_help_Virgil_2019-04-04T06:17:45.400800
1,554,358,665.4008
16,930
pythondev
help
I'd probably do something with a queue for this. The node server can put items into a queue, a Python worker can pick it up, process it, and return the results through the queue mechanism.
2019-04-04T06:18:06.401000
Melynda
pythondev_help_Melynda_2019-04-04T06:18:06.401000
1,554,358,686.401
16,931
pythondev
help
Celery is a very popular toolset for Python to talk to a multitude of queue back-ends (RabbitMQ, Redis, Beanstalk, etc, etc)
2019-04-04T06:20:18.401200
Melynda
pythondev_help_Melynda_2019-04-04T06:20:18.401200
1,554,358,818.4012
16,932
pythondev
help
<http://www.celeryproject.org/>
2019-04-04T06:20:27.401400
Melynda
pythondev_help_Melynda_2019-04-04T06:20:27.401400
1,554,358,827.4014
16,933
pythondev
help
hm but what would you put into the queue? it would still be python reading the model and giving output values right?
2019-04-04T06:47:15.401600
Dawn
pythondev_help_Dawn_2019-04-04T06:47:15.401600
1,554,360,435.4016
16,934
pythondev
help
I have four py scripts I want to initialise from another py script. Would `init.py` run `script.py` if I do like this? script.py ``` def foo(): print('poo') if __name__ == "__main__": foo()``` init.py ``` from . import script script.main()```
2019-04-04T07:02:47.405000
Conchita
pythondev_help_Conchita_2019-04-04T07:02:47.405000
1,554,361,367.405
16,935
pythondev
help
<@Conchita> there's no method called main() you'll have to do script.foo()
2019-04-04T07:06:35.407300
Virgil
pythondev_help_Virgil_2019-04-04T07:06:35.407300
1,554,361,595.4073
16,936
pythondev
help
Try it and see :slightly_smiling_face: But if you don't want/can't - no, it won't run saying `script` has no such function `main`, or something like that. To run them from your `init` call `script.foo()`, i.e. you need to call existing function
2019-04-04T07:07:05.408300
Russ
pythondev_help_Russ_2019-04-04T07:07:05.408300
1,554,361,625.4083
16,937
pythondev
help
If you want to run all the function through a single function, just do this ``` def main(): script.foo() script.bar() script.whatever() ``` And then do ```script.main()```
2019-04-04T07:07:37.408900
Virgil
pythondev_help_Virgil_2019-04-04T07:07:37.408900
1,554,361,657.4089
16,938
pythondev
help
Great thanks! <@Virgil> &amp; <@Russ>
2019-04-04T07:09:08.409600
Conchita
pythondev_help_Conchita_2019-04-04T07:09:08.409600
1,554,361,748.4096
16,939
pythondev
help
Yeah – just put any required input values in the queue. Say if your ML models were doing image recognition, put the path to the image in the queue. Python opens that, gives it the model, processes it…
2019-04-04T07:17:47.410100
Melynda
pythondev_help_Melynda_2019-04-04T07:17:47.410100
1,554,362,267.4101
16,940
pythondev
help
ok yeah but then you still have a python server running somewhere
2019-04-04T07:18:11.410300
Dawn
pythondev_help_Dawn_2019-04-04T07:18:11.410300
1,554,362,291.4103
16,941
pythondev
help
what i mean is, produce your model locally and save it (in a pickle for instance) in a repository, and have a node.js server handle that saved model. no model training done on the server
2019-04-04T07:19:11.410500
Dawn
pythondev_help_Dawn_2019-04-04T07:19:11.410500
1,554,362,351.4105
16,942
pythondev
help
I wouldn't expect Node to understand a pickled object at all. If there are open standards that both Node and Python can agree on, I don't see why Node couldn't process a file from Python. TensorFlow, for example…?
2019-04-04T07:22:05.410700
Melynda
pythondev_help_Melynda_2019-04-04T07:22:05.410700
1,554,362,525.4107
16,943
pythondev
help
<@Rodrick> A few points: 1) Pinging someone to answer your question if you're not replying to one of their comments is considered rude. Just ask your question and anyone who can help will jump in. 2) You didn't ask a question. The only thing I've seen is you posting that you wanted to make something. If you have a specific question, you need to ask it clearly, not assume we know what you're looking for.
2019-04-04T08:52:57.411300
Carmen
pythondev_help_Carmen_2019-04-04T08:52:57.411300
1,554,367,977.4113
16,944
pythondev
help
The most important question is: Which protocol does your Identity Provider support? If it only supports one of them, then you've pretty much already got your choice made for you. If it can support both, pick the one that has an easier library to work with for your app.
2019-04-04T08:59:00.411500
Carmen
pythondev_help_Carmen_2019-04-04T08:59:00.411500
1,554,368,340.4115
16,945
pythondev
help
<@Conchita> Adding a bit more information here, the `if __name__ == "__main__":` check will only be true if the file in question (`script.py` in this case) is being directly executed by Python instead of imported by another script. This SO answer covers it in depth: <https://stackoverflow.com/a/419185/>
2019-04-04T09:02:49.413300
Carmen
pythondev_help_Carmen_2019-04-04T09:02:49.413300
1,554,368,569.4133
16,946
pythondev
help
Alright I give up, I can't figure out this dang function
2019-04-04T09:31:39.413800
Freeda
pythondev_help_Freeda_2019-04-04T09:31:39.413800
1,554,370,299.4138
16,947
pythondev
help
I'm so bad at making these, any tips/good tutorials would be greatly appreciated
2019-04-04T09:32:00.414300
Freeda
pythondev_help_Freeda_2019-04-04T09:32:00.414300
1,554,370,320.4143
16,948
pythondev
help
<@Freeda> what are you trying to do, what have you tried, and what errors/failures are you seeing?
2019-04-04T09:33:46.415000
Clemmie
pythondev_help_Clemmie_2019-04-04T09:33:46.415000
1,554,370,426.415
16,949
pythondev
help
If you have some code to show please do
2019-04-04T09:33:57.415200
Clemmie
pythondev_help_Clemmie_2019-04-04T09:33:57.415200
1,554,370,437.4152
16,950
pythondev
help
I'm trying to apply this function to a dataframe; it's pretty easy to understand what I'm trying to do, I'm just missing something here
2019-04-04T09:52:57.416200
Freeda
pythondev_help_Freeda_2019-04-04T09:52:57.416200
1,554,371,577.4162
16,951
pythondev
help
These are the columns I'm looking at
2019-04-04T09:53:10.416300
Freeda
pythondev_help_Freeda_2019-04-04T09:53:10.416300
1,554,371,590.4163
16,952
pythondev
help
And this is the code I have so far
2019-04-04T09:53:30.416600
Freeda
pythondev_help_Freeda_2019-04-04T09:53:30.416600
1,554,371,610.4166
16,953
pythondev
help
and this is the error I'm getting
2019-04-04T09:54:06.416900
Freeda
pythondev_help_Freeda_2019-04-04T09:54:06.416900
1,554,371,646.4169
16,954
pythondev
help
If you have any tips on what I should focus on for learning, lmk. I feel like I need to work on building functions and types in python
2019-04-04T09:59:37.417700
Freeda
pythondev_help_Freeda_2019-04-04T09:59:37.417700
1,554,371,977.4177
16,955
pythondev
help
That actually looks pretty ok to me, besides the error. I don’t have a ton of experience with pandas - but I think that contains call works a little differently than you are using it (maybe). Maybe ask in the <#C0JB9ATQV|data_science> channel - there is lots of pandas expertise over there
2019-04-04T10:03:42.419600
Clemmie
pythondev_help_Clemmie_2019-04-04T10:03:42.419600
1,554,372,222.4196
16,956
pythondev
help
When I am writing the __init__ method for a class and I would like to use an intermediary value, is it safe to just use a normal variable like below? Will it be cleaned up properly and gone once the method completes? ``` class Thing(object): def __init__(self, input): intermediary = input + 1 self.value = intermediary + 1 ``` (ignoring the over simplicity and pointlessness of the example)
2019-04-04T10:14:45.423900
Cedrick
pythondev_help_Cedrick_2019-04-04T10:14:45.423900
1,554,372,885.4239
16,957
pythondev
help
I want to ensure that intermediary value is gone and not some class/static member
2019-04-04T10:15:54.424900
Cedrick
pythondev_help_Cedrick_2019-04-04T10:15:54.424900
1,554,372,954.4249
16,958
pythondev
help
You sure can, but it doesn’t look like the best way to go
2019-04-04T10:16:21.425600
Clemmie
pythondev_help_Clemmie_2019-04-04T10:16:21.425600
1,554,372,981.4256
16,959
pythondev
help
can you talk a little about why you want/need to do it?
2019-04-04T10:16:34.426000
Clemmie
pythondev_help_Clemmie_2019-04-04T10:16:34.426000
1,554,372,994.426
16,960
pythondev
help
well in my class I am consuming some xml and I'm using xpath to get a list of sub nodes (the intermediary) and then that list I pass to another function in a list comprehension. So the intermediary is there for readability, I could just be putting the xpath in the comprehension but that looks messy.
2019-04-04T10:18:22.427900
Cedrick
pythondev_help_Cedrick_2019-04-04T10:18:22.427900
1,554,373,102.4279
16,961
pythondev
help
``` class ColorChange(object): def __init__(self, xml): self.id = xml.attrib['id'] self.quantity = xml.attrib['quantity'] self.color_change_id = xml.attrib['color-change-id'] color_change_color_xml_list = xml.xpath('colors/color') self.colors = [ColorChangeColor(color_change_xml).__dict__ for color_change_xml in color_change_color_xml_list] ```
2019-04-04T10:19:04.428200
Cedrick
pythondev_help_Cedrick_2019-04-04T10:19:04.428200
1,554,373,144.4282
16,962
pythondev
help
this is unfortunately complicated by the api's xml schema that I am consuming
2019-04-04T10:19:58.429000
Cedrick
pythondev_help_Cedrick_2019-04-04T10:19:58.429000
1,554,373,198.429
16,963
pythondev
help
with that use case it looks just fine
2019-04-04T10:20:15.429400
Clemmie
pythondev_help_Clemmie_2019-04-04T10:20:15.429400
1,554,373,215.4294
16,964
pythondev
help
cool, thanks!
2019-04-04T10:20:25.429600
Cedrick
pythondev_help_Cedrick_2019-04-04T10:20:25.429600
1,554,373,225.4296
16,965
pythondev
help
I guess I am also curious about how people would feel about my use of __dict__ there ... these objects need to be json serializable so I am using that for now... although there is the possibility of needing to write a .to_dict() method later down the road in case I don't want to serialize everything in it like a method.
2019-04-04T10:24:40.432100
Cedrick
pythondev_help_Cedrick_2019-04-04T10:24:40.432100
1,554,373,480.4321
16,966
pythondev
help
So the resolution it asks already exists in the error
2019-04-04T10:51:09.433300
Marceline
pythondev_help_Marceline_2019-04-04T10:51:09.433300
1,554,375,069.4333
16,967
pythondev
help
is there a way to parse jsonL with the regular json pacakge in python?
2019-04-04T11:20:32.434100
Dawn
pythondev_help_Dawn_2019-04-04T11:20:32.434100
1,554,376,832.4341
16,968
pythondev
help
it's basically every json object on a new line i think
2019-04-04T11:20:51.434600
Dawn
pythondev_help_Dawn_2019-04-04T11:20:51.434600
1,554,376,851.4346
16,969
pythondev
help
I don’t think so, or at least not without munging first. A quick search found this package <https://github.com/wbolster/jsonlines>
2019-04-04T11:22:49.435200
Clemmie
pythondev_help_Clemmie_2019-04-04T11:22:49.435200
1,554,376,969.4352
16,970
pythondev
help
hm yeah wanted to prevent installing additional packages but i guess it's the only way to go
2019-04-04T11:23:47.435800
Dawn
pythondev_help_Dawn_2019-04-04T11:23:47.435800
1,554,377,027.4358
16,971
pythondev
help
annoying that people just don't adhere standards... :stuck_out_tongue:
2019-04-04T11:23:55.436100
Dawn
pythondev_help_Dawn_2019-04-04T11:23:55.436100
1,554,377,035.4361
16,972
pythondev
help
thanks anyways
2019-04-04T11:23:59.436300
Dawn
pythondev_help_Dawn_2019-04-04T11:23:59.436300
1,554,377,039.4363
16,973
pythondev
help
got it to work with the regular json package `[json.loads(jline) for jline in response.text.split('\n')]`
2019-04-04T11:49:06.436700
Dawn
pythondev_help_Dawn_2019-04-04T11:49:06.436700
1,554,378,546.4367
16,974
pythondev
help
oh, good thinking
2019-04-04T11:49:51.437100
Clemmie
pythondev_help_Clemmie_2019-04-04T11:49:51.437100
1,554,378,591.4371
16,975
pythondev
help
<@Clemmie> thanks for deferring me to <#C0JB9ATQV|data_science> , helped a lot
2019-04-04T11:59:29.437700
Freeda
pythondev_help_Freeda_2019-04-04T11:59:29.437700
1,554,379,169.4377
16,976
pythondev
help
ended up with this, actually on my own but they explained why I wasn't able to do it with pandas
2019-04-04T11:59:53.437900
Freeda
pythondev_help_Freeda_2019-04-04T11:59:53.437900
1,554,379,193.4379
16,977
pythondev
help
in pandas is there a way to append data to an existing csv file but save it as new file? I have df1, df2 and want to save it as df3
2019-04-04T13:03:49.439500
Christal
pythondev_help_Christal_2019-04-04T13:03:49.439500
1,554,383,029.4395
16,978
pythondev
help
Alright, I've tried this two ways and it's beginning to frustrate me. The problem is in this line: for i, val in enumerate(lists[1].get(0, tk.END)), my list has 1 item. When the enumeration begins at 0 and hits its max len which is 1 item (rather 0), it just kills the function rather than continue. I cannot find a way to say "if you've reached the end of the list and the item wasn't found, then add the item"
2019-04-04T13:04:22.439600
Nenita
pythondev_help_Nenita_2019-04-04T13:04:22.439600
1,554,383,062.4396
16,979
pythondev
help
<@Christal> just create a new line for df3.to_csv("new file name")
2019-04-04T13:08:28.440500
Nenita
pythondev_help_Nenita_2019-04-04T13:08:28.440500
1,554,383,308.4405
16,980
pythondev
help
if you havent already done df = df.append(df2) or whatever your looking to do
2019-04-04T13:08:55.441000
Nenita
pythondev_help_Nenita_2019-04-04T13:08:55.441000
1,554,383,335.441
16,981
pythondev
help
although i hate append because it always appends vertically rather than horizontally. i usually use:
2019-04-04T13:10:19.441600
Nenita
pythondev_help_Nenita_2019-04-04T13:10:19.441600
1,554,383,419.4416
16,982
pythondev
help
<@Nenita> if I understand it correctly you want to use the `for...else` construct. Whatever is in the `else` clause will fire if the loop completes without `break`ing
2019-04-04T13:13:07.443200
Clemmie
pythondev_help_Clemmie_2019-04-04T13:13:07.443200
1,554,383,587.4432
16,983
pythondev
help
correct. i just need to do something when it finishes the iterration
2019-04-04T13:13:45.443600
Nenita
pythondev_help_Nenita_2019-04-04T13:13:45.443600
1,554,383,625.4436
16,984
pythondev
help
other than just ending
2019-04-04T13:13:54.443900
Nenita
pythondev_help_Nenita_2019-04-04T13:13:54.443900
1,554,383,634.4439
16,985
pythondev
help
on the last element, regardless of whether it encountered a `break` or not?
2019-04-04T13:14:19.444800
Clemmie
pythondev_help_Clemmie_2019-04-04T13:14:19.444800
1,554,383,659.4448
16,986
pythondev
help
ill need the break at the last as long as its after if check == val
2019-04-04T13:15:27.445300
Nenita
pythondev_help_Nenita_2019-04-04T13:15:27.445300
1,554,383,727.4453
16,987
pythondev
help
this works but even after break it still fires which i dont need it to
2019-04-04T13:16:07.445400
Nenita
pythondev_help_Nenita_2019-04-04T13:16:07.445400
1,554,383,767.4454
16,988
pythondev
help
right - use that but add an `else`
2019-04-04T13:16:26.445900
Clemmie
pythondev_help_Clemmie_2019-04-04T13:16:26.445900
1,554,383,786.4459
16,989
pythondev
help
None
2019-04-04T13:16:42.446000
Clemmie
pythondev_help_Clemmie_2019-04-04T13:16:42.446000
1,554,383,802.446
16,990
pythondev
help
wait! you can use for with else?
2019-04-04T13:16:54.446700
Nenita
pythondev_help_Nenita_2019-04-04T13:16:54.446700
1,554,383,814.4467
16,991
pythondev
help
that will run the final line if and only if the for loop completed without ever encountering a `break`
2019-04-04T13:17:03.446900
Clemmie
pythondev_help_Clemmie_2019-04-04T13:17:03.446900
1,554,383,823.4469
16,992
pythondev
help
holy i never knew you could use else with for. that helps so much
2019-04-04T13:18:09.448200
Nenita
pythondev_help_Nenita_2019-04-04T13:18:09.448200
1,554,383,889.4482
16,993
pythondev
help
it is esoteric, and you are probably better off figuring out a more understandable way of doing it (it will confuse many pythonistas, even fairly senior) but it is the stated behavior of the construct
2019-04-04T13:18:11.448400
Clemmie
pythondev_help_Clemmie_2019-04-04T13:18:11.448400
1,554,383,891.4484
16,994
pythondev
help
with as much work as i am having to do along with learning at the same time, i usually create working code then go back to clean it up and then optimize it.
2019-04-04T13:18:52.449100
Nenita
pythondev_help_Nenita_2019-04-04T13:18:52.449100
1,554,383,932.4491
16,995
pythondev
help
Hi everyone! Is there a way to test if my solution is using imported methods which have been deprecated? Just so that I can just pip install the target versions of my dependencies and fix everything that needs updating. I've only noted deprecation warning when such methods are actually called, and I fear that some of them might not be used that often (and usually when I write unit tests for my solution I mock third party library .. maybe THIS is the problem, in which case I'd rush immediately to the testing_ channel)
2019-04-04T13:37:57.449400
Alline
pythondev_help_Alline_2019-04-04T13:37:57.449400
1,554,385,077.4494
16,996
pythondev
help
<@Alline> from what i've been reading online, deprecation warnings have to be declared therefore, if the methods don't contain a deprecation warning, i would check out this. it looks like you may be able to set it up for testing, but not sure if it's what you're looking for. other than that, i thankfully haven't received much deprecation warnings so i don't focus on it much, more over, have much knowledge on handing deprecation. <https://pypi.org/project/deprecation/>
2019-04-04T13:47:45.451800
Nenita
pythondev_help_Nenita_2019-04-04T13:47:45.451800
1,554,385,665.4518
16,997
pythondev
help
Hello everyone, can someone tell me a good library to mock an external web application for testing? Given that I’m learning, I need read some documentation about it. Thanks in advance!
2019-04-04T14:49:18.455200
Deirdre
pythondev_help_Deirdre_2019-04-04T14:49:18.455200
1,554,389,358.4552
16,998
pythondev
help
How are you accessing the real web app? REST API? Basic request-response with HTML scraping? Custom protocol over TCP?
2019-04-04T15:08:23.456200
Carmen
pythondev_help_Carmen_2019-04-04T15:08:23.456200
1,554,390,503.4562
16,999
pythondev
help
Yes to: REST API, Basic request-response wit HTML scraping and TCP
2019-04-04T15:15:32.456500
Deirdre
pythondev_help_Deirdre_2019-04-04T15:15:32.456500
1,554,390,932.4565
17,000
pythondev
help
I just need to hit the mock endpoint to avoid charging the real API for testing purposes
2019-04-04T15:16:04.456700
Deirdre
pythondev_help_Deirdre_2019-04-04T15:16:04.456700
1,554,390,964.4567
17,001
pythondev
help
In the past I've done this by setting up a small Flask app that accepts the appropriate requests and returns the desired response. If you have copies of what you're supposed to get back from the API, you can save those as text files and have the Flask app just return those as responses.
2019-04-04T15:20:16.457000
Carmen
pythondev_help_Carmen_2019-04-04T15:20:16.457000
1,554,391,216.457
17,002
pythondev
help
It’s allmost the helloworld Flask app, but changing the string ‘hello world’?
2019-04-04T15:35:40.457200
Deirdre
pythondev_help_Deirdre_2019-04-04T15:35:40.457200
1,554,392,140.4572
17,003
pythondev
help
Pretty much. Just have that method read from your saved response file, and return the contents.
2019-04-04T16:05:24.457400
Carmen
pythondev_help_Carmen_2019-04-04T16:05:24.457400
1,554,393,924.4574
17,004
pythondev
help
does anyone have any tips for communicating to mysql via aws lambda with python?
2019-04-04T16:32:25.457900
Holly
pythondev_help_Holly_2019-04-04T16:32:25.457900
1,554,395,545.4579
17,005
pythondev
help
I think one way would be that when you create your lambda function, in environment variables provide credentials, and then call them in your scripts like this ```usr = os.environ['usr'] pwd= os.environ['pwd'] path = os.environ['path']``` and then use sqlalchemy or any library to create connection.
2019-04-04T16:43:12.458000
Raguel
pythondev_help_Raguel_2019-04-04T16:43:12.458000
1,554,396,192.458
17,006
pythondev
help
I am not sure if that is the best way to go about it!
2019-04-04T16:44:12.458200
Raguel
pythondev_help_Raguel_2019-04-04T16:44:12.458200
1,554,396,252.4582
17,007
pythondev
help
That's pretty much exactly how I'd do it, swapping SQLAlchemy for a different DB driver.
2019-04-04T18:50:17.459100
Carmen
pythondev_help_Carmen_2019-04-04T18:50:17.459100
1,554,403,817.4591
17,008
pythondev
help
hi guys, is there a way to "properly" monkey patch something? I am using the IEX cloud API to gather some stock data and using the `pyEX` package from here but I'd like to monkey patch it to change the _URL_PREFIX in the _getJsonIEXCloud() function of common.py
2019-04-04T20:32:40.460900
Frankie
pythondev_help_Frankie_2019-04-04T20:32:40.460900
1,554,409,960.4609
17,009
pythondev
help
Here's the package: <https://github.com/timkpaine/pyEX>
2019-04-04T20:32:53.461100
Frankie
pythondev_help_Frankie_2019-04-04T20:32:53.461100
1,554,409,973.4611
17,010
pythondev
help
basically I would like to monkey patch common.py like so
2019-04-04T20:37:20.461700
Frankie
pythondev_help_Frankie_2019-04-04T20:37:20.461700
1,554,410,240.4617
17,011
pythondev
help
actually now that I'm looking atit this would require patching every function across the whole package since they all call `_getJson(url, token, version)` (see `stocks.py` for example
2019-04-04T20:41:08.463700
Frankie
pythondev_help_Frankie_2019-04-04T20:41:08.463700
1,554,410,468.4637
17,012
pythondev
help
is there a better way? main reason I want to do this is that this will only call the real API in its current state, which wastes messages that cost money during development.
2019-04-04T20:42:47.464500
Frankie
pythondev_help_Frankie_2019-04-04T20:42:47.464500
1,554,410,567.4645
17,013
pythondev
help
Is it possible to only apply the patch when you start up with a "debug mode" setting, rather than trying to pass in a runtime sandbox flag for each call?
2019-04-04T20:46:39.465600
Sasha
pythondev_help_Sasha_2019-04-04T20:46:39.465600
1,554,410,799.4656
17,014
pythondev
help
sure, but I think the problem is still that the client doesn't actually control the call of the getJson() function
2019-04-04T20:55:29.466100
Frankie
pythondev_help_Frankie_2019-04-04T20:55:29.466100
1,554,411,329.4661
17,015
pythondev
help
I suppose I could just patch the _URL_PREFIX_2 variable in debug mode I guess?
2019-04-04T20:56:15.466600
Frankie
pythondev_help_Frankie_2019-04-04T20:56:15.466600
1,554,411,375.4666
17,016
pythondev
help
Good thought.
2019-04-04T20:57:34.467000
Sasha
pythondev_help_Sasha_2019-04-04T20:57:34.467000
1,554,411,454.467
17,017
pythondev
help
``` _URL_PREFIX2 = '<https://cloud.iexapis.com/{version}/>' if os.environ.get('DJANGO_ENV') == 'DEV': _URL_PREFIX2 = '<https://sandbox.iexapis.com/{version}/>' ``` Anything wrong w/ that? This happens to be in a django project so I will have that set
2019-04-04T20:58:10.467600
Frankie
pythondev_help_Frankie_2019-04-04T20:58:10.467600
1,554,411,490.4676
17,018
pythondev
help
Also is it possible to change that from outside the actual package file? like in my own code can I do something like ``` import pyEX pyEX.common._URL_PREFIX2 = 'blah blah blah' ```?
2019-04-04T20:59:51.468900
Frankie
pythondev_help_Frankie_2019-04-04T20:59:51.468900
1,554,411,591.4689
17,019
pythondev
help
Yep, that's both possible and recommended.
2019-04-04T21:00:17.469300
Sasha
pythondev_help_Sasha_2019-04-04T21:00:17.469300
1,554,411,617.4693
17,020