| Conditions | 3 |
| Total Lines | 23 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 7 | def do_checksum(self, encslave, address, uri): |
||
| 8 | url = "http://" + encslave + "/checksum.php" |
||
| 9 | params = self.get_creds2() |
||
| 10 | |||
| 11 | payload = {address: uri} |
||
| 12 | payload_json = json.dumps(payload) |
||
| 13 | params[b"address"] = bytes(payload_json, "utf-8") |
||
| 14 | |||
| 15 | #print(repr(dict(params))) |
||
| 16 | req = self.sess.post(url, data=params) |
||
| 17 | if req.status_code == 200: |
||
| 18 | req.encoding = "utf-8" # Force encoding as server doesn't give one |
||
|
1 ignored issue
–
show
|
|||
| 19 | self.write_dump(req.text) |
||
| 20 | # <ENCRYPT_FOOTER>2abfa6f6507044fec995efede5d818e62a0b19b5</ENCRYPT_FOOTER> means ERROR (invalid ADDRESS!) |
||
|
1 ignored issue
–
show
|
|||
| 21 | if "<ENCRYPT_FOOTER>2abfa6f6507044fec995efede5d818e62a0b19b5</ENCRYPT_FOOTER>" in req.text: |
||
|
1 ignored issue
–
show
|
|||
| 22 | print("INVALID URI: {}".format(uri)) |
||
| 23 | raise SystemExit |
||
| 24 | return req.text |
||
| 25 | else: |
||
| 26 | print("CHECKSUM: " + repr(req)) |
||
| 27 | print(repr(req.headers)) |
||
| 28 | print(repr(req.text)) |
||
| 29 | raise SystemExit |
||
| 30 | |||
| 40 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.