Exemplo n.º 1
0
 def test_ratelimit_remaining(self):
     # This prevents a regression in the API
     # See 81c800658db43f86419b9c0764fc16aad3d60007
     self.gh.ratelimit_remaining = mock.NonCallableMock()
     github3.ratelimit_remaining()
Exemplo n.º 2
0
user = gh.user(login)
user = auth.user()
day_bins = {today:0}
# Go through each event
for event in user.iter_events():
	# If its a valid streak event
	if event.type in valid_commits:	
		# Only count public events
		if event.public:
			# Get the payload
			payload = event.payload
			# Get created datetime
			cur_dt = get_time_string(utc_to_local(event.created_at).isoformat())
			# If it's a push event
			if event.type == valid_commits[0]:
				# If the commit was to master
				if payload['ref'] == 'refs/heads/master':
					# Add all the commits to streak count
					update_day_bins(cur_dt,len(payload['commits']))
					
			# If it's a comment event
			elif payload['master_branch']==payload['ref']:
				update_day_bins(cur_dt,1)


print 'Recent activity: '
print_calender(now, 100)

print 'Auth calls remaining this hour: ', auth.ratelimit_remaining
print 'Public calls remaining this hour: ',gh.ratelimit_remaining()
Exemplo n.º 3
0
 def test_ratelimit_remaining(self):
     expect(github3.ratelimit_remaining()) > 0
Exemplo n.º 4
0
 def test_ratelimit_remaining(self):
     github3.ratelimit_remaining()
     assert self.gh.ratelimit_remaining.called is True