You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -115,16 +116,16 @@ The [models.py](vilocify/models.py) module defines the SDK models and their rela
115
116
Relationships cannot be set through the model constructor, but instead must be set using assignment. For example:
116
117
117
118
```python
118
-
sub = Subscription(role="user") # role is an attribute
119
+
sub = Subscription(role="user") # role is an attribute
119
120
sub.membership = Membership(id="<a_membership_id_here>") # `.membership` is a to-one relation
120
121
sub.monitoring_list = MonitoringList(id="<a_ml_id_here>") # `.monitoring_list` is a to-one relation
121
122
sub.create() # Performs the API request to create the subscription
122
123
123
124
124
-
ml = MonitoringList(name="Example list") # name is an attribute
125
+
ml = MonitoringList(name="Example list") # name is an attribute
125
126
ml.components = [ # components is a to-many relationship
126
127
Component(id="40866"),
127
-
Component(id="148860")
128
+
Component(id="148860"),
128
129
]
129
130
ml.create() # Creates a monitoring list with the two given components
130
131
```
@@ -139,22 +140,25 @@ For example
139
140
ml = MonitoringList.first()
140
141
ml.components = [ # Replaces all components on the monitoring list, no request is sent, yet.
141
142
Component(id="1"),
142
-
Component(id="2")
143
+
Component(id="2"),
143
144
]
144
145
ml.update() # Commit the change to the Vilocify API
145
146
146
147
147
148
ml = MonitoringList.first()
148
-
ml.components.extend(Component(id="3"), Component(id="5")) # Adds component with IDs 1 and 2, and immediately sends the change to the API backend
149
+
ml.components.extend(
150
+
Component(id="3"), Component(id="5")
151
+
) # Adds component with IDs 1 and 2, and immediately sends the change to the API backend
149
152
```
150
153
151
154
### Proxy setup
152
155
The SDK uses a `requests.Session()` to handle its HTTP requests, which picks up the proxy settings from the `https_proxy` environment variable as documented [here](https://requests.readthedocs.io/en/latest/user/advanced/#proxies).
0 commit comments