Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor BaseProxy __init__ method #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sorce wants to merge 1 commit into petertodd:master
base: master
Choose a base branch
Loading
from sorce:master
Open

Conversation

@sorce
Copy link

@sorce sorce commented Aug 28, 2017

This pull request refactors some of the BaseProxy __init__ methods code to better support the reading in of RPC credentials.

Currently the code will only attempt to read in a cookie file if a configuration file exists and a valid rpcpassword variable is not found in it. This change will fail silently if the configuration file does not exist or is unable to be read (permission issue, etc.), continuing on to try to read a cookie file. if we are unable to find valid credentials in a configuration file and also not able to read a cookie file then we fail and alert the user.

This also fixes a bug introduced in #144 where only passing in a service_url to one of the Proxy classes resulted in an UnboundLocalError like:

Traceback (most recent call last):
 ...
 rpc = bitcoin.rpc.BaseProxy(service_url=url)
 File "/home/sorce/Coding/venvs/test/lib/python3.6/site-packages/bitcoin/rpc.py", line 189, in __init__
 authpair = authpair.encode('utf8')
UnboundLocalError: local variable 'authpair' referenced before assignment

authpair is now checked prior to making the connection and if it is None we assign the parsed username/password from service_url

xuhcc reacted with thumbs up emoji
...ion cookie file even if no configuration file exists
Copy link
Collaborator

kanzure commented Sep 18, 2017

Well, this solves the authpair bug at least.

Copy link

xuhcc commented Oct 4, 2017

@petertodd

Please take a look at this PR.

RPC interface in version 0.8.0 can't be used due to UnboundLocalError in __init__ method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /