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 | ```
ips = (line.split(" ", 1)[0] for line in lines)
most_frequent_ip, count = collections.Counter(ips).most_common(1)[0]
``` | 2019-05-10T03:34:36.132400 | Guillermina | pythondev_help_Guillermina_2019-05-10T03:34:36.132400 | 1,557,459,276.1324 | 22,921 |
pythondev | help | is correct this one guys? ```{k: v for k, v in field_info.items() if k not in excluded_fields.keys()}``` | 2019-05-10T03:35:39.132800 | Eveline | pythondev_help_Eveline_2019-05-10T03:35:39.132800 | 1,557,459,339.1328 | 22,922 |
pythondev | help | i need a dict with k:v without elements in excluded keys | 2019-05-10T03:37:11.133700 | Eveline | pythondev_help_Eveline_2019-05-10T03:37:11.133700 | 1,557,459,431.1337 | 22,923 |
pythondev | help | yeah, that'll do. | 2019-05-10T03:37:32.134200 | Guillermina | pythondev_help_Guillermina_2019-05-10T03:37:32.134200 | 1,557,459,452.1342 | 22,924 |
pythondev | help | i thought also about a set dif, but I don't know how works | 2019-05-10T03:37:36.134400 | Eveline | pythondev_help_Eveline_2019-05-10T03:37:36.134400 | 1,557,459,456.1344 | 22,925 |
pythondev | help | fields = set(fields_info) - set(excluded_fields) | 2019-05-10T03:38:13.135100 | Eveline | pythondev_help_Eveline_2019-05-10T03:38:13.135100 | 1,557,459,493.1351 | 22,926 |
pythondev | help | I'd use the dict comprehesion, as it's much clearer what's going on...
btw. `k not in excluded_fields` will suffice... the `.keys()` is obsolete. | 2019-05-10T03:39:58.136500 | Guillermina | pythondev_help_Guillermina_2019-05-10T03:39:58.136500 | 1,557,459,598.1365 | 22,927 |
pythondev | help | ```>>> set(field_info.items()) - set(excluded_fields.items())
{('a', 1), ('c', 3), ('b', 2)}
``` | 2019-05-10T03:40:05.136800 | Eveline | pythondev_help_Eveline_2019-05-10T03:40:05.136800 | 1,557,459,605.1368 | 22,928 |
pythondev | help | then I need to convert dict of tuples in a dict | 2019-05-10T03:40:23.137200 | Eveline | pythondev_help_Eveline_2019-05-10T03:40:23.137200 | 1,557,459,623.1372 | 22,929 |
pythondev | help | its a set of tuples | 2019-05-10T03:40:36.137400 | Leida | pythondev_help_Leida_2019-05-10T03:40:36.137400 | 1,557,459,636.1374 | 22,930 |
pythondev | help | right, sorry | 2019-05-10T03:40:51.137600 | Eveline | pythondev_help_Eveline_2019-05-10T03:40:51.137600 | 1,557,459,651.1376 | 22,931 |
pythondev | help | ```>>> dict(set(field_info.items()) - set(excluded_fields.items()))
{'b': 2, 'c': 3, 'a': 1}
``` | 2019-05-10T03:41:24.138000 | Eveline | pythondev_help_Eveline_2019-05-10T03:41:24.138000 | 1,557,459,684.138 | 22,932 |
pythondev | help | what is the best? dict_comp or set diff? I prefer set diff | 2019-05-10T03:41:47.138600 | Eveline | pythondev_help_Eveline_2019-05-10T03:41:47.138600 | 1,557,459,707.1386 | 22,933 |
pythondev | help | for me the set is more readable, but i dont know the performance implications | 2019-05-10T03:43:25.139100 | Leida | pythondev_help_Leida_2019-05-10T03:43:25.139100 | 1,557,459,805.1391 | 22,934 |
pythondev | help | thanks! | 2019-05-10T03:46:44.139500 | Eveline | pythondev_help_Eveline_2019-05-10T03:46:44.139500 | 1,557,460,004.1395 | 22,935 |
pythondev | help | uhmm when I do `dict(set(self.fields_info.items()) - set(excluded_fields.items()))` I get {TypeError} Unashable type : 'dict' | 2019-05-10T03:53:23.140500 | Eveline | pythondev_help_Eveline_2019-05-10T03:53:23.140500 | 1,557,460,403.1405 | 22,936 |
pythondev | help | is the same as above | 2019-05-10T03:53:46.140700 | Eveline | pythondev_help_Eveline_2019-05-10T03:53:46.140700 | 1,557,460,426.1407 | 22,937 |
pythondev | help | one of the dict values is probably another dict... | 2019-05-10T03:56:08.141100 | Guillermina | pythondev_help_Guillermina_2019-05-10T03:56:08.141100 | 1,557,460,568.1411 | 22,938 |
pythondev | help | this is field_info: field_info = {'a': {'x': 1, 'y': 2}, 'b': {'x': 1, 'y': 2}, 'c': {'x': 1, 'y': 2}} | 2019-05-10T03:59:14.141700 | Eveline | pythondev_help_Eveline_2019-05-10T03:59:14.141700 | 1,557,460,754.1417 | 22,939 |
pythondev | help | excluded_fields = ['c'] | 2019-05-10T04:00:43.142800 | Eveline | pythondev_help_Eveline_2019-05-10T04:00:43.142800 | 1,557,460,843.1428 | 22,940 |
pythondev | help | so you're .items returns a tuple containing dicts... and dicts are unhashable, that's why set fails. | 2019-05-10T04:00:47.143000 | Guillermina | pythondev_help_Guillermina_2019-05-10T04:00:47.143000 | 1,557,460,847.143 | 22,941 |
pythondev | help | ok, then different problem. Create a dict of k, v of field_info that are not in excluded_fields | 2019-05-10T04:01:41.144500 | Eveline | pythondev_help_Eveline_2019-05-10T04:01:41.144500 | 1,557,460,901.1445 | 22,942 |
pythondev | help | excluded_fields is a list of keys | 2019-05-10T04:01:49.144800 | Eveline | pythondev_help_Eveline_2019-05-10T04:01:49.144800 | 1,557,460,909.1448 | 22,943 |
pythondev | help | at this point is better a dict comp | 2019-05-10T04:01:56.145100 | Eveline | pythondev_help_Eveline_2019-05-10T04:01:56.145100 | 1,557,460,916.1451 | 22,944 |
pythondev | help | use the dict comprehension from above`... | 2019-05-10T04:02:02.145300 | Guillermina | pythondev_help_Guillermina_2019-05-10T04:02:02.145300 | 1,557,460,922.1453 | 22,945 |
pythondev | help | just remove the `.keys()` - and it woll work for both lists/dicts as excluded_whatever | 2019-05-10T04:02:38.146100 | Guillermina | pythondev_help_Guillermina_2019-05-10T04:02:38.146100 | 1,557,460,958.1461 | 22,946 |
pythondev | help | ok, thanks! | 2019-05-10T04:03:01.146300 | Eveline | pythondev_help_Eveline_2019-05-10T04:03:01.146300 | 1,557,460,981.1463 | 22,947 |
pythondev | help | is there any machine learning/ data science channel? | 2019-05-10T04:18:27.147300 | Johnetta | pythondev_help_Johnetta_2019-05-10T04:18:27.147300 | 1,557,461,907.1473 | 22,948 |
pythondev | help | <#C0JB9ATQV|data_science> | 2019-05-10T04:18:55.147500 | Leida | pythondev_help_Leida_2019-05-10T04:18:55.147500 | 1,557,461,935.1475 | 22,949 |
pythondev | help | you can click on the word `Channels` and theres the list and a search function or type # and look through there | 2019-05-10T04:19:31.148200 | Leida | pythondev_help_Leida_2019-05-10T04:19:31.148200 | 1,557,461,971.1482 | 22,950 |
pythondev | help | This message was deleted. | 2019-05-10T04:38:09.148800 | Alejandrina | pythondev_help_Alejandrina_2019-05-10T04:38:09.148800 | 1,557,463,089.1488 | 22,951 |
pythondev | help | deleted, please post that in <#C080T8XT2|job_board> | 2019-05-10T04:58:05.149000 | Jimmy | pythondev_help_Jimmy_2019-05-10T04:58:05.149000 | 1,557,464,285.149 | 22,952 |
pythondev | help | Hello everyone. I have a bit of an implementation problem and I'd like your professional suggestion. I'm using FlaskSQLAlchemy for the management of the database object.
In my project, which you can think of as a SaaS, when you create a Company(sort of), this company has to subscribe by making payment to _my_ company. This subscription could be for a month, a quarter/half of a year, or it cover a whole year. When the company's subscription is active, all routes in _my_ company's API would be accessible but immediately the subscription expires, none of the routes become accessible. It sends you a *subscription ended* RESTful result.
Now, there's a model `Company` that has several columns, one of each is `subscriptions` which is *supposed* to hold all the subscriptions that a company has made including the expired subscriptions and the current active one.
```
class Company (db.Model):
__tablename__ = 'companies'
subscriptions = db.relationship('Subscription', backref='company', lazy='dynamic')
# followed by several other columns
class Subscription (db.Model):
# stuffs
```
Now my question is, how do you think I can implement the subscription 'model' such that when I add a `@active_subscription_on` decorator on a route, this decorator checks the current user's company's subscription to see if their subscription is active?
How can I implement the subscription system? | 2019-05-10T05:33:56.167200 | Tam | pythondev_help_Tam_2019-05-10T05:33:56.167200 | 1,557,466,436.1672 | 22,953 |
pythondev | help | Here's what I've thought of(although I haven't implemented it): when your company _clicks_ on buy subscription(to generate a key, think Windows OS serial key), for a month, I use `itsdangerous`'s `TimedJSONWebSignatureSerializer` to encode the duration of the subscription, then use `base64` on the result for something readable. That gives me the key to give to the company and when entered to extend their subscription days, I simply reverse the process to get the duration the subscription will cover. I can then add this period to the company's list of subscriptions.
Now, I don't really know how to make the decorator gain access to this information and be quick with it! | 2019-05-10T05:44:07.175200 | Tam | pythondev_help_Tam_2019-05-10T05:44:07.175200 | 1,557,467,047.1752 | 22,954 |
pythondev | help | Hi there, I have a similar setup where I check if a user’s role is permitted for a particular route. I have a custom `login_required()` function which is used as a decorator for each of my routes.
The function is:
```
def login_required(role="ANY"):
def wrapper(fn):
@wraps(fn)
def decorated_view(*args, **kwargs):
if not current_user.is_authenticated:
return current_app.login_manager.unauthorized()
if role not in [current_user.role, "ANY"]:
return current_app.login_manager.unauthorized()
return fn(*args, **kwargs)
return decorated_view
return wrapper
```
and it is used as a decorator like this:
```
@app.route('/admin')
@login_required('super_admin')
def admin_page():
return
```
I would suggest to make a similar decorator function that checks the subscription of the ‘current’ company - hope that helps | 2019-05-10T05:44:13.175300 | Bee | pythondev_help_Bee_2019-05-10T05:44:13.175300 | 1,557,467,053.1753 | 22,955 |
pythondev | help | I did something similar in one of the decoratos:
```
def permission_required(permission):
def wrap(function):
@wraps(function)
def decorated_function(*args, **kwargs):
if (not current_user) or (current_user.role <= permission):
response = jsonify({'status': 430, 'error': 'Permission denied',
'message': 'Unable to get required permission '
'for this request'})
response.status_code = 430
return function(*args, **kwargs)
return decorated_function
return wrap
(SUPER_USER, ADMINISTRATOR, BASIC_USER) = (0x4C, 0x4B, 0x4A)
https_url_for = partial(http_url_for, _scheme='https', _external=True)
def admin_required(function):
return permission_required(ADMINISTRATOR)(function)
``` | 2019-05-10T05:57:13.176200 | Tam | pythondev_help_Tam_2019-05-10T05:57:13.176200 | 1,557,467,833.1762 | 22,956 |
pythondev | help | hello, when I use `pcl` from the terminal directly (python) importing works well, but when I import it using the file .py it gives : `ModuleNotFoundError: No module named 'pcl'` what might be the error | 2019-05-10T08:16:26.178000 | Tanja | pythondev_help_Tanja_2019-05-10T08:16:26.178000 | 1,557,476,186.178 | 22,957 |
pythondev | help | you sure it's the same python? are you using virtualenv? | 2019-05-10T08:17:39.178700 | Guillermina | pythondev_help_Guillermina_2019-05-10T08:17:39.178700 | 1,557,476,259.1787 | 22,958 |
pythondev | help | no i'm not using virtualenv... yes I know it's probably bad not to use,, but I'm working fine till now with it without virtualenv | 2019-05-10T08:31:45.179700 | Tanja | pythondev_help_Tanja_2019-05-10T08:31:45.179700 | 1,557,477,105.1797 | 22,959 |
pythondev | help | that's not why I'm asking... in a virtualenv you'd have to install the module first...
so, you happen to have more than one python installed? | 2019-05-10T08:44:13.180800 | Guillermina | pythondev_help_Guillermina_2019-05-10T08:44:13.180800 | 1,557,477,853.1808 | 22,960 |
pythondev | help | Sorry how could I check.. Although mostly it's only one | 2019-05-10T08:47:18.181300 | Tanja | pythondev_help_Tanja_2019-05-10T08:47:18.181300 | 1,557,478,038.1813 | 22,961 |
pythondev | help | `python` vs `python3` | 2019-05-10T08:52:35.181800 | Hiroko | pythondev_help_Hiroko_2019-05-10T08:52:35.181800 | 1,557,478,355.1818 | 22,962 |
pythondev | help | `which python` vs `which python3` | 2019-05-10T08:52:45.182100 | Hiroko | pythondev_help_Hiroko_2019-05-10T08:52:45.182100 | 1,557,478,365.1821 | 22,963 |
pythondev | help | if both go to the same path, you have just one python installed. if not, you have two | 2019-05-10T08:53:04.182600 | Hiroko | pythondev_help_Hiroko_2019-05-10T08:53:04.182600 | 1,557,478,384.1826 | 22,964 |
pythondev | help | ``` which python
/home/roaa/anaconda3/bin/python``` | 2019-05-10T08:53:26.183200 | Tanja | pythondev_help_Tanja_2019-05-10T08:53:26.183200 | 1,557,478,406.1832 | 22,965 |
pythondev | help | ah, ok | 2019-05-10T08:53:37.183500 | Hiroko | pythondev_help_Hiroko_2019-05-10T08:53:37.183500 | 1,557,478,417.1835 | 22,966 |
pythondev | help | ``` which python3
/home/roaa/anaconda3/bin/python3
``` | 2019-05-10T08:53:38.183800 | Tanja | pythondev_help_Tanja_2019-05-10T08:53:38.183800 | 1,557,478,418.1838 | 22,967 |
pythondev | help | what do you get when you do `python --version`? | 2019-05-10T08:53:53.184200 | Hiroko | pythondev_help_Hiroko_2019-05-10T08:53:53.184200 | 1,557,478,433.1842 | 22,968 |
pythondev | help | `Python 3.6.7` | 2019-05-10T08:54:14.184400 | Tanja | pythondev_help_Tanja_2019-05-10T08:54:14.184400 | 1,557,478,454.1844 | 22,969 |
pythondev | help | looks like two separate pythons? | 2019-05-10T08:59:31.184700 | Mica | pythondev_help_Mica_2019-05-10T08:59:31.184700 | 1,557,478,771.1847 | 22,970 |
pythondev | help | that’s why I asked about `python --version` | 2019-05-10T09:02:00.185100 | Hiroko | pythondev_help_Hiroko_2019-05-10T09:02:00.185100 | 1,557,478,920.1851 | 22,971 |
pythondev | help | how did you install the module, <@Tanja>? | 2019-05-10T09:02:38.185500 | Hiroko | pythondev_help_Hiroko_2019-05-10T09:02:38.185500 | 1,557,478,958.1855 | 22,972 |
pythondev | help | building it from source, i forgot the site I used to, but the final result was two folders, pcl-trunk and pcl folder with little arrow on it(working on ubuntu) | 2019-05-10T09:08:00.186500 | Tanja | pythondev_help_Tanja_2019-05-10T09:08:00.186500 | 1,557,479,280.1865 | 22,973 |
pythondev | help | it was working previouly I didn't know what happend... days before pymesh wasn't working I make updates it worked again normally now pcl isn't working | 2019-05-10T09:08:53.187500 | Tanja | pythondev_help_Tanja_2019-05-10T09:08:53.187500 | 1,557,479,333.1875 | 22,974 |
pythondev | help | how do i get the location of where a python file is saved | 2019-05-10T09:38:51.188300 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:38:51.188300 | 1,557,481,131.1883 | 22,975 |
pythondev | help | like if my python file is saved at `C:/mydirectory/x/y/file.py` | 2019-05-10T09:39:52.189000 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:39:52.189000 | 1,557,481,192.189 | 22,976 |
pythondev | help | I want to get `C:/mydirectory/x/y/` | 2019-05-10T09:40:33.189600 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:40:33.189600 | 1,557,481,233.1896 | 22,977 |
pythondev | help | how would i do that | 2019-05-10T09:40:37.189800 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:40:37.189800 | 1,557,481,237.1898 | 22,978 |
pythondev | help | ? | 2019-05-10T09:40:40.190000 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:40:40.190000 | 1,557,481,240.19 | 22,979 |
pythondev | help | Thanks in advance | 2019-05-10T09:40:48.190300 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:40:48.190300 | 1,557,481,248.1903 | 22,980 |
pythondev | help | do you want to get that path from within the python file? | 2019-05-10T09:43:07.190700 | Claudine | pythondev_help_Claudine_2019-05-10T09:43:07.190700 | 1,557,481,387.1907 | 22,981 |
pythondev | help | i think you want the `sys` module | 2019-05-10T09:43:17.190900 | Claudine | pythondev_help_Claudine_2019-05-10T09:43:17.190900 | 1,557,481,397.1909 | 22,982 |
pythondev | help | `sys.path` or something | 2019-05-10T09:43:28.191200 | Claudine | pythondev_help_Claudine_2019-05-10T09:43:28.191200 | 1,557,481,408.1912 | 22,983 |
pythondev | help | you can try `os.path.realpath(__file__)` | 2019-05-10T09:43:34.191400 | Leida | pythondev_help_Leida_2019-05-10T09:43:34.191400 | 1,557,481,414.1914 | 22,984 |
pythondev | help | <https://docs.python.org/3.6/library/os.path.html> path related docs | 2019-05-10T09:43:43.191900 | Leida | pythondev_help_Leida_2019-05-10T09:43:43.191900 | 1,557,481,423.1919 | 22,985 |
pythondev | help | ahh yea `os.path` might be it | 2019-05-10T09:43:46.192100 | Claudine | pythondev_help_Claudine_2019-05-10T09:43:46.192100 | 1,557,481,426.1921 | 22,986 |
pythondev | help | i want to set the directory to a varable x | 2019-05-10T09:44:02.192400 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:44:02.192400 | 1,557,481,442.1924 | 22,987 |
pythondev | help | my varable isnt x but just for explanation | 2019-05-10T09:44:19.192900 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:44:19.192900 | 1,557,481,459.1929 | 22,988 |
pythondev | help | yea `os.path.realpath(__file__)` will return a string representing the path | 2019-05-10T09:44:39.193300 | Claudine | pythondev_help_Claudine_2019-05-10T09:44:39.193300 | 1,557,481,479.1933 | 22,989 |
pythondev | help | you can just assign it like
`path = os.path.realpath(__file__)` | 2019-05-10T09:44:48.193600 | Claudine | pythondev_help_Claudine_2019-05-10T09:44:48.193600 | 1,557,481,488.1936 | 22,990 |
pythondev | help | ok great thanks | 2019-05-10T09:49:16.194400 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:49:16.194400 | 1,557,481,756.1944 | 22,991 |
pythondev | help | ```
import pathlib
print(pathlib.Path(__file__).resolve().parent)
``` | 2019-05-10T09:50:18.194600 | Guillermina | pythondev_help_Guillermina_2019-05-10T09:50:18.194600 | 1,557,481,818.1946 | 22,992 |
pythondev | help | k thanks | 2019-05-10T09:50:29.194800 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:50:29.194800 | 1,557,481,829.1948 | 22,993 |
pythondev | help | how do i get it to return the path and not the `C:/folder/file.py` i want it to return `C:/folder` | 2019-05-10T09:57:46.196000 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:57:46.196000 | 1,557,482,266.196 | 22,994 |
pythondev | help | is that possible | 2019-05-10T09:57:53.196200 | Rodrick | pythondev_help_Rodrick_2019-05-10T09:57:53.196200 | 1,557,482,273.1962 | 22,995 |
pythondev | help | that's what I gave you... :wink:
```
import pathlib
file_path = pathlib.Path(__file__).resolve()
folder_path = file_path.parent
``` | 2019-05-10T10:04:30.197300 | Guillermina | pythondev_help_Guillermina_2019-05-10T10:04:30.197300 | 1,557,482,670.1973 | 22,996 |
pythondev | help | my bad dearly sorry i tried the other one | 2019-05-10T10:07:22.197600 | Rodrick | pythondev_help_Rodrick_2019-05-10T10:07:22.197600 | 1,557,482,842.1976 | 22,997 |
pythondev | help | Great it worked | 2019-05-10T10:08:11.197900 | Rodrick | pythondev_help_Rodrick_2019-05-10T10:08:11.197900 | 1,557,482,891.1979 | 22,998 |
pythondev | help | ```
Collecting botocore<1.13.0,>=1.12.145 (from boto3)
1 location(s) to search for versions of botocore:
* <https://pypi.org/simple/botocore/>
Getting page <https://pypi.org/simple/botocore/>
Looking up "<https://pypi.org/simple/botocore/>" in the cache
Request header has "max_age" as 0, cache bypassed
<https://pypi.org:443> "GET /simple/botocore/ HTTP/1.1" 304 0
```
install is stalling here, any ideas? | 2019-05-10T10:45:04.198500 | Darlene | pythondev_help_Darlene_2019-05-10T10:45:04.198500 | 1,557,485,104.1985 | 22,999 |
pythondev | help | how long have you let it sit? | 2019-05-10T10:46:19.198700 | Holly | pythondev_help_Holly_2019-05-10T10:46:19.198700 | 1,557,485,179.1987 | 23,000 |
pythondev | help | I've let the install without `-v` sit for like 5 mins | 2019-05-10T10:47:10.199300 | Darlene | pythondev_help_Darlene_2019-05-10T10:47:10.199300 | 1,557,485,230.1993 | 23,001 |
pythondev | help | currently ~2 | 2019-05-10T10:47:18.199500 | Darlene | pythondev_help_Darlene_2019-05-10T10:47:18.199500 | 1,557,485,238.1995 | 23,002 |
pythondev | help | going on 10 mins, stuck at the same spot | 2019-05-10T10:54:21.199900 | Darlene | pythondev_help_Darlene_2019-05-10T10:54:21.199900 | 1,557,485,661.1999 | 23,003 |
pythondev | help | hmmm, do you have this issue with any other pip installs? | 2019-05-10T11:00:26.201000 | Holly | pythondev_help_Holly_2019-05-10T11:00:26.201000 | 1,557,486,026.201 | 23,004 |
pythondev | help | i uninstalled and installed it again, and i think it is working fine now, just testing.. cause it didn't look like it downloaded the right packages | 2019-05-10T11:03:30.202000 | Darlene | pythondev_help_Darlene_2019-05-10T11:03:30.202000 | 1,557,486,210.202 | 23,005 |
pythondev | help | If in doubt just wipe out the venv and start again (which is completely different from “have you tried turning it off and on again” honest :slightly_smiling_face: ) | 2019-05-10T11:05:47.202600 | Kori | pythondev_help_Kori_2019-05-10T11:05:47.202600 | 1,557,486,347.2026 | 23,006 |
pythondev | help | lol | 2019-05-10T11:08:24.202800 | Holly | pythondev_help_Holly_2019-05-10T11:08:24.202800 | 1,557,486,504.2028 | 23,007 |
pythondev | help | I'm going to do just thank Martin, thanks | 2019-05-10T11:24:28.203700 | Darlene | pythondev_help_Darlene_2019-05-10T11:24:28.203700 | 1,557,487,468.2037 | 23,008 |
pythondev | help | hey just trying to under a certain concept ```from google.cloud import storage
bucket_name = 'test'
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blobs = bucket.list_blobs()
blobs = bucket.list_blobs()
print blob
result
<class 'google.api_core.page_iterator.HTTPIterator'>
vs
from google.cloud import storage
bucket_name = 'test'
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blobs = bucket.list_blobs()
blobs = bucket.list_blobs()
for blob in blobs:
print(blob.name)
result
print the contents of my bucket``` Is there a way stdout the results in to a list instead of a objects ? | 2019-05-10T11:38:15.207000 | Avis | pythondev_help_Avis_2019-05-10T11:38:15.207000 | 1,557,488,295.207 | 23,009 |
pythondev | help | you mean something like
```blob_output = [blob.name for blob in blobs]
print(blob_output)``` | 2019-05-10T11:41:07.208000 | Hiroko | pythondev_help_Hiroko_2019-05-10T11:41:07.208000 | 1,557,488,467.208 | 23,010 |
pythondev | help | yea but converting the object/class to a list | 2019-05-10T11:42:31.209400 | Avis | pythondev_help_Avis_2019-05-10T11:42:31.209400 | 1,557,488,551.2094 | 23,011 |
pythondev | help | how would you expect the object to be represented as a list? | 2019-05-10T11:43:06.210100 | Clemmie | pythondev_help_Clemmie_2019-05-10T11:43:06.210100 | 1,557,488,586.2101 | 23,012 |
pythondev | help | or should i learn to work with objects directly instead of finding the easy way out | 2019-05-10T11:43:27.210500 | Avis | pythondev_help_Avis_2019-05-10T11:43:27.210500 | 1,557,488,607.2105 | 23,013 |
pythondev | help | ^ | 2019-05-10T11:43:32.210700 | Clemmie | pythondev_help_Clemmie_2019-05-10T11:43:32.210700 | 1,557,488,612.2107 | 23,014 |
pythondev | help | asking to represent an object as a list is nonsensical | 2019-05-10T11:43:45.211000 | Clemmie | pythondev_help_Clemmie_2019-05-10T11:43:45.211000 | 1,557,488,625.211 | 23,015 |
pythondev | help | so I might have some concepts mixed up | 2019-05-10T11:44:43.211800 | Avis | pythondev_help_Avis_2019-05-10T11:44:43.211800 | 1,557,488,683.2118 | 23,016 |
pythondev | help | probably - an object (lets say class) is made up of function and attributes `x=2` etc. How would you expect that to show up as a list? | 2019-05-10T11:45:45.212900 | Clemmie | pythondev_help_Clemmie_2019-05-10T11:45:45.212900 | 1,557,488,745.2129 | 23,017 |
pythondev | help | Easy - you just need two lists! | 2019-05-10T11:49:51.213400 | Chester | pythondev_help_Chester_2019-05-10T11:49:51.213400 | 1,557,488,991.2134 | 23,018 |
pythondev | help | I am trying to understand that how backend of APIs are designed if I am using python. For example, /users will be mapped to one handler querying all users, but how is /users/123 is designed/parsed, or this one /users/123/projects?
```
All resources in REST are entities. They can be independent like:
GET /users - get all users
GET /users/123 - get a particular user with id = 123
GET /posts - get all posts
There are also dependent entities, that rely on their parent models:
GET /users/123/projects - get all the projects that a user with id = 123 has
``` | 2019-05-10T12:10:36.215400 | Raguel | pythondev_help_Raguel_2019-05-10T12:10:36.215400 | 1,557,490,236.2154 | 23,019 |
pythondev | help | that would be the responsibility of your handler | 2019-05-10T12:12:07.215700 | Hiroko | pythondev_help_Hiroko_2019-05-10T12:12:07.215700 | 1,557,490,327.2157 | 23,020 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.