Conversation
…eta in setup.py :/
It interferes with black and is apparently not supported by the PEP anyway.
Codecov Report
@@ Coverage Diff @@
## develop #18 +/- ##
========================================
Coverage 41.02% 41.02%
========================================
Files 20 20
Lines 763 763
Branches 71 71
========================================
Hits 313 313
Misses 436 436
Partials 14 14
Continue to review full report at Codecov.
|
|
|
||
| invite_id, invite_validator = m.create_location(location_name) | ||
|
|
||
| click.echo(base64.urlsafe_b64encode(b''.join((invite_id, invite_validator))).decode("utf-8")) |
There was a problem hiding this comment.
this line is too long (and has too many inner calls) so you should change it to have more temporary variables
|
|
||
| #: The directory in which data for OCSP Dashboard is stored. Can be set from the environment variable | ||
| #: ``OCSPDASH_DIRECTORY`` or defaults to ``~/.ocspdash`` | ||
| OCSPDASH_DIRECTORY = os.environ.get('OCSPDASH_DIRECTORY', os.path.join(os.path.expanduser('~'), '.ocspdash')) |
There was a problem hiding this comment.
should save default OCSPdash location as a variable as well
| if not os.path.exists(OCSPDASH_DIRECTORY): | ||
| os.makedirs(OCSPDASH_DIRECTORY) | ||
|
|
||
| OCSPDASH_DEFAULT_CONNECTION = 'sqlite:///' + os.path.join(OCSPDASH_DIRECTORY, 'ocspdash.db') |
There was a problem hiding this comment.
I don't like what it did here
|
|
||
| #: The rate limit for connecting to Censys. Can be set from the environmental variable ``OCSPDASH_RATE`` or defaults | ||
| # to ``0.2``. | ||
| CENSYS_RATE_LIMIT = float(os.environ.get('OCSPDASH_RATE', 0.2)) # max requests per second |
There was a problem hiding this comment.
too bad os.environ.get doesn't work like the one from flask.request.args.get
| ) # max requests per second | ||
|
|
||
| OCSPDASH_USER_AGENT_IDENTIFIER = f'OCSPdash/{VERSION}' | ||
| OCSPDASH_USER_AGENT = ' '.join([requests.utils.default_user_agent(), OCSPDASH_USER_AGENT_IDENTIFIER]) |
There was a problem hiding this comment.
why do you write it with a join on a space
| return f'Invite for {self.name}' | ||
|
|
||
| def to_json( | ||
| self): # TODO: this gets returned by the /register endpoint and some of this info could be considered private. Should it be removed from the to_json? |
There was a problem hiding this comment.
this is not good. move this TODO
| 'validator_hash': self.validator_hash, | ||
| 'pubkey': str(self.pubkey), | ||
| 'key_id': str(self.key_id), | ||
| 'results': [ |
| """Return a representation of the instance suitable for passing in to JSON conversion.""" | ||
| return { | ||
| 'id': self.id, | ||
| 'location': { |
| print(f'public key:\t{claims["pk"]}'.expandtabs(7)[:78] + '..') | ||
| print(f'invite token:\t{claims["token"]}'.expandtabs(7)) | ||
| else: | ||
| token = scrape( |
| format=serialization.PublicFormat.SubjectPublicKeyInfo, | ||
| ) | ||
| ).decode('utf-8') | ||
| public_key = b64encode(private_key.public_key().public_bytes( |
There was a problem hiding this comment.
also agreed. this is TOO complicated
What do you think?