Skip to content
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

TypeError: __init__() got an unexpected keyword argument 'auth' #107

Open
FaizalReza007 opened this issue Sep 29, 2016 · 0 comments
Open

Comments

@FaizalReza007
Copy link

Windows: 10
Python: 3.5

I m trying to make a post request using urllib.request and urllib.parse. I am using HTTPBasic Auth which is not right because I dont know what exactly to use for username and password in base64 so my Oracle Eloqua would understand it

import urllib.parse
import urllib.request
import base64
from requests.auth import HTTPBasicAuth
url = 'https://secure.p03.eloqua.com/API/REST/1.0/assets/contact/segment'
values = {
"name":"NewRestContactSegment"
}
data = urllib.parse.urlencode(values)
data = data.encode('UTF-8') # data should be bytes
req = urllib.request.Request(url, data, headers={"content-type":"application/json"}, auth=HTTPBasicAuth('companyname\xxx.xxx', 'xxxxx@123'))
resp = urllib.request.urlopen(req)
responseD = resp.read()
print (responseD)

error3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant