Bases: imgurup.__init__.Imgur
Bases: object
Ask user to choose a album to upload or not belong to any album
| Parameters: | albums (list of dict) – Albums list |
|---|---|
| Returns: | The id of the album |
| Return type: | str |
Display a file dialog and prompt the user to select a image
| Returns: | image path |
|---|---|
| Return type: | str |
Ask user for pin code
| Parameters: |
|
|---|---|
| Returns: | pin code |
| Return type: | str |
Authorization
Return the subprocess args of choose album dialog
| Parameters: |
|
|---|---|
| Returns: | A list include dialog command |
| Return type: | list |
Return the subprocess args of file dialog
| Returns: | A list include dialog command, ex: [‘kdialog’, ‘–msgbox’, ‘hi’] |
|---|---|
| Return type: | list |
Return the subprocess args of show authorization message dialog
| Parameters: |
|
|---|---|
| Returns: | A list include dialog command |
| Return type: | list |
Return the subprocess args of enter pin dialog
| Parameters: | token_msg (str) – Enter token message |
|---|---|
| Returns: | A list include dialog command |
| Return type: | list |
Return the subprocess args of display error dialog
| Parameters: | msg (str) – Error message |
|---|---|
| Returns: | A list include dialog command, ex: [‘kdialog’, ‘–msgbox’, ‘hello’] |
| Return type: | list |
Return the subprocess args of show link dialog
| Parameters: | links (str) – String of the image link and delete link |
|---|---|
| Returns: | A list include dialog command |
| Return type: | list |
Check the value of the result is success or not
| Parameters: | response (dict) – The result return from the server |
|---|---|
| Returns: | True if success, else False |
| Return type: | bool |
Request album list with the account
| Parameters: | account (str) – The account name, ‘me’ means yourself |
|---|---|
| Returns: | Response of requesting albums list (json) |
| Return type: | list of dict |
Request new tokens
| Returns: | json tokens |
|---|---|
| Return type: | dict |
Request and update the access token and refresh token
Request upload image
| Parameters: |
|
|---|---|
| Returns: | Response of upload image |
| Return type: | dict |
Retry calling the decorated function using an exponential backoff.
http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry
| Parameters: |
|
|---|
Read the token value from the config file Set tokens to None if can’t be found in config
Display error message and exit the program
| Parameters: | msg (str) – Error message |
|---|
Show image link
| Parameters: |
|
|---|
Upload a image
| Parameters: |
|
|---|---|
| Returns: |
Write token value to the config There will be maybe more setting needed to be written to config So I just pass result
Used to produce imgur instance. You can call detect_env to auto get a suitable imgur class, and use it as argument in get_imgur. ex: imgur = ImgurFactory.get_imgur(ImgurFactory.detect_env(is_gui)) you can also manually choose a imgur class, ex: imgur = ImgurFactory.get_imgur(KDEImgur)
Detect environment
| Parameters: | is_gui (bool) – If False, choose CLI, otherwise detect settings and choose a GUI mode |
|---|---|
| Returns: | Subclass of Imgur |
| Return type: | type |
Get imgur instance
| Parameters: | imgur_class (type) – The subclass name of Imgur |
|---|---|
| Returns: | Imgur instance |
Bases: imgurup.__init__.Imgur
Bases: imgurup.__init__.Imgur
Bases: imgurup.__init__.Imgur