-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds twarc.config.ConfigProvider which is based on click_config_file.configobj_provider and stores the file path for the config file that was used. This is useful for logging. Also when --verbose is used the log will now contain the keys that are being used to talk to the API. This isn't something you would normally want in your logs, but it can be useful for debugging situations like #441 and #469.
- Loading branch information
Showing
4 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import logging | ||
import configobj | ||
|
||
# Adapted from click_config_file.configobj_provider so that we can store the | ||
# file path that the config was loaded from in order to log it later. | ||
|
||
log = logging | ||
|
||
class ConfigProvider(): | ||
|
||
def __init__(self): | ||
self.file_path = None | ||
|
||
def __call__(self, file_path, cmd_name): | ||
self.file_path = file_path | ||
return configobj.ConfigObj(file_path, unrepr=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version = '2.1.3' | ||
version = '2.1.4' |