| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ | |||
| 12 | 12 | import datetime | |
| 13 | 13 | import requests | |
| 14 | 14 | ||
| 15 | - | ||
| 16 | 15 | _errorcodes = { | |
| 17 | 16 | -32601: errors.MethodNotFoundError, | |
| 18 | 17 | -8504: errors.BadCredentialsError, | |
@@ -50,7 +49,6 @@ def rpc_request(config, method, params): | |||
| 50 | 49 | for v in params.values(): | |
| 51 | 50 | assert not isinstance(v, bytestring) | |
| 52 | 51 | ||
| 53 | - | ||
| 54 | 52 | url = server + u'?school=' + school | |
| 55 | 53 | ||
| 56 | 54 | headers = { | |
@@ -118,7 +116,7 @@ def _parse_result(request_body, result_body): | |||
| 118 | 116 | ||
| 119 | 117 | if request_body[u'id'] != result_body[u'id']: | |
| 120 | 118 | raise errors.RemoteError( | |
| 121 | - 'Request ID was not the same one as returned. %s -- %s' % (request_body[u'id'], result_body[u'id']) ) | ||
| 119 | + 'Request ID was not the same one as returned. %s -- %s' % (request_body[u'id'], result_body[u'id'])) | ||
| 122 | 120 | ||
| 123 | 121 | try: | |
| 124 | 122 | return result_body[u'result'] | |
@@ -143,6 +141,7 @@ def _parse_error_code(request_body, result_body): | |||
| 143 | 141 | exc.code = code | |
| 144 | 142 | raise exc | |
| 145 | 143 | ||
| 144 | + | ||
| 146 | 145 | def _send_request(url, data, headers, http_session=None): | |
| 147 | 146 | '''Sends a POST request given the endpoint URL, JSON-encodable data, | |
| 148 | 147 | a dictionary with headers and, optionally, a session object for requests. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,9 +34,9 @@ def server(url): | |||
| 34 | 34 | 'parameter.') | |
| 35 | 35 | ||
| 36 | 36 | return urlobj.scheme + \ | |
| 37 | - u'://' + \ | ||
| 38 | - urlobj.netloc + \ | ||
| 39 | - (urlobj.path or u'/WebUntis/jsonrpc.do') | ||
| 37 | + u'://' + \ | ||
| 38 | + urlobj.netloc + \ | ||
| 39 | + (urlobj.path or u'/WebUntis/jsonrpc.do') | ||
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | 42 | def string(value): | |
@@ -45,6 +45,7 @@ def string(value): | |||
| 45 | 45 | return value | |
| 46 | 46 | return value.decode('ascii') | |
| 47 | 47 | ||
| 48 | + | ||
| 48 | 49 | config_keys = { | |
| 49 | 50 | 'username': string, | |
| 50 | 51 | 'password': string, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments