Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:50:07+00:00 2026-06-11T15:50:07+00:00

def request(): #encoded_xml = urllib.urlencode({‘XML’: read_xml()}) #encoded_xml = read_xml() headers = {‘Authorization’: AUTH_TOKEN,\ ‘developerToken’:

  • 0
def request():
    #encoded_xml = urllib.urlencode({'XML': read_xml()})
    #encoded_xml = read_xml()
    headers = {'Authorization': AUTH_TOKEN,\
               'developerToken': DEVELOPER_TOKEN,\
               'clientCostumerID': CLIENT_ID}
    content = {'__rdxml': encoded_xml}
    #content = encoded_xml
    #content = {'__rdxml': read_xml2()}
    r = requests.post(URL, data=content,\
        headers=headers)
    return r

These combinations don’t seem to work.

The headers are not set for some reason.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:50:08+00:00Added an answer on June 11, 2026 at 3:50 pm

    Just send xml bytes directly:

    #!/usr/bin/env python2
    # -*- coding: utf-8 -*-
    import requests
    
    xml = """<?xml version='1.0' encoding='utf-8'?>
    <a>б</a>"""
    headers = {'Content-Type': 'application/xml'} # set what your server accepts
    print requests.post('http://httpbin.org/post', data=xml, headers=headers).text
    

    Output

    {
      "origin": "x.x.x.x",
      "files": {},
      "form": {},
      "url": "http://httpbin.org/post",
      "args": {},
      "headers": {
        "Content-Length": "48",
        "Accept-Encoding": "identity, deflate, compress, gzip",
        "Connection": "keep-alive",
        "Accept": "*/*",
        "User-Agent": "python-requests/0.13.9 CPython/2.7.3 Linux/3.2.0-30-generic",
        "Host": "httpbin.org",
        "Content-Type": "application/xml"
      },
      "json": null,
      "data": "<?xml version='1.0' encoding='utf-8'?>\n<a>\u0431</a>"
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import urllib, urllib2 def URLRequest(url, params, method=GET): if method == POST: return urllib2.Request(url, data=urllib.encode(params))
def sss(request): handle=open('b.txt','r+') handle.write(I AM NEW FILE) var=handle.read(); return HttpResponse(var) urlpatterns = patterns('', ('^$',sss),
this is the code: def create(request, form_class=MapForm, template_name=maps/create.html): map_form = form_class(request.POST or None) if
Given the following view : def comments(request): comments_list = Thing.objects.filter(thing_type=2) #Thing model extends MPTTModel
In my django views i have the following def create(request): query=header.objects.filter(id=a)[0] a=query.criteria_set.all() logging.debug(a.details) I
I have a view in a Django 1.4 project: def index(request): print reverse('menus_index') latest_menu_list
I tried to read a file in a view like this: def foo(request): f
to have autocompletion on an input,I do this: in views.py : def getpositions(request): if
def register_page(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): user = User.objects.creat_user(
I have a function like this: def eventcateg_detail(request): ca = EventTypeCategory.objects.values() for i in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.