Source: debiancontributors
Version: 0.7.10
Severity: important
x-debbugs-cc: enr...@debian.org, ti...@debian.org, er...@debian.org
Tags: patch

Hi,

The current python example mentioned in the README.md does not work and gives a 
few errors
with fallouts with change in API and newer datetime lib.

Please consider to apply attached patch.

Thanks,
Nilesh

From 8f09dfd6e06455d5eca8f83920159c4ea6883863 Mon Sep 17 00:00:00 2001
From: Nilesh Patra <nil...@debian.org>
Date: Sat, 19 Oct 2024 01:59:47 +0530
Subject: [PATCH] Fix python code to post Data in README


diff --git a/README.md b/README.md
index ab53f99..d4884f5 100644
--- a/README.md
+++ b/README.md
@@ -45,7 +45,7 @@ Assuming you [created a data source in the website][newds] called
 `myteam.debian.net` with authentication token 'foobar'.
 
 	import debiancontributors as dc
-	from datetime import Date
+	from datetime import date
 
 	# Create a Submission
 	s = dc.Submission("myteam.debian.net")
@@ -53,15 +53,17 @@ Assuming you [created a data source in the website][newds] called
 	# Add contribution data to it
 	s.add_contribution(
 		dc.Identifier("email", "enr...@debian.org"),
-		dc.Contribution("shave_yaks", Date(2013, 1, 1), Date(2013, 12, 23)))
+		dc.Contribution("shave_yaks", date(2013, 1, 1), date(2013, 12, 23)))
 
 	# Post it to the site
-	success, info = s.post("foobar")
+	s.set_auth_token("foobar")
+	success, info = s.post()
 	if not success:
 		import json
 		print("submission failed:")
 		print(json.dumps(info, indent=1))
-
+	else:
+		print("submission succeeded")
 
 ## Posting data the way you like
 
-- 
2.43.0

Reply via email to