(self, uri, data=None)
| 135 | return self._last_json |
| 136 | |
| 137 | def post(self, uri, data=None): |
| 138 | from urllib.parse import unquote |
| 139 | |
| 140 | uri = unquote(uri, errors="strict") |
| 141 | if not data: |
| 142 | data = {} |
| 143 | with requests.Session() as session: |
| 144 | resp = session.post( |
| 145 | self.server_addr + uri, |
| 146 | json=data, |
| 147 | headers={"Connection": "close"}, |
| 148 | timeout=2, |
| 149 | ) |
| 150 | try: |
| 151 | self._last_resp = resp |
| 152 | self._last_json = resp.json() |
| 153 | except Exception: |
| 154 | return self._last_resp |
| 155 | |
| 156 | @property |
| 157 | def last_json(self): |
no outgoing calls
no test coverage detected