@@ -18,6 +18,7 @@ Available on [readthedocs.org](https://python-odata.readthedocs.io/en/latest/ind
18
18
19
19
## Demo
20
20
21
+ ### Northwind ODATA service
21
22
Reading data from the Northwind service.
22
23
23
24
``` python
@@ -60,9 +61,6 @@ for order_details in values:
60
61
service.values(order_details.Order.Employee)
61
62
```
62
63
63
- Writing changes. Note that the real Northwind service is _ read-only_
64
- and the data modifications do not work against it.
65
-
66
64
``` python
67
65
import datetime
68
66
@@ -79,3 +77,55 @@ for order in query:
79
77
order.Employee = empl
80
78
Service.save(order)
81
79
```
80
+
81
+ ### TripPin ODATA service (v4)
82
+ OData V4 example with Enums.
83
+
84
+ ``` python
85
+ import logging
86
+
87
+ import requests
88
+ import rich
89
+
90
+ # comment on first run so you get the generated package
91
+ import generated.trippin
92
+ from odata import ODataService
93
+
94
+ requests.packages.urllib3.disable_warnings()
95
+
96
+
97
+ def test_trippin (console ):
98
+ proxy = {' http' : ' ' , ' https' : ' ' }
99
+
100
+ session = requests.Session()
101
+
102
+ session.trust_env = False
103
+ session.verify = False
104
+ session.proxies.update(proxy)
105
+
106
+ service = ODataService(
107
+ url = " https://services.odata.org/v4/TripPinServiceRW" ,
108
+ session = session,
109
+ base = generated.trippin.ReflectionBase, # comment on first run
110
+ reflect_entities = True ,
111
+ reflect_output_package = " generated.trippin" )
112
+ People = generated.trippin.People
113
+
114
+ q = service.query(People)
115
+
116
+ values = q.all()
117
+ for value in values:
118
+ console.rule(f " People { value.FirstName} { value.LastName} " )
119
+ service.values(value)
120
+
121
+
122
+ if __name__ == " __main__" :
123
+ logging.basicConfig(level = " DEBUG" )
124
+ console = rich.console.Console()
125
+ test_trippin(console)
126
+ ```
127
+
128
+ Writing changes. Note that the real Northwind service is _ read-only_
129
+ and the data modifications do not work against it.
130
+
131
+
0 commit comments