title: How to add a new item using Python Etsy HTTP API methods?
body: <p>I am trying to use Etsy API to add a new listing on my store. In the documents section it says (below section how to do it). First fyi I  have never used HTTP Method before so I am not sure how to setup the code so that it adds a new item.</p>
  
  <p>(Link to the Etsy API page <a href="https://www.etsy.com/developers/documentation/reference/listing" rel="nofollow noreferrer">https://www.etsy.com/developers/documentation/reference/listing</a>).</p>
  
  <pre><code>Method Name createListing
  Synopsis    Creates a new Listing.
  HTTP Method POST
  URI /listings
  Parameters  
  Name    Required    Default Type
  quantity    Y       int
  title   Y       string
  description Y       text
  price   Y       float
  materials   N       array(string)
  shipping_template_id    N       int
  shop_section_id N       int
  image_ids   N       array(int)
  is_customizable N       boolean
  non_taxable N       boolean
  image   N       image
  state   N   active  enum(active, draft)
  processing_min  N       int
  processing_max  N       int
  category_id N       int
  taxonomy_id N       int
  tags    N       array(string)
  who_made    Y       enum(i_did, collective, someone_else)
  is_supply   Y       boolean
  when_made   Y       enum(made_to_order, 2010_2017, 2000_2009, 1998_1999, before_1998, 1990_1997, 1980s, 1970s, 1960s, 1950s, 1940s, 1930s, 1920s, 1910s, 1900s, 1800s, 1700s, before_1700)
  recipient   N       enum(men, women, unisex_adults, teen_boys, teen_girls, teens, boys, girls, children, baby_boys, baby_girls, babies, birds, cats, dogs, pets, not_specified)
  occasion    N       enum(anniversary, baptism, bar_or_bat_mitzvah, birthday, canada_day, chinese_new_year, cinco_de_mayo, confirmation, christmas, day_of_the_dead, easter, eid, engagement, fathers_day, get_well, graduation, halloween, hanukkah, housewarming, kwanzaa, prom, july_4th, mothers_day, new_baby, new_years, quinceanera, retirement, st_patricks_day, sweet_16, sympathy, thanksgiving, valentines, wedding)
  style   N       array(string)
  Requires OAuth  Y
  Permission Scope    listings_w
  Notes   
  A shipping_template_id is required when creating a listing.
  All listings created on www.etsy.com must be actual items for sale. Please see our guidelines for testingwith live listings.
  Creating a listing creates a single inventory products with the supplied price and quantity. Use updateInventory to add more products.
  </code></pre>
  
  <p>The code I have right know looks like this </p>
  
  <pre><code>import urllib
  import requests
  url = 'https://openapi.etsy.com/v2/listings/active?api_key={YOUR KEY HERE)' # I put my API key here 
  r = requests.get(url)
  
  payload = {'quantity': '1', 'title': 'testdfsdfdfs0','description': 'dfsdfsdfsdfdsf','price': '2.55','who_made': 'i_did','is_supply': '0','when_made': '2010_2017'}
  rrr = requests.post(url,payload)
  print rrr # I get an error 404 
  </code></pre>
  
  <p>How can I add an item for sale on Etsy through Python HTTP method?</p>
  
  <h2>Update</h2>
  
  <pre><code>from requests_oauthlib import OAuth1Session
  import requests
  from requests_oauthlib import OAuth1
  import json
  
  
  tempory_token_url = []
  oauth_response_bucket = []     
  client_key = '.......'
  client_secret = '......'
  
  oauth = OAuth1Session(client_key, client_secret=client_secret)
  
  request_token_url = 'https://openapi.etsy.com/v2/oauth/request_token?scope=email_r%20listings_r'
  fetch_response = oauth.fetch_request_token(request_token_url)    
  resource_owner_key = fetch_response.get('oauth_token') # Have it
  resource_owner_secret = fetch_response.get('oauth_token_secret')
  oauth_url_temp = tempory_token_url[0]['login_urI']
  base_authorization_url = oauth_url_temp
  authorization_url = oauth.authorization_url(base_authorization_url)
  redirect_response = raw_input('Paste the full redirect URL here: ') 
  oauth_response = oauth.parse_authorization_response(redirect_response)
  verifier = oauth_response.get('oauth_verifier')
  access_token_url = redeirect_response 
  oauth = OAuth1Session(client_key=client_secret=client_secret,resource_owner_key=resource_owner_key,resource_owner_secret=resource_owner_secret,verifier=verifier)
  
  oauth_tokens = oauth.fetch_access_token(access_token_url)
  resource_owner_key = oauth_tokens.get('oauth_token')
  resource_owner_secret = oauth_tokens.get('oauth_token_secret')
  </code></pre>
  
  <p>Any ideas how to make this work? There is very little info regarding Etsy API and most of the stuff is in PHP which I have no clue how to work.</p>
  
  <h2>Image Uploading API</h2>
  
  <p>Everything looks the same like above this time I just changed the payload but I am getting a 403 Error. I am not sure what is causing it. My best guess would be something with oauth1.0 i think on their website it says you need oauth 1.1.</p>
  
  <p>Here is how I set it up but I am getting 403 error:</p>
  
  <pre><code>url = 'https://openapi.etsy.com/v2/listings'
  payload = {'listing_id':'342434342', 'image': ("test1.jpg", open('C:\\Users\\abc\\test1.jpg'),'image/jpeg'),'type':'image/jpeg'}
  result = etsy.put(url, params=payload)
  print result 
  </code></pre>