<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Recent Posts in Using API in Python - newbie | Unfuddle Community</title>
    <link>http://unfuddle.com/community</link>
    <description>Unfuddle Community Forums</description>
    <item>
      <guid isPermaLink="false">www.unfuddle.com/community:6:663:1999</guid>
      <title>Using API in Python - newbie replied by David C. @ Thu, 27 Aug 2009 00:53:37 UTC</title>
      <link>http://www.unfuddle.com/community/forums/6/topics/663</link>
      <description>Phoebe,

It looks like you may be receiving the 403 Forbidden error because you are attempting to access your account using SSL when it does not support SSL. Try using just 'http' in your example rather than 'https' and see if that works for you.</description>
      <pubDate>Thu, 27 Aug 2009 00:53:37 UTC</pubDate>
      <author>David C.</author>
    </item>
    <item>
      <guid isPermaLink="false">www.unfuddle.com/community:6:663:1803</guid>
      <title>Using API in Python - newbie posted by Phoebe Bright @ Mon, 22 Jun 2009 15:24:33 UTC</title>
      <link>http://www.unfuddle.com/community/forums/6/topics/663</link>
      <description>Based on example from the only script I could find online, I have been implementing an interface to unfuddle but am getting a forbidden 403 error.  Am a bit of a novice at this so any suggestions very welcome.

Here is the code:

import httplib, base64


auth = base64.encodestring(&quot;%s:%s&quot; % (username, pw)).strip()
print auth

headers = {
&quot;Accept&quot;: &quot;application/xml&quot;,
&quot;Content-Type&quot;: &quot;application/xml&quot;,
&quot;Authorization&quot; : &quot;Basic %s&quot; % auth}

conn = httplib.HTTPSConnection(&quot;tinycomms.unfuddle.com&quot;)
print 'connection:',conn.__dict__

conn.request(&quot;GET&quot;, &quot;/api/v1/projects/1/ticket_reports&quot;)
response = conn.getresponse()
print response.__dict__
print response.status, response.reason

conn.close

And the output:

connection: {'_buffer': [], '_HTTPConnection__state': 'Idle', 'cert_file': None, 'sock': None, 'port': 443, 'host': 'tinycomms.unfuddle.com', 'key_file': None, '_HTTPConnection__response': None, '_method': None}

{'fp': &lt;httplib.SSLFile instance at 0x3283fa8&gt;, 'status': 403, 'will_close': False, 'chunk_left': 'UNKNOWN', 'length': 1, 'strict': 0, 'reason': 'Forbidden', 'version': 11, 'debuglevel': 0, 'msg': &lt;httplib.HTTPMessage instance at 0x3283eb8&gt;, 'chunked': 0, '_method': 'GET'}

403 Forbidden</description>
      <pubDate>Mon, 22 Jun 2009 15:24:33 UTC</pubDate>
      <author>Phoebe Bright</author>
    </item>
    <item>
      <guid isPermaLink="false">www.unfuddle.com/community:6:663:1804</guid>
      <title>Using API in Python - newbie replied by Joshua Frappier @ Mon, 22 Jun 2009 22:22:50 UTC</title>
      <link>http://www.unfuddle.com/community/forums/6/topics/663</link>
      <description>Phoebe,

I am not very familiar with PHP, however, one of our customers did provide an example using libcurl instead of httplib. The example can be found in the Unfuddle API documentation, here:

http://unfuddle.com/docs/api/code_examples#php

I hope that helps!</description>
      <pubDate>Mon, 22 Jun 2009 22:22:50 UTC</pubDate>
      <author>Joshua Frappier</author>
    </item>
    <item>
      <guid isPermaLink="false">www.unfuddle.com/community:6:663:1973</guid>
      <title>Using API in Python - newbie replied by Phoebe Bright @ Mon, 17 Aug 2009 13:07:54 UTC</title>
      <link>http://www.unfuddle.com/community/forums/6/topics/663</link>
      <description>Still playing around with trying to access unfuddle from PYTHON.

This is the current code that still says 'Forbidden 403'

        import httplib, base64, urllib2

        url = &quot;%s://%s.unfuddle.com/api/v1/%s&quot; % ('https', 'tinycomms', 'projects')   

        auth_handler = urllib2.HTTPBasicAuthHandler()
        auth_handler.add_password(realm='Unfuddle API',
                           uri=url,
                           user=settings['username'],
                           passwd=settings['password'])
        opener = urllib2.build_opener(auth_handler)
        opener.addheaders = [
             ('Content-Type', 'application/xml'),
             ('Accept', 'application/json')
             ] 

        try:
             response = opener.open(url).read().strip()
             print 'response:',response
        except IOError, e:
             print IOError, e


Will have to give up and try another ticketing system if I can't sort it soon - but it must be something obvious???

Apologies for code running together - tried editing it and can't get line breaks in.  Not having a good day...</description>
      <pubDate>Mon, 17 Aug 2009 13:07:54 UTC</pubDate>
      <author>Phoebe Bright</author>
    </item>
  </channel>
</rss>

