Oauth1

54 views
Skip to first unread message

Ahsan Khan

unread,
Jun 20, 2023, 7:21:41 AM6/20/23
to immobilienscout24-development
I'm facing this issue when I'm trying to get access token Missing callback. can you please  then I pass the callback url parameter in call but showing unexpected error 
oauth = OAuth1Session(client_key=consumer_key, client_secret=consumer_secret,callbackUrl="http://localhost")

Olaf Lindenau

unread,
Jun 20, 2023, 9:27:52 AM6/20/23
to immobilienscout24-development
Hi,

can you explain a little bit more about your script? Is it python requests_oauthlib library your are using?
Have you already tried instead of oauth = OAuth1Session(client_key=consumer_key, client_secret=consumer_secret,callbackUrl="http://localhost") this one oauth = OAuth1Session(client_key, client_secret=client_secret, callback_uri=callbackUrl)?

Best
Olaf


Ahsan Khan

unread,
Aug 16, 2023, 8:26:04 AM8/16/23
to immobilienscout24-development
Hi Thanks It Was sorted But I'm facing issue on Post an Attachment Can you please guide me how can i post an attachment using python if you can't help me in python so you can help me how can I post an attachment using postman I'm trying from last 2 week approx.

Best
Ahsan

Ahsan Khan

unread,
Aug 16, 2023, 8:28:03 AM8/16/23
to immobilienscout24-development
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<common:messages xmlns:common="http://rest.immobilienscout24.de/schema/common/1.0" xmlns:gis="http://rest.immobilienscout24.de/schema/platform/gis/1.0" xmlns:search="http://rest.immobilienscout24.de/schema/search/common/1.0" xmlns:ns5="http://rest.immobilienscout24.de/schema/search/shortlist/1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
    <message>
        <messageCode>ERROR_COMMON_RESOURCE_NOT_FOUND</messageCode>
        <message>Resource was not found.</message>
    </message>
</common:messages>

Ahsan Khan

unread,
Aug 16, 2023, 8:29:49 AM8/16/23
to immobilienscout24-development
This is the script 
image_file_path = "/home/ahsan_khan/Downloads/images.jpeg"
metadata_file_path = "/home/ahsan_khan/Downloads/body.xml"
 
api_url="https://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/321889166/attachment/"
headers = {
        "Content-Type": "application/xml;"
}

 

files = {
        "attachment": ("attachment",open(image_file_path, "rb"),"image/jpeg"),
    "metadata": ("metadata",open(metadata_file_path, "rb"),"application/xml" ,{"Content-Transfer-Encoding": "binary"})
}

oauth = OAuth1Session(
    client_key=consumer_key,
    client_secret=consumer_secret,
    resource_owner_key=access_token,
    resource_owner_secret=access_token_secret
)
resp = oauth.post(api_url,files=files)
print (resp.text)
Reply all
Reply to author
Forward
0 new messages