code: def upload_from_file(self, filename):
          
          key = str(uuid.uuid4())[:8]
  
          form = [('key', key),
                  ('acl', ACL),
                  ('AWSAccessKeyId', AWS_ACCESS_KEY_ID),
                  ('success_action_status', SUCCESS_ACTION_STATUS),
                  ('signature', SIGNATURE),
                  ('Content-Type', CONTENT_TYPE),
                  ('policy', POLICY)]
          data = dict(form)
  
          files = {'file': open(filename, 'rb')}
          r = requests.post(FILE_UPLOAD_ENDPOINT, data=data, files=files)
  
          if r.status_code != 200:
              raise GfycatClientError('Error uploading the GIF', r.status_code)
  
          info = self.uploaded_file_info(key)
          while 'timeout' in info.get('error', '').lower():
              time.sleep(2)
              info = self.uploaded_file_info(key)
          if 'error' in info:
              raise GfycatClientError(info['error'])
  
          return info
docs: Upload a local file to Gfycat